Skip to content

Commit

Permalink
Switch to matrixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zauguin committed Feb 25, 2024
1 parent d47eec5 commit 49f564c
Showing 1 changed file with 13 additions and 58 deletions.
71 changes: 13 additions & 58 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
# The l3build job contains the actual work. We misuse the matrix mechanism to
# create three jobs which only differ in minimal elements.
l3build:
runs-on: ubuntu-20.04
runs-on: ${{(matrix.platform == 'Linux' && 'ubuntu-22.04') || (matrix.platform == 'Windows' && 'windows-2022') || (matrix.platform == 'macOS' && 'macos-13')}}
strategy:
matrix:
# include indicates that we want to set explicitly these combinations
Expand All @@ -27,20 +27,25 @@ jobs:
# IMPORTANT: artifact_name == "Documentation" is used as a trigger to
# generate the artifact from PDF files and not the build directory and
# to generate the artifact when the run is successful, not when it fails.
kind: [test]
platform: [Linux, Windows, macOS]
include:
- kind: doc
platform: Linux
- name: "Test suite"
l3build_cmd: l3build check -q -H --show-log-on-error
artifact_name: testfiles
- name: "Documentation"
l3build_cmd: l3build doc -q -H
artifact_name: Documentation
name: ${{matrix.name }}
name: "${{ format('{0} - {1}', matrix.kind == 'doc' && 'Documentation' || 'Test suite', matrix.platform) }}"
steps:
# Boilerplate
- name: Checkout repository
uses: actions/checkout@v4
# We need docutils for our documentation
- run: sudo apt-get install python3-docutils
- if: ${{ matrix.kind == 'doc' }}
run: sudo apt-get update && sudo apt-get install python3-docutils
- name: Install TeX Live
uses: zauguin/install-texlive@v3
with:
Expand All @@ -49,75 +54,25 @@ jobs:
package_file: .github/tl_packages
cache_version: 0
- name: Run l3build
run: ${{ matrix.l3build_cmd }}
run: ${{ format('l3build {0} -q -H', matrix.kind == 'doc' && 'doc' || 'check --show-log-on-error') }}
# Now we create the artifacts: There are two cases where this happens.
# 1. If we failed running tests
- name: Archive failed test output
if: ${{ always() }}
if: ${{ matrix.kind == 'test' && always() }}
uses: zauguin/l3build-failure-artifacts@v1
with:
name: ${{ matrix.artifact_name }}
name: testfiles-${{ matrix.platform }}
# Decide how long to keep the test output artifact:
retention-days: 3
# 2. If we succeed building documentation
- name: Archive documentation
if: ${{ matrix.artifact_name == 'Documentation' && success() }}
if: ${{ matrix.kind == 'doc' && success() }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
name: Documentation
path: "**/*.pdf"
# Decide how long to keep the test output artifact:
retention-days: 21
windows:
runs-on: windows-latest
name: Tests on Windows
steps:
# Boilerplate
- name: Checkout repository
uses: actions/checkout@v4
- name: Install TeX Live
uses: zauguin/install-texlive@v3
with:
# The list of packages to install is in a separate file under .github/tl_packages
# to allow reuse.
package_file: .github/tl_packages
cache_version: 0
- name: Run l3build
run: l3build check -q -H --show-log-on-error
# Now we create the artifacts: There are two cases where this happens.
# 1. If we failed running tests
- name: Archive failed test output
if: ${{ always() }}
uses: zauguin/l3build-failure-artifacts@v1
with:
name: testfiles-windows
# Decide how long to keep the test output artifact:
retention-days: 3
mac:
runs-on: macos-13
name: Tests on macOS
steps:
# Boilerplate
- name: Checkout repository
uses: actions/checkout@v4
- name: Install TeX Live
uses: zauguin/[email protected]
with:
# The list of packages to install is in a separate file under .github/tl_packages
# to allow reuse.
package_file: .github/tl_packages
cache_version: 0
- name: Run l3build
run: l3build check -q -H --show-log-on-error
# Now we create the artifacts: There are two cases where this happens.
# 1. If we failed running tests
- name: Archive failed test output
if: ${{ always() }}
uses: zauguin/l3build-failure-artifacts@v1
with:
name: testfiles-macos
# Decide how long to keep the test output artifact:
retention-days: 3
# GitHub automatically informs the initiator of any action about the result, but
# we additionally want to keep the latex-commits mailing list informed about
# test failures.
Expand Down

0 comments on commit 49f564c

Please sign in to comment.