From 70747484a5355491a44ada997fab505939d20db8 Mon Sep 17 00:00:00 2001 From: Eric Swanson <64809312+ericswanson-dfinity@users.noreply.github.com> Date: Mon, 29 Jan 2024 06:10:18 -0800 Subject: [PATCH 1/4] fix: use dorny/paths-filter to include/skip a job with a required status. (#651) --- .github/workflows/motoko-counter-example.yaml | 28 +++++++++++++++---- .github/workflows/motoko-counter-skip.yaml | 20 ------------- 2 files changed, 23 insertions(+), 25 deletions(-) delete mode 100644 .github/workflows/motoko-counter-skip.yaml diff --git a/.github/workflows/motoko-counter-example.yaml b/.github/workflows/motoko-counter-example.yaml index 676825f57..562d7e181 100644 --- a/.github/workflows/motoko-counter-example.yaml +++ b/.github/workflows/motoko-counter-example.yaml @@ -4,16 +4,32 @@ on: branches: - master pull_request: - paths: - - motoko/counter/** - - .github/workflows/provision-darwin.sh - - .github/workflows/provision-linux.sh - - .github/workflows/motoko-counter-example.yaml concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: + # JOB to run change detection + changes: + runs-on: ubuntu-latest + permissions: + pull-requests: read + # Set job outputs to values from filter step + outputs: + sources: ${{ steps.filter.outputs.sources }} + steps: + # For pull requests it's not necessary to checkout the code + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + sources: + - motoko/counter/** + - .github/workflows/provision-darwin.sh + - .github/workflows/provision-linux.sh + - .github/workflows/motoko-counter-example.yaml motoko-counter-example-darwin: + needs: changes + if: ${{ needs.changes.outputs.sources == 'true' }} runs-on: macos-12 steps: - uses: actions/checkout@v1 @@ -26,6 +42,8 @@ jobs: make test popd motoko-counter-example-linux: + needs: changes + if: ${{ needs.changes.outputs.sources == 'true' }} runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/motoko-counter-skip.yaml b/.github/workflows/motoko-counter-skip.yaml deleted file mode 100644 index 225e19575..000000000 --- a/.github/workflows/motoko-counter-skip.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: motoko-counter -on: - pull_request: - paths-ignore: - - motoko/counter/** - - .github/workflows/provision-darwin.sh - - .github/workflows/provision-linux.sh - - .github/workflows/motoko-counter-example.yaml -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true -jobs: - motoko-counter-example-darwin: - runs-on: ubuntu-latest - steps: - - run: echo 'Not needed - relevant folder not touched' - motoko-counter-example-linux: - runs-on: ubuntu-latest - steps: - - run: echo 'Not needed - relevant folder not touched' From fbaad1430f2dd4b854eff03fa3d63914d9352dad Mon Sep 17 00:00:00 2001 From: Eric Swanson <64809312+ericswanson-dfinity@users.noreply.github.com> Date: Mon, 29 Jan 2024 06:59:06 -0800 Subject: [PATCH 2/4] fix: dorny/path-filter requires checkout for pushes (#662) --- .github/workflows/motoko-counter-example.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/motoko-counter-example.yaml b/.github/workflows/motoko-counter-example.yaml index 562d7e181..4727a534c 100644 --- a/.github/workflows/motoko-counter-example.yaml +++ b/.github/workflows/motoko-counter-example.yaml @@ -17,7 +17,8 @@ jobs: outputs: sources: ${{ steps.filter.outputs.sources }} steps: - # For pull requests it's not necessary to checkout the code + - uses: actions/checkout@v4 + if: github.event_name == 'push' - uses: dorny/paths-filter@v3 id: filter with: @@ -29,7 +30,7 @@ jobs: - .github/workflows/motoko-counter-example.yaml motoko-counter-example-darwin: needs: changes - if: ${{ needs.changes.outputs.sources == 'true' }} + if: github.event_name == 'push' || needs.changes.outputs.sources == 'true' runs-on: macos-12 steps: - uses: actions/checkout@v1 @@ -43,7 +44,7 @@ jobs: popd motoko-counter-example-linux: needs: changes - if: ${{ needs.changes.outputs.sources == 'true' }} + if: github.event_name == 'push' || needs.changes.outputs.sources == 'true' runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v1 From 9b7f2518430715c79168cf8802d1ddbe215d9e1c Mon Sep 17 00:00:00 2001 From: Eric Swanson <64809312+ericswanson-dfinity@users.noreply.github.com> Date: Mon, 29 Jan 2024 07:21:31 -0800 Subject: [PATCH 3/4] chore: use dorny/path-filter for required status - motoko-calc (#650) --- .github/workflows/motoko-calc-example.yaml | 29 ++++++++++++++++++---- .github/workflows/motoko-calc-skip.yaml | 20 --------------- 2 files changed, 24 insertions(+), 25 deletions(-) delete mode 100644 .github/workflows/motoko-calc-skip.yaml diff --git a/.github/workflows/motoko-calc-example.yaml b/.github/workflows/motoko-calc-example.yaml index 57fd57697..fcbbf1f08 100644 --- a/.github/workflows/motoko-calc-example.yaml +++ b/.github/workflows/motoko-calc-example.yaml @@ -4,16 +4,33 @@ on: branches: - master pull_request: - paths: - - motoko/calc/** - - .github/workflows/provision-darwin.sh - - .github/workflows/provision-linux.sh - - .github/workflows/motoko-calc-example.yaml concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: + # JOB to run change detection + changes: + runs-on: ubuntu-latest + permissions: + pull-requests: read + # Set job outputs to values from filter step + outputs: + sources: ${{ steps.filter.outputs.sources }} + steps: + - uses: actions/checkout@v4 + if: github.event_name == 'push' + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + sources: + - motoko/calc/** + - .github/workflows/provision-darwin.sh + - .github/workflows/provision-linux.sh + - .github/workflows/motoko-calc-example.yaml motoko-calc-example-darwin: + needs: changes + if: github.event_name == 'push' || needs.changes.outputs.sources == 'true' runs-on: macos-12 steps: - uses: actions/checkout@v1 @@ -26,6 +43,8 @@ jobs: make test popd motoko-calc-example-linux: + needs: changes + if: github.event_name == 'push' || needs.changes.outputs.sources == 'true' runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/motoko-calc-skip.yaml b/.github/workflows/motoko-calc-skip.yaml deleted file mode 100644 index 43e4447f2..000000000 --- a/.github/workflows/motoko-calc-skip.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: motoko-calc -on: - pull_request: - paths-ignore: - - motoko/calc/** - - .github/workflows/provision-darwin.sh - - .github/workflows/provision-linux.sh - - .github/workflows/motoko-calc-example.yaml -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true -jobs: - motoko-calc-example-darwin: - runs-on: ubuntu-latest - steps: - - run: echo 'Not needed - relevant folder not touched' - motoko-calc-example-linux: - runs-on: ubuntu-latest - steps: - - run: echo 'Not needed - relevant folder not touched' \ No newline at end of file From e4a244d3333513843631a8bd6b2bbfa8bad72e23 Mon Sep 17 00:00:00 2001 From: Eric Swanson <64809312+ericswanson-dfinity@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:03:20 -0800 Subject: [PATCH 4/4] chore: required status workflows use dorny/paths-filter (#664) --- .github/workflows/motoko-echo-example.yaml | 29 +++++++++++++++---- .github/workflows/motoko-echo-skip.yaml | 20 ------------- .../workflows/motoko-factorial-example.yaml | 29 +++++++++++++++---- .github/workflows/motoko-factorial-skip.yaml | 20 ------------- .../workflows/motoko-hello-world-example.yaml | 29 +++++++++++++++---- .../workflows/motoko-hello-world-skip.yaml | 20 ------------- .../workflows/motoko-phone-book-example.yaml | 29 +++++++++++++++---- .github/workflows/motoko-phone-book-skip.yaml | 20 ------------- .github/workflows/motoko-pub-sub-example.yaml | 29 +++++++++++++++---- .github/workflows/motoko-pub-sub-skip.yaml | 20 ------------- .../workflows/motoko-quicksort-example.yaml | 29 +++++++++++++++---- .github/workflows/motoko-quicksort-skip.yaml | 20 ------------- .../motoko-simple-to-do-example.yaml | 29 +++++++++++++++---- .../workflows/motoko-simple-to-do-skip.yaml | 20 ------------- .../workflows/motoko-superheroes-example.yaml | 29 +++++++++++++++---- .../workflows/motoko-superheroes-skip.yaml | 20 ------------- 16 files changed, 192 insertions(+), 200 deletions(-) delete mode 100644 .github/workflows/motoko-echo-skip.yaml delete mode 100644 .github/workflows/motoko-factorial-skip.yaml delete mode 100644 .github/workflows/motoko-hello-world-skip.yaml delete mode 100644 .github/workflows/motoko-phone-book-skip.yaml delete mode 100644 .github/workflows/motoko-pub-sub-skip.yaml delete mode 100644 .github/workflows/motoko-quicksort-skip.yaml delete mode 100644 .github/workflows/motoko-simple-to-do-skip.yaml delete mode 100644 .github/workflows/motoko-superheroes-skip.yaml diff --git a/.github/workflows/motoko-echo-example.yaml b/.github/workflows/motoko-echo-example.yaml index edf9795b7..c0736fd02 100644 --- a/.github/workflows/motoko-echo-example.yaml +++ b/.github/workflows/motoko-echo-example.yaml @@ -4,16 +4,33 @@ on: branches: - master pull_request: - paths: - - motoko/echo/** - - .github/workflows/provision-darwin.sh - - .github/workflows/provision-linux.sh - - .github/workflows/motoko-echo-example.yaml concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: + # JOB to run change detection + changes: + runs-on: ubuntu-latest + permissions: + pull-requests: read + # Set job outputs to values from filter step + outputs: + sources: ${{ steps.filter.outputs.sources }} + steps: + - uses: actions/checkout@v4 + if: github.event_name == 'push' + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + sources: + - motoko/echo/** + - .github/workflows/provision-darwin.sh + - .github/workflows/provision-linux.sh + - .github/workflows/motoko-echo-example.yaml motoko-echo-example-darwin: + needs: changes + if: github.event_name == 'push' || needs.changes.outputs.sources == 'true' runs-on: macos-12 steps: - uses: actions/checkout@v1 @@ -26,6 +43,8 @@ jobs: make test popd motoko-echo-example-linux: + needs: changes + if: github.event_name == 'push' || needs.changes.outputs.sources == 'true' runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/motoko-echo-skip.yaml b/.github/workflows/motoko-echo-skip.yaml deleted file mode 100644 index 096ba8307..000000000 --- a/.github/workflows/motoko-echo-skip.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: motoko-echo -on: - pull_request: - paths-ignore: - - motoko/echo/** - - .github/workflows/provision-darwin.sh - - .github/workflows/provision-linux.sh - - .github/workflows/motoko-echo-example.yaml -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true -jobs: - motoko-echo-example-darwin: - runs-on: ubuntu-latest - steps: - - run: echo 'Not needed - relevant folder not touched' - motoko-echo-example-linux: - runs-on: ubuntu-latest - steps: - - run: echo 'Not needed - relevant folder not touched' diff --git a/.github/workflows/motoko-factorial-example.yaml b/.github/workflows/motoko-factorial-example.yaml index b99dfd015..b9ed41d91 100644 --- a/.github/workflows/motoko-factorial-example.yaml +++ b/.github/workflows/motoko-factorial-example.yaml @@ -4,16 +4,33 @@ on: branches: - master pull_request: - paths: - - motoko/factorial/** - - .github/workflows/provision-darwin.sh - - .github/workflows/provision-linux.sh - - .github/workflows/motoko-factorial-example.yaml concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: + # JOB to run change detection + changes: + runs-on: ubuntu-latest + permissions: + pull-requests: read + # Set job outputs to values from filter step + outputs: + sources: ${{ steps.filter.outputs.sources }} + steps: + - uses: actions/checkout@v4 + if: github.event_name == 'push' + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + sources: + - motoko/factorial/** + - .github/workflows/provision-darwin.sh + - .github/workflows/provision-linux.sh + - .github/workflows/motoko-factorial-example.yaml motoko-factorial-example-darwin: + needs: changes + if: github.event_name == 'push' || needs.changes.outputs.sources == 'true' runs-on: macos-12 steps: - uses: actions/checkout@v1 @@ -26,6 +43,8 @@ jobs: make test popd motoko-factorial-example-linux: + needs: changes + if: github.event_name == 'push' || needs.changes.outputs.sources == 'true' runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/motoko-factorial-skip.yaml b/.github/workflows/motoko-factorial-skip.yaml deleted file mode 100644 index f3fa6e4d0..000000000 --- a/.github/workflows/motoko-factorial-skip.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: motoko-factorial -on: - pull_request: - paths-ignore: - - motoko/factorial/** - - .github/workflows/provision-darwin.sh - - .github/workflows/provision-linux.sh - - .github/workflows/motoko-factorial-example.yaml -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true -jobs: - motoko-factorial-example-darwin: - runs-on: ubuntu-latest - steps: - - run: echo 'Not needed - relevant folder not touched' - motoko-factorial-example-linux: - runs-on: ubuntu-latest - steps: - - run: echo 'Not needed - relevant folder not touched' \ No newline at end of file diff --git a/.github/workflows/motoko-hello-world-example.yaml b/.github/workflows/motoko-hello-world-example.yaml index ebd1e4565..de6f809c6 100644 --- a/.github/workflows/motoko-hello-world-example.yaml +++ b/.github/workflows/motoko-hello-world-example.yaml @@ -4,16 +4,33 @@ on: branches: - master pull_request: - paths: - - motoko/hello-world/** - - .github/workflows/provision-darwin.sh - - .github/workflows/provision-linux.sh - - .github/workflows/motoko-hello-world-example.yaml concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: + # JOB to run change detection + changes: + runs-on: ubuntu-latest + permissions: + pull-requests: read + # Set job outputs to values from filter step + outputs: + sources: ${{ steps.filter.outputs.sources }} + steps: + - uses: actions/checkout@v4 + if: github.event_name == 'push' + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + sources: + - motoko/hello-world/** + - .github/workflows/provision-darwin.sh + - .github/workflows/provision-linux.sh + - .github/workflows/motoko-hello-world-example.yaml motoko-hello-world-example-darwin: + needs: changes + if: github.event_name == 'push' || needs.changes.outputs.sources == 'true' runs-on: macos-12 steps: - uses: actions/checkout@v1 @@ -26,6 +43,8 @@ jobs: make test popd motoko-hello-world-example-linux: + needs: changes + if: github.event_name == 'push' || needs.changes.outputs.sources == 'true' runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/motoko-hello-world-skip.yaml b/.github/workflows/motoko-hello-world-skip.yaml deleted file mode 100644 index 9f7f7121c..000000000 --- a/.github/workflows/motoko-hello-world-skip.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: motoko-hello-world -on: - pull_request: - paths-ignore: - - motoko/hello-world/** - - .github/workflows/provision-darwin.sh - - .github/workflows/provision-linux.sh - - .github/workflows/motoko-hello-world-example.yaml -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true -jobs: - motoko-hello-world-example-darwin: - runs-on: ubuntu-latest - steps: - - run: echo 'Not needed - relevant folder not touched' - motoko-hello-world-example-linux: - runs-on: ubuntu-latest - steps: - - run: echo 'Not needed - relevant folder not touched' diff --git a/.github/workflows/motoko-phone-book-example.yaml b/.github/workflows/motoko-phone-book-example.yaml index 39ed27fd9..8cb7fa5d5 100644 --- a/.github/workflows/motoko-phone-book-example.yaml +++ b/.github/workflows/motoko-phone-book-example.yaml @@ -4,16 +4,33 @@ on: branches: - master pull_request: - paths: - - motoko/phone-book/** - - .github/workflows/provision-darwin.sh - - .github/workflows/provision-linux.sh - - .github/workflows/motoko-phone-book-example.yaml concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: + # JOB to run change detection + changes: + runs-on: ubuntu-latest + permissions: + pull-requests: read + # Set job outputs to values from filter step + outputs: + sources: ${{ steps.filter.outputs.sources }} + steps: + - uses: actions/checkout@v4 + if: github.event_name == 'push' + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + sources: + - motoko/phone-book/** + - .github/workflows/provision-darwin.sh + - .github/workflows/provision-linux.sh + - .github/workflows/motoko-phone-book-example.yaml motoko-phone-book-example-darwin: + needs: changes + if: github.event_name == 'push' || needs.changes.outputs.sources == 'true' runs-on: macos-12 steps: - uses: actions/checkout@v1 @@ -26,6 +43,8 @@ jobs: make test popd motoko-phone-book-example-linux: + needs: changes + if: github.event_name == 'push' || needs.changes.outputs.sources == 'true' runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/motoko-phone-book-skip.yaml b/.github/workflows/motoko-phone-book-skip.yaml deleted file mode 100644 index 3862ffaa5..000000000 --- a/.github/workflows/motoko-phone-book-skip.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: motoko-phone-book -on: - pull_request: - paths-ignore: - - motoko/phone-book/** - - .github/workflows/provision-darwin.sh - - .github/workflows/provision-linux.sh - - .github/workflows/motoko-phone-book-example.yaml -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true -jobs: - motoko-phone-book-example-darwin: - runs-on: ubuntu-latest - steps: - - run: echo 'Not needed - relevant folder not touched' - motoko-phone-book-example-linux: - runs-on: ubuntu-latest - steps: - - run: echo 'Not needed - relevant folder not touched' diff --git a/.github/workflows/motoko-pub-sub-example.yaml b/.github/workflows/motoko-pub-sub-example.yaml index 66b2440b2..9eaef717c 100644 --- a/.github/workflows/motoko-pub-sub-example.yaml +++ b/.github/workflows/motoko-pub-sub-example.yaml @@ -4,16 +4,33 @@ on: branches: - master pull_request: - paths: - - motoko/pub-sub/** - - .github/workflows/provision-darwin.sh - - .github/workflows/provision-linux.sh - - .github/workflows/motoko-pub-sub-example.yaml concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: + # JOB to run change detection + changes: + runs-on: ubuntu-latest + permissions: + pull-requests: read + # Set job outputs to values from filter step + outputs: + sources: ${{ steps.filter.outputs.sources }} + steps: + - uses: actions/checkout@v4 + if: github.event_name == 'push' + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + sources: + - motoko/pub-sub/** + - .github/workflows/provision-darwin.sh + - .github/workflows/provision-linux.sh + - .github/workflows/motoko-pub-sub-example.yaml motoko-pub-sub-example-darwin: + needs: changes + if: github.event_name == 'push' || needs.changes.outputs.sources == 'true' runs-on: macos-12 steps: - uses: actions/checkout@v1 @@ -26,6 +43,8 @@ jobs: make test popd motoko-pub-sub-example-linux: + needs: changes + if: github.event_name == 'push' || needs.changes.outputs.sources == 'true' runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/motoko-pub-sub-skip.yaml b/.github/workflows/motoko-pub-sub-skip.yaml deleted file mode 100644 index 5061571d7..000000000 --- a/.github/workflows/motoko-pub-sub-skip.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: motoko-pub-sub -on: - pull_request: - paths-ignore: - - motoko/pub-sub/** - - .github/workflows/provision-darwin.sh - - .github/workflows/provision-linux.sh - - .github/workflows/motoko-pub-sub-example.yaml -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true -jobs: - motoko-pub-sub-example-darwin: - runs-on: ubuntu-latest - steps: - - run: echo 'Not needed - relevant folder not touched' - motoko-pub-sub-example-linux: - runs-on: ubuntu-latest - steps: - - run: echo 'Not needed - relevant folder not touched' diff --git a/.github/workflows/motoko-quicksort-example.yaml b/.github/workflows/motoko-quicksort-example.yaml index 7d1fba054..8a950af0f 100644 --- a/.github/workflows/motoko-quicksort-example.yaml +++ b/.github/workflows/motoko-quicksort-example.yaml @@ -4,16 +4,33 @@ on: branches: - master pull_request: - paths: - - motoko/quicksort/** - - .github/workflows/provision-darwin.sh - - .github/workflows/provision-linux.sh - - .github/workflows/motoko-quicksort-example.yaml concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: + # JOB to run change detection + changes: + runs-on: ubuntu-latest + permissions: + pull-requests: read + # Set job outputs to values from filter step + outputs: + sources: ${{ steps.filter.outputs.sources }} + steps: + - uses: actions/checkout@v4 + if: github.event_name == 'push' + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + sources: + - motoko/quicksort/** + - .github/workflows/provision-darwin.sh + - .github/workflows/provision-linux.sh + - .github/workflows/motoko-quicksort-example.yaml motoko-quicksort-example-darwin: + needs: changes + if: github.event_name == 'push' || needs.changes.outputs.sources == 'true' runs-on: macos-12 steps: - uses: actions/checkout@v1 @@ -26,6 +43,8 @@ jobs: make test popd motoko-quicksort-example-linux: + needs: changes + if: github.event_name == 'push' || needs.changes.outputs.sources == 'true' runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/motoko-quicksort-skip.yaml b/.github/workflows/motoko-quicksort-skip.yaml deleted file mode 100644 index 54352b6cd..000000000 --- a/.github/workflows/motoko-quicksort-skip.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: motoko-quicksort -on: - pull_request: - paths-ignore: - - motoko/quicksort/** - - .github/workflows/provision-darwin.sh - - .github/workflows/provision-linux.sh - - .github/workflows/motoko-quicksort-example.yaml -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true -jobs: - motoko-quicksort-example-darwin: - runs-on: ubuntu-latest - steps: - - run: echo 'Not needed - relevant folder not touched' - motoko-quicksort-example-linux: - runs-on: ubuntu-latest - steps: - - run: echo 'Not needed - relevant folder not touched' diff --git a/.github/workflows/motoko-simple-to-do-example.yaml b/.github/workflows/motoko-simple-to-do-example.yaml index 0c376c761..00a3d587b 100644 --- a/.github/workflows/motoko-simple-to-do-example.yaml +++ b/.github/workflows/motoko-simple-to-do-example.yaml @@ -4,16 +4,33 @@ on: branches: - master pull_request: - paths: - - motoko/simple-to-do/** - - .github/workflows/provision-darwin.sh - - .github/workflows/provision-linux.sh - - .github/workflows/motoko-simple-to-do-example.yaml concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: + # JOB to run change detection + changes: + runs-on: ubuntu-latest + permissions: + pull-requests: read + # Set job outputs to values from filter step + outputs: + sources: ${{ steps.filter.outputs.sources }} + steps: + - uses: actions/checkout@v4 + if: github.event_name == 'push' + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + sources: + - motoko/simple-to-do/** + - .github/workflows/provision-darwin.sh + - .github/workflows/provision-linux.sh + - .github/workflows/motoko-simple-to-do-example.yaml motoko-simple-to-do-example-darwin: + needs: changes + if: github.event_name == 'push' || needs.changes.outputs.sources == 'true' runs-on: macos-12 steps: - uses: actions/checkout@v1 @@ -26,6 +43,8 @@ jobs: make test popd motoko-simple-to-do-example-linux: + needs: changes + if: github.event_name == 'push' || needs.changes.outputs.sources == 'true' runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/motoko-simple-to-do-skip.yaml b/.github/workflows/motoko-simple-to-do-skip.yaml deleted file mode 100644 index 22be1a42b..000000000 --- a/.github/workflows/motoko-simple-to-do-skip.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: motoko-simple-to-do -on: - pull_request: - paths-ignore: - - motoko/simple-to-do/** - - .github/workflows/provision-darwin.sh - - .github/workflows/provision-linux.sh - - .github/workflows/motoko-simple-to-do-example.yaml -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true -jobs: - motoko-simple-to-do-example-darwin: - runs-on: ubuntu-latest - steps: - - run: echo 'Not needed - relevant folder not touched' - motoko-simple-to-do-example-linux: - runs-on: ubuntu-latest - steps: - - run: echo 'Not needed - relevant folder not touched' diff --git a/.github/workflows/motoko-superheroes-example.yaml b/.github/workflows/motoko-superheroes-example.yaml index 33d49b91c..88a732401 100644 --- a/.github/workflows/motoko-superheroes-example.yaml +++ b/.github/workflows/motoko-superheroes-example.yaml @@ -4,16 +4,33 @@ on: branches: - master pull_request: - paths: - - motoko/superheroes/** - - .github/workflows/provision-darwin.sh - - .github/workflows/provision-linux.sh - - .github/workflows/motoko-superheroes-example.yaml concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: + # JOB to run change detection + changes: + runs-on: ubuntu-latest + permissions: + pull-requests: read + # Set job outputs to values from filter step + outputs: + sources: ${{ steps.filter.outputs.sources }} + steps: + - uses: actions/checkout@v4 + if: github.event_name == 'push' + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + sources: + - motoko/superheroes/** + - .github/workflows/provision-darwin.sh + - .github/workflows/provision-linux.sh + - .github/workflows/motoko-superheroes-example.yaml motoko-superheroes-example-darwin: + needs: changes + if: github.event_name == 'push' || needs.changes.outputs.sources == 'true' runs-on: macos-12 steps: - uses: actions/checkout@v1 @@ -26,6 +43,8 @@ jobs: make test popd motoko-superheroes-example-linux: + needs: changes + if: github.event_name == 'push' || needs.changes.outputs.sources == 'true' runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/motoko-superheroes-skip.yaml b/.github/workflows/motoko-superheroes-skip.yaml deleted file mode 100644 index 75f75c24c..000000000 --- a/.github/workflows/motoko-superheroes-skip.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: motoko-superheroes -on: - pull_request: - paths-ignore: - - motoko/superheroes/** - - .github/workflows/provision-darwin.sh - - .github/workflows/provision-linux.sh - - .github/workflows/motoko-superheroes-example.yaml -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true -jobs: - motoko-superheroes-example-darwin: - runs-on: ubuntu-latest - steps: - - run: echo 'Not needed - relevant folder not touched' - motoko-superheroes-example-linux: - runs-on: ubuntu-latest - steps: - - run: echo 'Not needed - relevant folder not touched'