Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 31 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,36 @@
name: CI

# Runs on release-please PRs (pre-release gate) and release tags (final check).
# Regular PRs rely on local pre-commit hooks (go fmt, go vet, golangci-lint).
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
branches: [main]
workflow_dispatch:

jobs:
# Skip CI for non-release PRs (dependabot, feature branches, etc.)
# Release-please branches match: release-please--branches--main
should-run:
runs-on: ubuntu-latest
outputs:
run: ${{ steps.check.outputs.run }}
steps:
- name: Check if CI should run
id: check
run: |
if [ "${{ github.event_name }}" != "pull_request" ]; then
echo "run=true" >> "$GITHUB_OUTPUT"
elif [[ "${{ github.head_ref }}" == release-please--* ]]; then
echo "run=true" >> "$GITHUB_OUTPUT"
else
echo "run=false" >> "$GITHUB_OUTPUT"
fi

test-matrix:
needs: [should-run]
if: needs.should-run.outputs.run == 'true'
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
Expand All @@ -28,10 +50,9 @@ jobs:
shell: bash
run: go test -race -count=1 ./...

# Gate job — preserves the "test" check name for branch protection rules.
test:
needs: [test-matrix]
if: always()
needs: [should-run, test-matrix]
if: always() && needs.should-run.outputs.run == 'true'
runs-on: ubuntu-latest
steps:
- name: Check matrix results
Expand All @@ -42,6 +63,8 @@ jobs:
fi

lint:
needs: [should-run]
if: needs.should-run.outputs.run == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
Expand All @@ -56,6 +79,8 @@ jobs:
version: v2.11.3

build-matrix:
needs: [should-run]
if: needs.should-run.outputs.run == 'true'
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
Expand All @@ -71,10 +96,9 @@ jobs:
shell: bash
run: go build -ldflags "-s -w" -o bin/mnemonic ./cmd/mnemonic

# Gate job — preserves the "build" check name for branch protection rules.
build:
needs: [build-matrix]
if: always()
needs: [should-run, build-matrix]
if: always() && needs.should-run.outputs.run == 'true'
runs-on: ubuntu-latest
steps:
- name: Check matrix results
Expand Down