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
93 changes: 34 additions & 59 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,67 +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: Run tests
run: hatch run dev:pytest --junitxml=build/junit.xml --cov=reqstool_python_decorators --cov-report=xml:build/coverage.xml
- name: Build project
run: hatch build
- name: Self-apply own decorator processor to own src/tests
# Relies on `hatch build` (above) not cleaning build/ -- annotations.yml lands
# alongside the junit/coverage output from the "Run tests" step, and
# reqstool_config.yml expects to find both there. If hatch build ever starts
# cleaning build/, move the pytest output dir outside of it.
run: hatch run dev:python scripts/generate_annotations.py
- 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 on the pypi leg
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_decorators
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 tests/e2e

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