-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Omar Awile
committed
Oct 3, 2023
1 parent
6fdeebe
commit cbb8ba1
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Test CI | ||
|
||
concurrency: | ||
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" |