test #7
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
name: Test CI | |
concurrency: | |
group: ${{ github.workflow }}#${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
draft-pr-job-limiter: | |
runs-on: ubuntu-latest | |
outputs: | |
jobs: ${{ steps.draft-pr-job-limiter.outputs.jobs }} | |
steps: | |
- id: draft-pr-job-limiter | |
# 1. use any other condition(s) that fits your requirements | |
# 2. each item in the JSON array will be matched against your matrix later | |
# 3. here I exclude everything except ubuntu-latest + python3.7 (see matrix below) | |
# 4. make sure to output as single line | |
# 5. the default case is: exclude nothing | |
run: | | |
if ${{ github.event.pull_request.draft == true }}; then # 1 | |
# 2, 3 | |
# {"config.build_mode": "setuptools""}, | |
# {"matrix_eval" : "CC=gcc-9 CXX=g++-9"} | |
echo 'jobs=[ | |
{"os": "ubuntu-22.04"} | |
]' | tr -d '[:space:]' >> $GITHUB_OUTPUT # 4 | |
else | |
echo 'jobs=[]' >> $GITHUB_OUTPUT # 5 | |
fi | |
ci: | |
runs-on: ${{ matrix.os }} | |
name: ${{ matrix.os }} - ${{ matrix.config.foo }} | |
needs: draft-pr-job-limiter | |
strategy: | |
matrix: | |
os: [ macOS-11, ubuntu-20.04] | |
config: | |
- {"foo": "bar"} | |
- {"foo": "baz"} | |
include: | |
- os: ubuntu-22.04 | |
config: | |
foo: "fish" | |
exclude: ${{ fromJSON(needs.draft-pr-job-limiter.outputs.jobs) }} | |
steps: | |
- name: actual work | |
run: | | |
echo "doing real work here." | |
sleep 60 | |
echo "done" |