Skip to content
Open
Show file tree
Hide file tree
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
94 changes: 34 additions & 60 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,68 +29,42 @@ permissions:
contents: read

jobs:
linting:
name: Reuse linting job
uses: ./.github/workflows/lint.yml
lint:
uses: reqstool/.github/.github/workflows/python-lint.yml@91cd368066d5458b5d46bdf34c4d8ca483f6633f # 1.2.2

build:
needs: linting
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
reqstool-source: [pypi, main]
steps:
# Full history and tags: hatch-vcs derives the version from git state, so a
# shallow clone would build the wrong number rather than fail.
- name: Check out source repository
uses: actions/checkout@v7.0.1
with:
persist-credentials: false
fetch-depth: 0
fetch-tags: true
ref: ${{ inputs.ref || github.ref }}
- name: Set up Python
uses: actions/setup-python@v7.1.0
with:
python-version: "3.15.2"
- name: Install dependencies
# renovate: datasource=pypi depName=hatch
run: pip install hatch==1.18.2
- name: Build wheel (used by e2e tests via PIP_FIND_LINKS)
run: hatch build --target wheel
- name: Run tests
run: hatch run dev:pytest --junitxml=build/junit.xml --cov=reqstool_python_hatch_plugin --cov-report=xml:build/coverage.xml
- name: Build project
run: hatch build
- name: Self-apply own decorators to own src/tests
run: hatch run dev:python scripts/generate_annotations.py
# NOTE: all reqstool/.github refs below are pinned to the same commit -- keep
# these 4 in sync when bumping (install-reqstool, validate-reqstool,
# reqstool-status, and the validate-openspec job's workflow ref further down).
- name: Install reqstool
uses: reqstool/.github/.github/actions/install-reqstool@6fc8d3e3d4c3fdf7a83cb7b7a274e4761486ca71 # 1.2.1
with:
reqstool-source: ${{ matrix.reqstool-source }}
- name: Validate reqstool spec completeness
# not yet available in the latest PyPI release; supplementary to (not a
# replacement for) the `reqstool status --fail-if-incomplete` gate below, which
# is the actual required check, run unconditionally on both matrix legs
if: matrix.reqstool-source == 'main'
uses: reqstool/.github/.github/actions/validate-reqstool@6fc8d3e3d4c3fdf7a83cb7b7a274e4761486ca71 # 1.2.1
- name: Run reqstool status
# Required gate on both matrix legs -- fails the build unless every
# requirement is implemented and verified.
uses: reqstool/.github/.github/actions/reqstool-status@6fc8d3e3d4c3fdf7a83cb7b7a274e4761486ca71 # 1.2.1
with:
fail-if-incomplete: "true"
# Upload artifacts for later use
- name: Upload Artifacts
if: matrix.reqstool-source == 'pypi'
uses: actions/upload-artifact@v7.0.2
with:
name: ${{ inputs.artifact-name || 'dist' }}
path: dist/
needs: lint
uses: reqstool/.github/.github/workflows/python-build-hatch.yml@91cd368066d5458b5d46bdf34c4d8ca483f6633f # 1.2.2
with:
coverage-source: reqstool_python_hatch_plugin
ref: ${{ inputs.ref }}
artifact-name: ${{ inputs.artifact-name || 'dist' }}
post-test-command: hatch run dev:python scripts/generate_annotations.py

reqstool:
needs: build
uses: reqstool/.github/.github/workflows/common-reqstool-verify.yml@91cd368066d5458b5d46bdf34c4d8ca483f6633f # 1.2.2
with:
build-artifact: ${{ inputs.artifact-name || 'dist' }}-build

smoke:
needs: build
uses: reqstool/.github/.github/workflows/python-smoke.yml@91cd368066d5458b5d46bdf34c4d8ca483f6633f # 1.2.2
with:
dist-artifact: ${{ inputs.artifact-name || 'dist' }}
requirements: pytest==8.4.1
command: pytest tests/unit

validate-openspec:
uses: reqstool/.github/.github/workflows/common-validate-openspec.yml@6fc8d3e3d4c3fdf7a83cb7b7a274e4761486ca71 # 1.2.1

ci:
if: ${{ always() }}
needs: [lint, build, reqstool, smoke, validate-openspec]
runs-on: ubuntu-latest
steps:
- name: Fail unless every needed job succeeded
env:
NEEDS: ${{ toJSON(needs) }}
run: |
echo "$NEEDS" | python3 -c 'import json,sys; r={k:v["result"] for k,v in json.load(sys.stdin).items()}; print(r); sys.exit(0 if all(v=="success" for v in r.values()) else 1)'
25 changes: 0 additions & 25 deletions .github/workflows/lint.yml

This file was deleted.

Loading