-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (99 loc) · 3 KB
/
Copy pathci.yml
File metadata and controls
114 lines (99 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: CI
on:
push:
branches: [main, master]
pull_request:
merge_group:
permissions:
contents: read
jobs:
test:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.26.4"
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libx11-dev libxtst-dev pkg-config
- name: Test
shell: bash
run: |
if [ "${{ runner.os }}" = "Windows" ]; then export CGO_ENABLED=0; fi
go test -v ./...
- name: Build
shell: bash
run: |
if [ "${{ runner.os }}" = "Windows" ]; then export CGO_ENABLED=0; fi
go build -v ./...
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.26.4"
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libx11-dev libxtst-dev pkg-config
- name: Check formatting
run: |
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "::error::These files are not gofmt-formatted:"
echo "$unformatted"
exit 1
fi
- name: Vet
run: go vet ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v7
with:
version: v2.1.6
args: --timeout=10m
release-config:
name: Validate release config
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.26.4"
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
install-only: true
- name: goreleaser check
run: goreleaser check -f .goreleaser.yml
- name: Validate Windows resource generation
run: |
go run github.com/josephspurrier/goversioninfo/cmd/goversioninfo@v1.7.0 -64 -o /tmp/amd64.syso versioninfo.json
go run github.com/josephspurrier/goversioninfo/cmd/goversioninfo@v1.7.0 -64 -arm -o /tmp/arm64.syso versioninfo.json
snap-validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate snapcraft.yaml
run: |
python3 - <<'PY'
import yaml, sys
snap = yaml.safe_load(open("snapcraft.yaml"))
missing = [f for f in ("name", "base", "summary", "description", "parts", "apps") if f not in snap]
if missing:
print("::error::missing fields:", missing); sys.exit(1)
print("snapcraft.yaml is valid")
PY