Skip to content

Merge pull request #263 from AppSprout-dev/release-please--branches--… #400

Merge pull request #263 from AppSprout-dev/release-please--branches--…

Merge pull request #263 from AppSprout-dev/release-please--branches--… #400

Workflow file for this run

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:
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]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Vet
shell: bash
run: go vet ./...
- name: Test
shell: bash
run: go test -race -count=1 ./...
test:
needs: [should-run, test-matrix]
if: always() && needs.should-run.outputs.run == 'true'
runs-on: ubuntu-latest
steps:
- name: Check matrix results
run: |
if [ "${{ needs.test-matrix.result }}" != "success" ]; then
echo "Test matrix failed: ${{ needs.test-matrix.result }}"
exit 1
fi
lint:
needs: [should-run]
if: needs.should-run.outputs.run == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.11.3
build-matrix:
needs: [should-run]
if: needs.should-run.outputs.run == 'true'
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Build
shell: bash
run: go build -ldflags "-s -w" -o bin/mnemonic ./cmd/mnemonic
build:
needs: [should-run, build-matrix]
if: always() && needs.should-run.outputs.run == 'true'
runs-on: ubuntu-latest
steps:
- name: Check matrix results
run: |
if [ "${{ needs.build-matrix.result }}" != "success" ]; then
echo "Build matrix failed: ${{ needs.build-matrix.result }}"
exit 1
fi