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
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 pacman -Syu --noconfirm
58 pacman -S --noconfirm git go webkitgtk-6.0 gtk4 gtk4-layer-shell gobject-introspection base-devel brotli
59 - uses: actions/checkout@v7
60 - name: Allow git commands in container checkout
61 run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
62 - name: Set up pinned Go toolchain
63 uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c
64 with:
65 go-version-file: go.mod
66 cache: false
67 - name: Cache Go modules
68 uses: actions/cache@v6
69 with:
70 path: ~/go/pkg/mod
71 key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
72 restore-keys: |
73 ${{ runner.os }}-go-mod-
74 - name: Cache Go build cache
75 uses: actions/cache@v6
76 with:
77 path: ~/.cache/go-build
78 key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
79 restore-keys: |
80 ${{ runner.os }}-go-build-
81 - name: Build application and systemviews assets
82 run: make build
83 - name: Verify generated systemviews artifacts
84 run: make verify-generated
85 - name: Install golangci-lint
86 run: |
87 make install-golangci-lint
88 echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
89 - name: Run golangci-lint
90 run: golangci-lint run --timeout=20m
91
92 test:
93 needs: changes
94 if: needs.changes.outputs.ci == 'true'
95 runs-on: ubuntu-latest
96 container:
97 image: archlinux:latest
98 steps:
99 - name: Install dependencies
100 run: |
101 pacman -Syu --noconfirm
102 pacman -S --noconfirm git go webkitgtk-6.0 gtk4 gtk4-layer-shell libadwaita gobject-introspection base-devel brotli dbus
103 - uses: actions/checkout@v7
104 - name: Set up pinned Go toolchain
105 uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c
106 with:
107 go-version-file: go.mod
108 cache: false
109 - name: Cache Go modules
110 uses: actions/cache@v6
111 with:
112 path: ~/go/pkg/mod
113 key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
114 restore-keys: |
115 ${{ runner.os }}-go-mod-
116 - name: Cache Go build cache
117 uses: actions/cache@v6
118 with:
119 path: ~/.cache/go-build
120 key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
121 restore-keys: |
122 ${{ runner.os }}-go-build-
123 - name: Build application and systemviews assets
124 run: make build
125 - name: Run tests
126 env:
127 GDK_BACKEND: wayland
128 WAYLAND_DISPLAY: wayland-0
129 run: go test -v ./...
130 - name: Verify purego-only constraints
131 run: make verify-purego
132 - name: Verify CGO-disabled build
133 run: CGO_ENABLED=0 go build -buildvcs=false -o /tmp/dumber ./cmd/dumber && rm -f /tmp/dumber