From a47197a84844155c7c0223553dd7e6f1cfdc190b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 27 Feb 2025 20:31:05 -0500 Subject: [PATCH] Combine the shared logic using YAML anchors. --- .github/workflows/main.yml | 46 ++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5841cc37..48588b58 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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: @@ -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 @@ -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 }}