ci(workflows): add lint, test, and release automation
- commit
- ed6bb537b32841a364b770f8cd5d8261c2ca857c
- author
- bnema · · 2025-11-29 18:41 UTC
- parent
- fdb145c
- signature
- unsigned
2 files · +132 -0
A .github/workflows/ci.yml +43 -0
| @@ -0,0 +1,43 @@ | |||
| 1 | + | name: CI | |
| 2 | + | ||
| 3 | + | on: | |
| 4 | + | push: | |
| 5 | + | branches: [dev, main] | |
| 6 | + | paths-ignore: | |
| 7 | + | - '**.md' | |
| 8 | + | - 'docs/**' | |
| 9 | + | - '.github/workflows/**' | |
| 10 | + | - 'LICENSE' | |
| 11 | + | pull_request: | |
| 12 | + | branches: [dev, main] | |
| 13 | + | paths-ignore: | |
| 14 | + | - '**.md' | |
| 15 | + | - 'docs/**' | |
| 16 | + | - '.github/workflows/**' | |
| 17 | + | - 'LICENSE' | |
| 18 | + | ||
| 19 | + | jobs: | |
| 20 | + | lint: | |
| 21 | + | runs-on: ubuntu-latest | |
| 22 | + | steps: | |
| 23 | + | - uses: actions/checkout@v4 | |
| 24 | + | - uses: actions/setup-go@v5 | |
| 25 | + | with: | |
| 26 | + | go-version: stable | |
| 27 | + | - uses: golangci/golangci-lint-action@v6 | |
| 28 | + | with: | |
| 29 | + | version: latest | |
| 30 | + | ||
| 31 | + | test: | |
| 32 | + | runs-on: ubuntu-latest | |
| 33 | + | steps: | |
| 34 | + | - uses: actions/checkout@v4 | |
| 35 | + | - uses: actions/setup-go@v5 | |
| 36 | + | with: | |
| 37 | + | go-version: stable | |
| 38 | + | - name: Install WebKitGTK 6.0 dependencies | |
| 39 | + | run: | | |
| 40 | + | sudo apt-get update | |
| 41 | + | sudo apt-get install -y libwebkitgtk-6.0-dev libgtk-4-dev | |
| 42 | + | - name: Run tests | |
| 43 | + | run: make test | |
| @@ -0,0 +1,43 @@ | |||||
| 1 | + | name: CI | |||
| 2 | + | ||||
| 3 | + | on: | |||
| 4 | + | push: | |||
| 5 | + | branches: [dev, main] | |||
| 6 | + | paths-ignore: | |||
| 7 | + | - '**.md' | |||
| 8 | + | - 'docs/**' | |||
| 9 | + | - '.github/workflows/**' | |||
| 10 | + | - 'LICENSE' | |||
| 11 | + | pull_request: | |||
| 12 | + | branches: [dev, main] | |||
| 13 | + | paths-ignore: | |||
| 14 | + | - '**.md' | |||
| 15 | + | - 'docs/**' | |||
| 16 | + | - '.github/workflows/**' | |||
| 17 | + | - 'LICENSE' | |||
| 18 | + | ||||
| 19 | + | jobs: | |||
| 20 | + | lint: | |||
| 21 | + | runs-on: ubuntu-latest | |||
| 22 | + | steps: | |||
| 23 | + | - uses: actions/checkout@v4 | |||
| 24 | + | - uses: actions/setup-go@v5 | |||
| 25 | + | with: | |||
| 26 | + | go-version: stable | |||
| 27 | + | - uses: golangci/golangci-lint-action@v6 | |||
| 28 | + | with: | |||
| 29 | + | version: latest | |||
| 30 | + | ||||
| 31 | + | test: | |||
| 32 | + | runs-on: ubuntu-latest | |||
| 33 | + | steps: | |||
| 34 | + | - uses: actions/checkout@v4 | |||
| 35 | + | - uses: actions/setup-go@v5 | |||
| 36 | + | with: | |||
| 37 | + | go-version: stable | |||
| 38 | + | - name: Install WebKitGTK 6.0 dependencies | |||
| 39 | + | run: | | |||
| 40 | + | sudo apt-get update | |||
| 41 | + | sudo apt-get install -y libwebkitgtk-6.0-dev libgtk-4-dev | |||
| 42 | + | - name: Run tests | |||
| 43 | + | run: make test | |||
A .github/workflows/release.yml +89 -0
| @@ -0,0 +1,89 @@ | |||
| 1 | + | name: Release | |
| 2 | + | ||
| 3 | + | on: | |
| 4 | + | push: | |
| 5 | + | tags: | |
| 6 | + | - 'v*' | |
| 7 | + | ||
| 8 | + | permissions: | |
| 9 | + | contents: write | |
| 10 | + | ||
| 11 | + | jobs: | |
| 12 | + | check-changes: | |
| 13 | + | runs-on: ubuntu-latest | |
| 14 | + | outputs: | |
| 15 | + | should_release: ${{ steps.check.outputs.should_release }} | |
| 16 | + | steps: | |
| 17 | + | - uses: actions/checkout@v4 | |
| 18 | + | with: | |
| 19 | + | fetch-depth: 0 | |
| 20 | + | - name: Check for release-worthy changes | |
| 21 | + | id: check | |
| 22 | + | run: | | |
| 23 | + | # Get previous tag | |
| 24 | + | PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") | |
| 25 | + | if [ -z "$PREV_TAG" ]; then | |
| 26 | + | echo "should_release=true" >> $GITHUB_OUTPUT | |
| 27 | + | exit 0 | |
| 28 | + | fi | |
| 29 | + | # Check if any non-doc files changed | |
| 30 | + | CHANGES=$(git diff --name-only $PREV_TAG HEAD | grep -v -E '(\.md$|^docs/|^\.github/workflows/|^LICENSE$)' || true) | |
| 31 | + | if [ -n "$CHANGES" ]; then | |
| 32 | + | echo "should_release=true" >> $GITHUB_OUTPUT | |
| 33 | + | else | |
| 34 | + | echo "should_release=false" >> $GITHUB_OUTPUT | |
| 35 | + | echo "Only docs/CI changes detected, skipping release" | |
| 36 | + | fi | |
| 37 | + | ||
| 38 | + | lint: | |
| 39 | + | needs: check-changes | |
| 40 | + | if: needs.check-changes.outputs.should_release == 'true' | |
| 41 | + | runs-on: ubuntu-latest | |
| 42 | + | steps: | |
| 43 | + | - uses: actions/checkout@v4 | |
| 44 | + | - uses: actions/setup-go@v5 | |
| 45 | + | with: | |
| 46 | + | go-version: stable | |
| 47 | + | - uses: golangci/golangci-lint-action@v6 | |
| 48 | + | with: | |
| 49 | + | version: latest | |
| 50 | + | ||
| 51 | + | test: | |
| 52 | + | needs: check-changes | |
| 53 | + | if: needs.check-changes.outputs.should_release == 'true' | |
| 54 | + | runs-on: ubuntu-latest | |
| 55 | + | steps: | |
| 56 | + | - uses: actions/checkout@v4 | |
| 57 | + | - uses: actions/setup-go@v5 | |
| 58 | + | with: | |
| 59 | + | go-version: stable | |
| 60 | + | - name: Install WebKitGTK 6.0 dependencies | |
| 61 | + | run: | | |
| 62 | + | sudo apt-get update | |
| 63 | + | sudo apt-get install -y libwebkitgtk-6.0-dev libgtk-4-dev | |
| 64 | + | - name: Run tests | |
| 65 | + | run: make test | |
| 66 | + | ||
| 67 | + | release: | |
| 68 | + | needs: [check-changes, lint, test] | |
| 69 | + | if: needs.check-changes.outputs.should_release == 'true' | |
| 70 | + | runs-on: ubuntu-latest | |
| 71 | + | steps: | |
| 72 | + | - uses: actions/checkout@v4 | |
| 73 | + | with: | |
| 74 | + | fetch-depth: 0 | |
| 75 | + | - uses: actions/setup-go@v5 | |
| 76 | + | with: | |
| 77 | + | go-version: stable | |
| 78 | + | - name: Install dependencies | |
| 79 | + | run: | | |
| 80 | + | sudo apt-get update | |
| 81 | + | sudo apt-get install -y libwebkitgtk-6.0-dev libgtk-4-dev nodejs npm | |
| 82 | + | - name: Run GoReleaser | |
| 83 | + | uses: goreleaser/goreleaser-action@v6 | |
| 84 | + | with: | |
| 85 | + | distribution: goreleaser | |
| 86 | + | version: "~> v2" | |
| 87 | + | args: release --clean | |
| 88 | + | env: | |
| 89 | + | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| @@ -0,0 +1,89 @@ | |||||
| 1 | + | name: Release | |||
| 2 | + | ||||
| 3 | + | on: | |||
| 4 | + | push: | |||
| 5 | + | tags: | |||
| 6 | + | - 'v*' | |||
| 7 | + | ||||
| 8 | + | permissions: | |||
| 9 | + | contents: write | |||
| 10 | + | ||||
| 11 | + | jobs: | |||
| 12 | + | check-changes: | |||
| 13 | + | runs-on: ubuntu-latest | |||
| 14 | + | outputs: | |||
| 15 | + | should_release: ${{ steps.check.outputs.should_release }} | |||
| 16 | + | steps: | |||
| 17 | + | - uses: actions/checkout@v4 | |||
| 18 | + | with: | |||
| 19 | + | fetch-depth: 0 | |||
| 20 | + | - name: Check for release-worthy changes | |||
| 21 | + | id: check | |||
| 22 | + | run: | | |||
| 23 | + | # Get previous tag | |||
| 24 | + | PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") | |||
| 25 | + | if [ -z "$PREV_TAG" ]; then | |||
| 26 | + | echo "should_release=true" >> $GITHUB_OUTPUT | |||
| 27 | + | exit 0 | |||
| 28 | + | fi | |||
| 29 | + | # Check if any non-doc files changed | |||
| 30 | + | CHANGES=$(git diff --name-only $PREV_TAG HEAD | grep -v -E '(\.md$|^docs/|^\.github/workflows/|^LICENSE$)' || true) | |||
| 31 | + | if [ -n "$CHANGES" ]; then | |||
| 32 | + | echo "should_release=true" >> $GITHUB_OUTPUT | |||
| 33 | + | else | |||
| 34 | + | echo "should_release=false" >> $GITHUB_OUTPUT | |||
| 35 | + | echo "Only docs/CI changes detected, skipping release" | |||
| 36 | + | fi | |||
| 37 | + | ||||
| 38 | + | lint: | |||
| 39 | + | needs: check-changes | |||
| 40 | + | if: needs.check-changes.outputs.should_release == 'true' | |||
| 41 | + | runs-on: ubuntu-latest | |||
| 42 | + | steps: | |||
| 43 | + | - uses: actions/checkout@v4 | |||
| 44 | + | - uses: actions/setup-go@v5 | |||
| 45 | + | with: | |||
| 46 | + | go-version: stable | |||
| 47 | + | - uses: golangci/golangci-lint-action@v6 | |||
| 48 | + | with: | |||
| 49 | + | version: latest | |||
| 50 | + | ||||
| 51 | + | test: | |||
| 52 | + | needs: check-changes | |||
| 53 | + | if: needs.check-changes.outputs.should_release == 'true' | |||
| 54 | + | runs-on: ubuntu-latest | |||
| 55 | + | steps: | |||
| 56 | + | - uses: actions/checkout@v4 | |||
| 57 | + | - uses: actions/setup-go@v5 | |||
| 58 | + | with: | |||
| 59 | + | go-version: stable | |||
| 60 | + | - name: Install WebKitGTK 6.0 dependencies | |||
| 61 | + | run: | | |||
| 62 | + | sudo apt-get update | |||
| 63 | + | sudo apt-get install -y libwebkitgtk-6.0-dev libgtk-4-dev | |||
| 64 | + | - name: Run tests | |||
| 65 | + | run: make test | |||
| 66 | + | ||||
| 67 | + | release: | |||
| 68 | + | needs: [check-changes, lint, test] | |||
| 69 | + | if: needs.check-changes.outputs.should_release == 'true' | |||
| 70 | + | runs-on: ubuntu-latest | |||
| 71 | + | steps: | |||
| 72 | + | - uses: actions/checkout@v4 | |||
| 73 | + | with: | |||
| 74 | + | fetch-depth: 0 | |||
| 75 | + | - uses: actions/setup-go@v5 | |||
| 76 | + | with: | |||
| 77 | + | go-version: stable | |||
| 78 | + | - name: Install dependencies | |||
| 79 | + | run: | | |||
| 80 | + | sudo apt-get update | |||
| 81 | + | sudo apt-get install -y libwebkitgtk-6.0-dev libgtk-4-dev nodejs npm | |||
| 82 | + | - name: Run GoReleaser | |||
| 83 | + | uses: goreleaser/goreleaser-action@v6 | |||
| 84 | + | with: | |||
| 85 | + | distribution: goreleaser | |||
| 86 | + | version: "~> v2" | |||
| 87 | + | args: release --clean | |||
| 88 | + | env: | |||
| 89 | + | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |||