-
-
Notifications
You must be signed in to change notification settings - Fork 67
236 lines (189 loc) · 6.08 KB
/
ci.yml
File metadata and controls
236 lines (189 loc) · 6.08 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: "1.26.2"
- name: Install system dependencies
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libpcsclite-dev
- name: Tidy modules
run: go mod tidy
- name: Test
run: go test -v ./...
- name: Build
run: go build -v ./...
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: "1.26.2"
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libpcsclite-dev
- name: Check formatting
run: |
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "::error::The following files are not formatted with gofmt:"
echo "$unformatted"
exit 1
fi
- name: Vet
run: go vet ./...
mod-tidy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: "1.26.2"
- name: Check go.mod and go.sum are tidy
run: |
go mod tidy
if ! git diff --quiet go.mod go.sum; then
echo "::error::go.mod or go.sum are not tidy. Run 'go mod tidy' and commit the changes."
git diff go.mod go.sum
exit 1
fi
website:
runs-on: ubuntu-latest
defaults:
run:
working-directory: docs
steps:
- uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
cache: npm
cache-dependency-path: docs/package-lock.json
- name: Install dependencies
run: npm ci
- name: Build
run: npx docusaurus build
snap:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Validate snapcraft.yaml
run: |
sudo snap install snapcraft --classic
# Verify snapcraft can parse the project file
snapcraft list-plugins
# Validate YAML structure and required fields
python3 << 'PYEOF'
import yaml, sys
with open("snapcraft.yaml") as f:
snap = yaml.safe_load(f)
errors = []
for field in ("name", "base", "summary", "description", "parts"):
if field not in snap:
errors.append(f"Missing required field: {field}")
if "apps" in snap:
for app_name, app in snap["apps"].items():
if "command" not in app:
errors.append(f"App '{app_name}' missing 'command'")
if "parts" in snap:
for part_name, part in snap["parts"].items():
if "plugin" not in part and "override-build" not in part:
errors.append(f"Part '{part_name}' missing 'plugin' or 'override-build'")
if errors:
for e in errors:
print(f"::error::{e}", file=sys.stderr)
sys.exit(1)
print("snapcraft.yaml is valid.")
PYEOF
flatpak:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3-pip
pip3 install PyYAML
- name: Validate Flatpak manifest YAML
run: python3 -c "import yaml, sys; yaml.safe_load(open('com.floatpane.matcha.yaml'))"
- name: Check Flatpak manifest structure
run: |
python3 << 'EOF'
import yaml, sys
with open("com.floatpane.matcha.yaml") as f:
manifest = yaml.safe_load(f)
errors = []
for field in ("id", "runtime", "runtime-version", "sdk", "command", "modules"):
if field not in manifest:
errors.append(f"Missing required field: {field}")
if "modules" in manifest:
for mod in manifest["modules"]:
if "name" not in mod:
errors.append(f"Module missing 'name' field: {mod}")
if "sources" not in mod and "buildsystem" not in mod:
errors.append(f"Module '{mod.get('name', '?')}' missing 'sources' or 'buildsystem'")
if errors:
for e in errors:
print(f"::error::{e}", file=sys.stderr)
sys.exit(1)
print("Flatpak manifest is valid.")
EOF
nix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- name: Check flake
run: nix flake check --no-build
lua-plugins:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Lua
run: sudo apt-get update && sudo apt-get install -y lua5.4
- name: Check Lua syntax
run: |
failed=0
for f in plugins/*.lua; do
if ! luac -p "$f" 2>&1; then
echo "::error file=$f::Syntax error in $f"
failed=1
fi
done
exit $failed
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: "1.26.2"
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v7
with:
install-only: true
- name: Validate release config
run: goreleaser check -f .goreleaser.yml
- name: Validate nightly config
run: goreleaser check -f .goreleaser.nightly.yml