ci.yml RawHistoryFolder
1name: CI
2
3permissions:
4 contents: read
5
6on:
7 push:
8 branches: [main, next]
9 paths:
10 - '**.go'
11 - 'go.mod'
12 - 'go.sum'
13 - '.golangci.yml'
14 - 'Makefile'
15 - 'sqlc.yaml'
16 - 'assets/**'
17 - '.github/workflows/**'
18 pull_request:
19
20jobs:
21 changes:
22 runs-on: ubuntu-latest
23 permissions:
24 contents: read
25 # dorny/paths-filter uses PR metadata to compute changed files.
26 pull-requests: read
27 outputs:
28 ci: ${{ steps.filter.outputs.ci }}
29 steps:
30 - uses: actions/checkout@v7.0.1
31 with:
32 fetch-depth: 0
33 - uses: dorny/paths-filter@v4
34 id: filter
35 with:
36 base: ${{ github.event_name == 'push' && github.ref_name || '' }}
37 filters: |
38 ci:
39 - '**.go'
40 - 'go.mod'
41 - 'go.sum'
42 - '.golangci.yml'
43 - 'Makefile'
44 - 'sqlc.yaml'
45 - 'assets/**'
46 - '.github/workflows/**'
47
48 lint:
49 needs: changes
50 if: needs.changes.outputs.ci == 'true'
51 runs-on: ubuntu-latest
52 container:
53 image: archlinux:latest
54 steps:
55 - name: Install dependencies
56 run: |
57 for attempt in 1 2 3; do
58 if pacman -Syu --noconfirm && pacman -S --noconfirm git go webkitgtk-6.0 gtk4 gtk4-layer-shell gobject-introspection base-devel brotli; then
59 exit 0
60 fi
61 if [ "$attempt" -eq 3 ]; then
62 exit 1
63 fi
64 sleep 5
65 done
66 - uses: actions/checkout@v7.0.1
67 - name: Allow git commands in container checkout
68 run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
69 - name: Set up pinned Go toolchain
70 uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e
71 with:
72 go-version-file: go.mod
73 cache: false
74 - name: Cache Go modules
75 uses: actions/cache@v6
76 with:
77 path: ~/go/pkg/mod
78 key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
79 restore-keys: |
80 ${{ runner.os }}-go-mod-
81 - name: Cache Go build cache
82 uses: actions/cache@v6
83 with:
84 path: ~/.cache/go-build
85 key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
86 restore-keys: |
87 ${{ runner.os }}-go-build-
88 - name: Build application and systemviews assets
89 run: make build
90 - name: Verify generated systemviews artifacts
91 run: make verify-generated
92 - name: Install golangci-lint
93 run: |
94 make install-golangci-lint
95 echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
96 - name: Run golangci-lint
97 run: golangci-lint run --timeout=20m
98
99 test:
100 needs: changes
101 if: needs.changes.outputs.ci == 'true'
102 runs-on: ubuntu-latest
103 container:
104 image: archlinux:latest
105 steps:
106 - name: Install dependencies
107 run: |
108 for attempt in 1 2 3; do
109 if pacman -Syu --noconfirm && pacman -S --noconfirm git go webkitgtk-6.0 gtk4 gtk4-layer-shell libadwaita gobject-introspection base-devel brotli dbus nodejs; then
110 exit 0
111 fi
112 if [ "$attempt" -eq 3 ]; then
113 exit 1
114 fi
115 sleep 5
116 done
117 - uses: actions/checkout@v7.0.1
118 - name: Set up pinned Go toolchain
119 uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e
120 with:
121 go-version-file: go.mod
122 cache: false
123 - name: Cache Go modules
124 uses: actions/cache@v6
125 with:
126 path: ~/go/pkg/mod
127 key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
128 restore-keys: |
129 ${{ runner.os }}-go-mod-
130 - name: Cache Go build cache
131 uses: actions/cache@v6
132 with:
133 path: ~/.cache/go-build
134 key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
135 restore-keys: |
136 ${{ runner.os }}-go-build-
137 - name: Build application and systemviews assets
138 run: make build
139 - name: Run tests
140 env:
141 GDK_BACKEND: wayland
142 WAYLAND_DISPLAY: wayland-0
143 DUMBER_REQUIRE_SYSTEMVIEWS_WASM: 1
144 DUMBER_REQUIRE_NODE: 1
145 run: go test -v ./...
146 - name: Verify purego-only constraints
147 run: make verify-purego
148 - name: Verify CGO-disabled build
149 run: CGO_ENABLED=0 go build -buildvcs=false -o /tmp/dumber ./cmd/dumber && rm -f /tmp/dumber