-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add optional run_pre and run_post commands to tox workflow
- Loading branch information
Showing
2 changed files
with
42 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,11 +24,30 @@ on: | |
description: Maximum python version for matrix generation | ||
required: false | ||
type: string | ||
other_names: | ||
default: | | ||
docs | ||
lint | ||
pkg | ||
py312-milestone | ||
description: Implicit names for the matrix | ||
required: false | ||
type: string | ||
other_names_also: | ||
default: "" | ||
description: Additional names for the matrix | ||
required: false | ||
type: string | ||
run_pre: | ||
default: "" | ||
description: Preparatory command to run before test commands. | ||
required: false | ||
type: string | ||
run_post: | ||
default: "" | ||
description: Command to run after test commands. | ||
required: false | ||
type: string | ||
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # might be needed by tox commands | ||
|
@@ -50,10 +69,7 @@ jobs: | |
max_python: ${{ inputs.max_python }} | ||
default_python: ${{ inputs.default_python }} | ||
other_names: | | ||
docs | ||
lint | ||
pkg | ||
py312-milestone | ||
${{ inputs.other_names }} | ||
${{ inputs.other_names_also }} | ||
platforms: linux,macos | ||
|
||
|
@@ -86,12 +102,16 @@ jobs: | |
key: pre-commit-${{ matrix.name }}-${{ hashFiles('.pre-commit-config.yaml') }} | ||
|
||
- name: Set up Python ${{ matrix.python_version || '3.12' }} | ||
if: "!contains(matrix.shell, 'wsl')" | ||
if: ${{ !contains(matrix.shell, 'wsl') }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
cache: pip | ||
cache: ${{ hashFiles('requirements.txt', 'pyproject.toml') && 'pip' || '' }} | ||
python-version: ${{ matrix.python_version || '3.12' }} | ||
|
||
- name: Run pre | ||
if: ${{ inputs.run_pre }} | ||
run: ${{ inputs.run_pre }} | ||
|
||
- name: Install tox | ||
run: | | ||
python3 -m pip install --upgrade pip | ||
|
@@ -114,6 +134,10 @@ jobs: | |
- run: ${{ matrix.command5 }} | ||
if: ${{ matrix.command5 }} | ||
|
||
- name: Run post | ||
if: ${{ inputs.run_post }} | ||
run: ${{ inputs.run_post }} | ||
|
||
- name: Archive logs and coverage data | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
|
@@ -176,14 +200,15 @@ jobs: | |
fi | ||
- name: Upload coverage data | ||
if: ${{ inputs.jobs_producing_coverage }} | ||
uses: codecov/[email protected] | ||
with: | ||
name: ${{ matrix.name }} | ||
fail_ci_if_error: true | ||
use_oidc: true | ||
|
||
- name: Check codecov.io status | ||
if: github.event_name == 'pull_request' | ||
if: github.event_name == 'pull_request' && inputs.jobs_producing_coverage | ||
uses: coactions/codecov-status@main | ||
|
||
- name: Decide whether the needed jobs succeeded or failed | ||
|