fix: lint #16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| merge_group: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: Test (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.26.4" | |
| - name: Install Linux dependencies | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgtk-3-dev libx11-dev libxtst-dev pkg-config | |
| - name: Test | |
| shell: bash | |
| run: | | |
| if [ "${{ runner.os }}" = "Windows" ]; then export CGO_ENABLED=0; fi | |
| go test -v ./... | |
| - name: Build | |
| shell: bash | |
| run: | | |
| if [ "${{ runner.os }}" = "Windows" ]; then export CGO_ENABLED=0; fi | |
| go build -v ./... | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.26.4" | |
| - name: Install Linux dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgtk-3-dev libx11-dev libxtst-dev pkg-config | |
| - name: Check formatting | |
| run: | | |
| unformatted=$(gofmt -l .) | |
| if [ -n "$unformatted" ]; then | |
| echo "::error::These files are not gofmt-formatted:" | |
| echo "$unformatted" | |
| exit 1 | |
| fi | |
| - name: Vet | |
| run: go vet ./... | |
| - name: golangci-lint | |
| uses: golangci/golangci-lint-action@v7 | |
| with: | |
| version: v2.1.6 | |
| args: --timeout=10m | |
| release-config: | |
| name: Validate release config | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.26.4" | |
| - name: Install GoReleaser | |
| uses: goreleaser/goreleaser-action@v6 | |
| with: | |
| install-only: true | |
| - name: goreleaser check | |
| run: goreleaser check -f .goreleaser.yml | |
| - name: Validate Windows resource generation | |
| run: | | |
| go run github.com/josephspurrier/goversioninfo/cmd/goversioninfo@v1.7.0 -64 -o /tmp/amd64.syso versioninfo.json | |
| go run github.com/josephspurrier/goversioninfo/cmd/goversioninfo@v1.7.0 -64 -arm -o /tmp/arm64.syso versioninfo.json | |
| snap-validate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Validate snapcraft.yaml | |
| run: | | |
| python3 - <<'PY' | |
| import yaml, sys | |
| snap = yaml.safe_load(open("snapcraft.yaml")) | |
| missing = [f for f in ("name", "base", "summary", "description", "parts", "apps") if f not in snap] | |
| if missing: | |
| print("::error::missing fields:", missing); sys.exit(1) | |
| print("snapcraft.yaml is valid") | |
| PY |