diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0ccf404 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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"