name: CI permissions: contents: read on: push: branches: [main, next] paths: - '**.go' - 'go.mod' - 'go.sum' - '.golangci.yml' - 'Makefile' - 'sqlc.yaml' - 'assets/**' - '.github/workflows/**' pull_request: jobs: changes: runs-on: ubuntu-latest permissions: contents: read # dorny/paths-filter uses PR metadata to compute changed files. pull-requests: read outputs: ci: ${{ steps.filter.outputs.ci }} steps: - uses: actions/checkout@v7.0.1 with: fetch-depth: 0 - uses: dorny/paths-filter@v4 id: filter with: base: ${{ github.event_name == 'push' && github.ref_name || '' }} filters: | ci: - '**.go' - 'go.mod' - 'go.sum' - '.golangci.yml' - 'Makefile' - 'sqlc.yaml' - 'assets/**' - '.github/workflows/**' lint: needs: changes if: needs.changes.outputs.ci == 'true' runs-on: ubuntu-latest container: image: archlinux:latest steps: - name: Install dependencies run: | for attempt in 1 2 3; do if pacman -Syu --noconfirm && pacman -S --noconfirm git go webkitgtk-6.0 gtk4 gtk4-layer-shell gobject-introspection base-devel brotli; then exit 0 fi if [ "$attempt" -eq 3 ]; then exit 1 fi sleep 5 done - uses: actions/checkout@v7.0.1 - name: Allow git commands in container checkout run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - name: Set up pinned Go toolchain uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e with: go-version-file: go.mod cache: false - name: Cache Go modules uses: actions/cache@v6 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go-mod- - name: Cache Go build cache uses: actions/cache@v6 with: path: ~/.cache/go-build key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go-build- - name: Build application and systemviews assets run: make build - name: Verify generated systemviews artifacts run: make verify-generated - name: Install golangci-lint run: | make install-golangci-lint echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH" - name: Run golangci-lint run: golangci-lint run --timeout=20m test: needs: changes if: needs.changes.outputs.ci == 'true' runs-on: ubuntu-latest container: image: archlinux:latest steps: - name: Install dependencies run: | for attempt in 1 2 3; do 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 exit 0 fi if [ "$attempt" -eq 3 ]; then exit 1 fi sleep 5 done - uses: actions/checkout@v7.0.1 - name: Set up pinned Go toolchain uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e with: go-version-file: go.mod cache: false - name: Cache Go modules uses: actions/cache@v6 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go-mod- - name: Cache Go build cache uses: actions/cache@v6 with: path: ~/.cache/go-build key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go-build- - name: Build application and systemviews assets run: make build - name: Run tests env: GDK_BACKEND: wayland WAYLAND_DISPLAY: wayland-0 DUMBER_REQUIRE_SYSTEMVIEWS_WASM: 1 DUMBER_REQUIRE_NODE: 1 run: go test -v ./... - name: Verify purego-only constraints run: make verify-purego - name: Verify CGO-disabled build run: CGO_ENABLED=0 go build -buildvcs=false -o /tmp/dumber ./cmd/dumber && rm -f /tmp/dumber