chore(main): release 0.3.1 #250
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] | |
| pull_request: | |
| branches: [main] | |
| # Minimum privilege for every job in this workflow. Jobs need repository | |
| # contents for checkout and pull-request metadata for path filtering. No job | |
| # calls APIs that need contents:write or issues scopes. | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| jobs: | |
| dco: | |
| name: DCO | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Verify Signed-off-by on PR commits | |
| env: | |
| BASE_REF: ${{ github.base_ref }} | |
| run: | | |
| set -euo pipefail | |
| git fetch --no-tags --prune origin "${BASE_REF}:${BASE_REF}" | |
| missing=0 | |
| while IFS= read -r commit; do | |
| [ -z "$commit" ] && continue | |
| if ! git log -1 --pretty=%B "$commit" | grep -qi '^Signed-off-by: '; then | |
| echo "Missing Signed-off-by trailer: $commit" | |
| missing=1 | |
| fi | |
| done < <(git rev-list --no-merges "origin/${BASE_REF}..HEAD") | |
| if [ "$missing" -ne 0 ]; then | |
| echo "DCO check failed. Rebase/amend with: git commit --signoff" | |
| exit 1 | |
| fi | |
| reuse: | |
| name: REUSE | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: Set up Python | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 | |
| with: | |
| # Pinned so CI doesn't pick up a new Python minor mid-stream; | |
| # ratchet manually when intentionally upgrading. | |
| python-version: '3.13' | |
| - name: Install REUSE tool | |
| # Pin to a known-good REUSE version so a new upstream release | |
| # cannot break CI behind our backs. Bump deliberately. | |
| run: python -m pip install --upgrade pip 'reuse==6.2.0' | |
| - name: Run REUSE lint | |
| run: reuse lint | |
| generated: | |
| name: Verify Generated | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | |
| with: | |
| go-version-file: go.mod | |
| - name: Re-run generators and check for drift | |
| run: go -C tools tool task verify-generated | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | |
| with: | |
| go-version-file: go.mod | |
| - name: Run lint task | |
| run: go -C tools tool task lint | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | |
| with: | |
| go-version-file: go.mod | |
| - name: Run test task | |
| run: go -C tools tool task test | |
| - name: Check coverage threshold | |
| run: ./scripts/check-coverage.sh coverage.out | |
| - name: Upload coverage artifact | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: coverage-${{ github.sha }} | |
| path: coverage.out | |
| if-no-files-found: error | |
| retention-days: 30 | |
| sql-integration: | |
| name: SQL Integration | |
| runs-on: ubuntu-latest | |
| env: | |
| BERTH_TEST_POSTGRES_DSN: ${{ secrets.BERTH_TEST_POSTGRES_DSN || vars.BERTH_TEST_POSTGRES_DSN }} | |
| BERTH_TEST_MYSQL_DSN: ${{ secrets.BERTH_TEST_MYSQL_DSN || vars.BERTH_TEST_MYSQL_DSN }} | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: Detect relevant changes | |
| id: changes | |
| uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4.0.2 | |
| with: | |
| filters: | | |
| sql: | |
| - 'cmd/apiserver/**' | |
| - 'internal/lease/**' | |
| - 'go.mod' | |
| - 'go.sum' | |
| - 'Taskfile.yml' | |
| - '.github/workflows/ci.yaml' | |
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | |
| if: >- | |
| ${{ | |
| (github.event_name == 'push' || steps.changes.outputs.sql == 'true') && | |
| (env.BERTH_TEST_POSTGRES_DSN != '' || env.BERTH_TEST_MYSQL_DSN != '') | |
| }} | |
| with: | |
| go-version-file: go.mod | |
| - name: Run SQL integration tests | |
| if: >- | |
| ${{ | |
| (github.event_name == 'push' || steps.changes.outputs.sql == 'true') && | |
| (env.BERTH_TEST_POSTGRES_DSN != '' || env.BERTH_TEST_MYSQL_DSN != '') | |
| }} | |
| run: go -C tools tool task test-integration | |
| - name: Skip SQL integration tests | |
| if: >- | |
| ${{ | |
| (github.event_name != 'push' && steps.changes.outputs.sql != 'true') || | |
| (env.BERTH_TEST_POSTGRES_DSN == '' && env.BERTH_TEST_MYSQL_DSN == '') | |
| }} | |
| run: echo "Skipping SQL integration tests because no BERTH_TEST_*_DSN value is configured." | |
| quality: | |
| name: Static Analysis | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | |
| with: | |
| go-version-file: go.mod | |
| - name: Run staticcheck task | |
| run: go -C tools tool task staticcheck | |
| - name: Run vulnerability task | |
| run: go -C tools tool task vuln | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| needs: [dco, reuse, generated, lint, test, sql-integration, quality] | |
| if: >- | |
| ${{ | |
| always() && | |
| needs.reuse.result == 'success' && | |
| needs.generated.result == 'success' && | |
| needs.lint.result == 'success' && | |
| needs.test.result == 'success' && | |
| needs.sql-integration.result == 'success' && | |
| needs.quality.result == 'success' && | |
| (needs.dco.result == 'success' || needs.dco.result == 'skipped') | |
| }} | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | |
| with: | |
| go-version-file: go.mod | |
| - name: Run build task | |
| run: go -C tools tool task build | |
| summary: | |
| name: CI Summary | |
| runs-on: ubuntu-latest | |
| needs: [dco, reuse, generated, lint, test, sql-integration, quality, build] | |
| if: always() && github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Publish workflow summary | |
| env: | |
| DCO_RESULT: ${{ needs.dco.result }} | |
| REUSE_RESULT: ${{ needs.reuse.result }} | |
| GENERATED_RESULT: ${{ needs.generated.result }} | |
| LINT_RESULT: ${{ needs.lint.result }} | |
| TEST_RESULT: ${{ needs.test.result }} | |
| SQL_INTEGRATION_RESULT: ${{ needs.sql-integration.result }} | |
| QUALITY_RESULT: ${{ needs.quality.result }} | |
| BUILD_RESULT: ${{ needs.build.result }} | |
| run: | | |
| total=8 | |
| success=0 | |
| failed=0 | |
| skipped=0 | |
| cancelled=0 | |
| for result in "$DCO_RESULT" "$REUSE_RESULT" "$GENERATED_RESULT" "$LINT_RESULT" "$TEST_RESULT" "$SQL_INTEGRATION_RESULT" "$QUALITY_RESULT" "$BUILD_RESULT"; do | |
| case "$result" in | |
| success) success=$((success + 1)) ;; | |
| failure) failed=$((failed + 1)) ;; | |
| skipped) skipped=$((skipped + 1)) ;; | |
| cancelled) cancelled=$((cancelled + 1)) ;; | |
| *) failed=$((failed + 1)) ;; | |
| esac | |
| done | |
| { | |
| echo "## CI Summary" | |
| echo | |
| echo "| Job | Result |" | |
| echo "| --- | --- |" | |
| echo "| dco | $DCO_RESULT |" | |
| echo "| reuse | $REUSE_RESULT |" | |
| echo "| generated | $GENERATED_RESULT |" | |
| echo "| lint | $LINT_RESULT |" | |
| echo "| test | $TEST_RESULT |" | |
| echo "| sql-integration | $SQL_INTEGRATION_RESULT |" | |
| echo "| quality | $QUALITY_RESULT |" | |
| echo "| build | $BUILD_RESULT |" | |
| echo | |
| echo "- Total jobs: $total" | |
| echo "- Success: $success" | |
| echo "- Failed: $failed" | |
| echo "- Skipped: $skipped" | |
| echo "- Cancelled: $cancelled" | |
| } >> "$GITHUB_STEP_SUMMARY" |