Skip to content

fix(identity-check): resolve goreleaser_config repo-root-relative for… #20

fix(identity-check): resolve goreleaser_config repo-root-relative for…

fix(identity-check): resolve goreleaser_config repo-root-relative for… #20

Workflow file for this run

name: Test actions
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
concurrency:
group: test-actions-${{ github.ref }}
cancel-in-progress: true
jobs:
# Prove `make build` works on every shipped OS — Windows is the load-bearing one.
go-build-cross:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: ./actions/go-build
with:
working-directory: tests/fixtures/minimal
test-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./actions/go-test
with:
working-directory: tests/fixtures/minimal
- uses: ./actions/go-test
with:
working-directory: tests/fixtures/minimal
target: test-cover
- uses: ./actions/go-lint
with:
working-directory: tests/fixtures/minimal
# Exercise the grammar via check.sh directly so expected-failure legs invert
# cleanly without continue-on-error gymnastics.
grammar:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: grammar matrix
shell: bash
run: |
set -euo pipefail
check() { bash actions/conventional-commit/check.sh "$1" "$2" >/dev/null 2>&1; }
pass() { if check "$1" "$2"; then echo "ok PASS [$1] $2"; else echo "::error::expected PASS [$1] $2"; exit 1; fi; }
fail() { if check "$1" "$2"; then echo "::error::expected FAIL [$1] $2"; exit 1; else echo "ok FAIL [$1] $2"; fi; }
# title mode — full type set
pass title "feat: x"
pass title "fix(scope): y"
pass title "feat(api)!: z"
pass title "fix!: w"
pass title "fix(db)!: q"
pass title "chore: c"
pass title "docs: d"
fail title "wip"
fail title "Feature: x"
fail title "feat x"
fail title ": nope"
# release-gate — feat|fix only
pass release-gate "feat: x"
pass release-gate "fix(scope): y"
pass release-gate "feat!: z"
pass release-gate "fix(db)!: q"
fail release-gate "chore: c"
fail release-gate "docs: d"
fail release-gate "refactor: r"
# End-to-end through the action.yml wrappers (proves the env-passing wires up).
integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: conventional-commit action (valid)
uses: ./actions/conventional-commit
with:
mode: title
message: "feat(api): wire up the thing"
- name: pr-title action (valid)
uses: ./actions/pr-title
with:
title: "fix: handle empty config"
# Negative case: proves the env→arg wiring actually rejects (a regression
# like an empty TITLE must not pass silently).
- name: pr-title action (invalid — must fail)
id: badtitle
continue-on-error: true
uses: ./actions/pr-title
with:
title: "not a conventional title"
- name: assert invalid title was rejected
shell: bash
run: |
if [ "${{ steps.badtitle.outcome }}" != "failure" ]; then
echo "::error::pr-title should have failed on an invalid title"; exit 1
fi
echo "ok: pr-title rejected the invalid title"
# auto-release gate logic (path matching, version validation, tag compute).
auto-release-gate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: bash actions/auto-release/test_gate.sh
shell: bash
# darwin-gate portable halves (artifact sanity + the functional probe) via a
# stub binary. check-macho needs the macOS toolchain → exercised in a real #8
# release, not here.
darwin-gate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: bash actions/darwin-gate/test_darwin_gate.sh
shell: bash
# homebrew alias-cask rendering (token rename, verbatim url/checksum copy).
homebrew-alias:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: bash actions/homebrew-alias/test_alias.sh
shell: bash
# goreleaser-config preflight (replace_existing_artifacts + cask skip_upload).
release-preflight:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install "PyYAML==6.0.2" "pytest>=8,<9"
shell: bash
- run: python -m pytest -q
shell: bash
working-directory: actions/release-preflight
# identity.py unit tests — PASS + every drift rule + missing-manifest, in tmp dirs.
identity-unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install "PyYAML==6.0.2" "pytest>=8,<9" "defusedxml==0.7.1"
shell: bash
- run: python -m pytest -q
shell: bash
working-directory: actions/identity-check
# identity-check ACTION against the golden fixtures (real grandfathered identities).
identity-fixtures:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
fixture: [slck, gro, nrq, jtk]
steps:
- uses: actions/checkout@v4
- uses: ./actions/identity-check
with:
working-directory: tests/fixtures/identity/${{ matrix.fixture }}
# self-contained fixtures: the goreleaser config is co-located with the
# manifest, so repo-root == working-directory (a flat-repo shape). The
# monorepo root-vs-tool asymmetry is covered by identity-unit.
repo-root: tests/fixtures/identity/${{ matrix.fixture }}
# Monorepo shape: tool-local identity/packaging under tools/<tool>, but the
# goreleaser config lives at the repo root and resolves via repo-root (≠
# working-directory). Proves the action's repo-root plumbing end-to-end.
identity-monorepo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./actions/identity-check
with:
working-directory: tests/fixtures/identity/monorepo/tools/cfl
repo-root: tests/fixtures/identity/monorepo
# Exercise the action's export-json output and the require-manifest=false skip.
identity-interface:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: export
uses: ./actions/identity-check
with:
working-directory: tests/fixtures/identity/jtk
mode: export-json
- name: assert export-json output
shell: bash
env:
IDJSON: ${{ steps.export.outputs.identity-json }}
run: |
echo "$IDJSON" | python3 -c "import sys,json; d=json.load(sys.stdin); assert d['binary']=='jtk'; assert d['tag']['prefix']=='jtk-v'; print('ok export-json')"
# validate-and-export: both halves in one call (the mode #8 release uses).
- id: both
uses: ./actions/identity-check
with:
working-directory: tests/fixtures/identity/slck
repo-root: tests/fixtures/identity/slck
mode: validate-and-export
- name: assert validate-and-export emitted json
shell: bash
env:
IDJSON: ${{ steps.both.outputs.identity-json }}
run: |
echo "$IDJSON" | python3 -c "import sys,json; d=json.load(sys.stdin); assert d['binary']=='slck'; print('ok validate-and-export')"
- name: require-manifest=false skips when absent
uses: ./actions/identity-check
with:
working-directory: tests/fixtures/identity/_no_manifest
require-manifest: "false"