From 50d3155f7885b4574df6ed0c881ae76b37c8d35d Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Wed, 6 May 2026 12:42:10 +0200 Subject: [PATCH] Reuse github workflows from tmt --- .github/workflows/ci.yml | 46 ++++++++++++++++++++++++++++++++ .github/workflows/pre-commit.yml | 14 ---------- .github/workflows/release.yml | 35 +++++++++++++++++++----- 3 files changed, 75 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ee456a6 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,46 @@ +name: CI +run-name: > + CI (${{ github.event_name }}) + ${{ github.event_name == 'pull_request' && format('PR#{0}', github.event.number) || '' }} + ${{ github.event_name == 'workflow_dispatch' && inputs.ref || '' }} + +on: + pull_request: + push: + branches: [ main ] + workflow_dispatch: + inputs: + ref: + type: string + description: Committish to checkout and run CI against + +permissions: {} + +jobs: + pre-commit: + uses: teemtee/tmt/.github/workflows/step-pre-commit.yml@main + with: + ref: ${{ inputs.ref }} + + build-wheel: + uses: teemtee/tmt/.github/workflows/step-build-wheel.yml@main + with: + ref: ${{ inputs.ref }} + needs: [ pre-commit ] + + doc-tests: + name: 📘 docs + uses: teemtee/tmt/.github/workflows/step-doc-tests.yml@main + with: + ref: ${{ inputs.ref }} + needs: [ pre-commit ] + + overall-outcome: + name: GitHub Actions Overall Outcome + if: always() + needs: [ pre-commit, build-wheel, doc-tests ] + runs-on: ubuntu-slim + steps: + - uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml deleted file mode 100644 index a9c2e93..0000000 --- a/.github/workflows/pre-commit.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: pre-commit - -on: - pull_request: - push: - branches: [main] - -jobs: - pre-commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - uses: actions/setup-python@v6 - - uses: pre-commit/action@v3.0.1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1f7e4b4..0bb012f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,21 +1,44 @@ name: 🚀 Release +run-name: 🚀 Release ${{ inputs.ref || github.ref_name }} on: release: types: [published] + workflow_dispatch: + inputs: + ref: + type: string + description: 'Tag to release' + required: true + +permissions: {} jobs: - release: - name: 🚀 Release + build: + uses: teemtee/tmt/.github/workflows/step-build-wheel.yml@main + with: + ref: ${{ inputs.ref }} + + deploy: + needs: [build] runs-on: ubuntu-latest environment: name: pypi url: https://pypi.org/p/fmf permissions: - id-token: write # For pypi-publish + id-token: write + attestations: write + steps: - - uses: actions/checkout@v6 - - name: Build package - run: pipx run hatch build + - uses: actions/download-artifact@v8 + with: + name: Packages + path: dist + + - name: Generate artifact attestation for sdist and wheel + uses: actions/attest-build-provenance@v4 + with: + subject-path: "dist/*" + - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1