Skip to content

Commit

Permalink
Combine the shared logic using YAML anchors.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Feb 28, 2025
1 parent 75ce9ab commit a47197a
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,24 @@ env:
TOX_OVERRIDE: >-
testenv.pass_env+=GITHUB_*,FORCE_COLOR
shared_steps: &common_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: matrix.python == '3.14' && matrix.platform == 'ubuntu-latest'
run: |
sudo apt update
sudo apt install -y libxml2-dev libxslt-dev
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python || '3.x' }} # Default to 3.x if matrix.python is not defined
allow-prereleases: ${{ matrix.python != null && matrix.python != '3.x' }}
- name: Install tox
run: python -m pip install tox

jobs:
test:
Expand Down Expand Up @@ -55,21 +73,8 @@ jobs:
runs-on: ${{ matrix.platform }}
continue-on-error: ${{ matrix.python == '3.14' }}
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.14' && matrix.platform == 'ubuntu-latest'
run: |
sudo apt update
sudo apt install -y libxml2-dev libxslt-dev
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
allow-prereleases: true
- name: Install tox
run: python -m pip install tox
- name: Common Steps
steps: *common_steps
- name: Run
run: tox

Expand All @@ -82,15 +87,8 @@ jobs:
- docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install tox
run: python -m pip install tox
- name: Common Steps
steps: *common_steps
- name: Eval ${{ matrix.job }}
run: tox -e ${{ matrix.job }}

Expand Down

0 comments on commit a47197a

Please sign in to comment.