Skip to content
Draft
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
54 changes: 9 additions & 45 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,6 @@ on:
permissions:
contents: read

env:
# Environment variable to support color support (jaraco/skeleton#66)
FORCE_COLOR: 1

# Suppress noisy pip warnings
PIP_DISABLE_PIP_VERSION_CHECK: 'true'
PIP_NO_WARN_SCRIPT_LOCATION: 'true'

# Ensure tests can sense settings about the environment
TOX_OVERRIDE: >-
testenv.pass_env+=GITHUB_*,FORCE_COLOR


jobs:
test:
strategy:
Expand All @@ -51,26 +38,12 @@ jobs:
platform: ubuntu-latest
- python: pypy3.10
platform: ubuntu-latest
runs-on: ${{ matrix.platform }}
uses: ./.github/workflows/test-suite.yml
with:
python: ${{ matrix.python }}
platform: ${{ matrix.platform }}
# https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idcontinue-on-error
continue-on-error: ${{ matrix.python == '3.15' }}
steps:
- uses: actions/checkout@v4
- name: Install build dependencies
# Install dependencies for building packages on pre-release Pythons
# jaraco/skeleton#161
if: matrix.python == '3.15' && matrix.platform == 'ubuntu-latest'
run: |
sudo apt update
sudo apt install -y libxml2-dev libxslt-dev
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
allow-prereleases: true
- name: Install tox
run: python -m pip install tox
- name: Run
run: tox

collateral:
strategy:
Expand All @@ -79,19 +52,10 @@ jobs:
job:
- diffcov
- docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install tox
run: python -m pip install tox
- name: Eval ${{ matrix.job }}
run: tox -e ${{ matrix.job }}
uses: ./.github/workflows/test-suite.yml
with:
platform: ubuntu-latest
tox-env: ${{ matrix.job }}

check: # This job does nothing and is only used for the branch protection
if: always()
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Test Suite

on:
workflow_call:
inputs:
python:
description: Python version
type: string
default: "3.x"
platform:
description: Runner platform
type: string
default: ubuntu-latest
tox-env:
description: >-
Tox environment to run; if empty, runs default tox
type: string
default: ""

env:
# Environment variable to support color support (jaraco/skeleton#66)
FORCE_COLOR: 1

# Suppress noisy pip warnings
PIP_DISABLE_PIP_VERSION_CHECK: 'true'
PIP_NO_WARN_SCRIPT_LOCATION: 'true'

# Ensure tests can sense settings about the environment
TOX_OVERRIDE: >-
testenv.pass_env+=GITHUB_*,FORCE_COLOR
Comment on lines +20 to +30
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot This content is duplicated with main.yml. Is it possible for it to be shared or only defined in one place?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub Actions doesn't propagate a calling workflow's env into a reusable workflow — they're separate contexts, so the duplication was previously unavoidable.

Since test and collateral now fully delegate to test-suite.yml, the env block in main.yml was no longer serving any job there (the only remaining inline-step job is release, which doesn't need those vars). Removed it in 62e53f8 — the env is now defined in one place only (test-suite.yml).


jobs:
run:
runs-on: ${{ inputs.platform }}
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install build dependencies
# Install dependencies for building packages on pre-release Pythons
# jaraco/skeleton#161
if: inputs.python == '3.15' && inputs.platform == 'ubuntu-latest'
run: |
sudo apt update
sudo apt install -y libxml2-dev libxslt-dev
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python }}
allow-prereleases: true
- name: Install tox
run: python -m pip install tox
- name: Run
if: ${{ !inputs.tox-env }}
run: tox
- name: Run ${{ inputs.tox-env }}
if: ${{ inputs.tox-env }}
run: tox -e ${{ inputs.tox-env }}