ci.yml RawHistoryFolder
1name: CI
2
3on:
4 push:
5 branches: [main]
6 paths:
7 - '**.go'
8 - 'go.mod'
9 - 'go.sum'
10 - '.golangci.yml'
11 - 'Makefile'
12 - 'sqlc.yaml'
13 - 'assets/**'
14 - '.github/workflows/**'
15 pull_request:
16
17jobs:
18 changes:
19 runs-on: ubuntu-latest
20 outputs:
21 ci: ${{ steps.filter.outputs.ci }}
22 steps:
23 - uses: actions/checkout@v6
24 with:
25 fetch-depth: 0
26 - uses: dorny/paths-filter@v4
27 id: filter
28 with:
29 filters: |
30 ci:
31 - '**.go'
32 - 'go.mod'
33 - 'go.sum'
34 - '.golangci.yml'
35 - 'Makefile'
36 - 'sqlc.yaml'
37 - 'assets/**'
38 - '.github/workflows/**'
39
40 lint:
41 needs: changes
42 if: needs.changes.outputs.ci == 'true'
43 runs-on: ubuntu-latest
44 container:
45 image: archlinux:latest
46 steps:
47 - name: Install dependencies
48 run: |
49 pacman -Syu --noconfirm
50 pacman -S --noconfirm git go webkitgtk-6.0 gtk4 gobject-introspection base-devel brotli
51 - uses: actions/checkout@v6
52 - name: Cache Go modules
53 uses: actions/cache@v5
54 with:
55 path: ~/go/pkg/mod
56 key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
57 restore-keys: |
58 ${{ runner.os }}-go-mod-
59 - name: Cache Go build cache
60 uses: actions/cache@v5
61 with:
62 path: ~/.cache/go-build
63 key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
64 restore-keys: |
65 ${{ runner.os }}-go-build-
66 - name: Build application and systemviews assets
67 run: make build
68 - name: Install golangci-lint
69 run: |
70 curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b /usr/local/bin latest
71 - name: Run golangci-lint
72 run: |
73 git config --global --add safe.directory "$GITHUB_WORKSPACE"
74 golangci-lint run --timeout=20m
75
76 test:
77 needs: changes
78 if: needs.changes.outputs.ci == 'true'
79 runs-on: ubuntu-latest
80 container:
81 image: archlinux:latest
82 steps:
83 - name: Install dependencies
84 run: |
85 pacman -Syu --noconfirm
86 pacman -S --noconfirm git go webkitgtk-6.0 gtk4 libadwaita gobject-introspection base-devel brotli
87 - uses: actions/checkout@v6
88 - name: Cache Go modules
89 uses: actions/cache@v5
90 with:
91 path: ~/go/pkg/mod
92 key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
93 restore-keys: |
94 ${{ runner.os }}-go-mod-
95 - name: Cache Go build cache
96 uses: actions/cache@v5
97 with:
98 path: ~/.cache/go-build
99 key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
100 restore-keys: |
101 ${{ runner.os }}-go-build-
102 - name: Build application and systemviews assets
103 run: make build
104 - name: Run tests
105 env:
106 GDK_BACKEND: wayland
107 WAYLAND_DISPLAY: wayland-0
108 run: go test -v ./...
109 - name: Verify purego-only constraints
110 run: make verify-purego
111 - name: Verify CGO-disabled build
112 run: CGO_ENABLED=0 go build -buildvcs=false -o /tmp/dumber ./cmd/dumber && rm -f /tmp/dumber