fix: update dependency nx-cloud to v19 #4507
Workflow file for this run
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
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
merge_group: | |
types: [checks_requested] | |
# cancel previous runs on the same PR | |
concurrency: | |
group: ${{ github.ref }}/check-examples | |
cancel-in-progress: true | |
name: 🔍 PR Check examples | |
env: | |
CI: true | |
TARGET_SHA: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }} | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
# should check if the job should run, it should return true if one of the following conditions is met, false otherwise: | |
# - the triggering event is a merge_group | |
# - or if the following patterns are matched on changed files | |
# 'packages/create-swarmion-app/**' | |
# 'packages/nx-plugin/**' | |
# 'examples/**' | |
# 'scripts/check-example.sh' | |
check-if-job-should-run: | |
name: 🤔 Check if job should run | |
runs-on: ubuntu-latest | |
outputs: | |
should-run: ${{ steps.check-if-job-should-run.outputs.should-run }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.TARGET_SHA }} | |
fetch-depth: 0 | |
- id: check-if-job-should-run | |
run: | | |
if [[ "${{ github.event_name }}" == "merge_group" ]]; then | |
echo "should-run=true" >> $GITHUB_OUTPUT | |
else | |
echo "should-run=$(git diff --quiet --merge-base ${{ github.event.pull_request.base.sha }} ${{ env.TARGET_SHA }} -- packages/create-swarmion-app packages/nx-plugin examples scripts/check-example.sh && echo 'false' || echo 'true')" >> $GITHUB_OUTPUT | |
fi | |
list-examples: | |
name: 🪣 List examples | |
runs-on: ubuntu-latest | |
needs: check-if-job-should-run | |
if: needs.check-if-job-should-run.outputs.should-run == 'true' | |
outputs: | |
examples: ${{ steps.list-example-folders.outputs.examples }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.TARGET_SHA }} | |
fetch-depth: 0 | |
- id: list-example-folders | |
run: echo "examples=$(ls examples | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT | |
check-examples: | |
name: 🔍 Check examples | |
runs-on: ubuntu-latest | |
needs: list-examples | |
if: join(fromJson(needs.list-examples.outputs.examples)) != '' | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
example: ${{ fromJson(needs.list-examples.outputs.examples) }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.TARGET_SHA }} | |
# We need to fetch all branches and commits so that Nx affected has a base to compare against. | |
fetch-depth: 0 | |
- uses: nrwl/nx-set-shas@v4 | |
- name: Install & cache node dependencies | |
uses: ./.github/actions/install-node-deps | |
- name: '🔍 Check example' | |
run: REF=${{ env.TARGET_SHA }} EXAMPLE=${{ matrix.example }} sh ./scripts/check-example.sh | |
validate-examples: | |
name: 📝 Validate examples | |
runs-on: ubuntu-latest | |
if: ${{ always() && !cancelled() }} | |
needs: [check-if-job-should-run, check-examples] | |
steps: | |
- name: Validate check examples | |
if: needs.check-if-job-should-run.outputs.should-run == 'true' | |
run: | | |
if [[ ${{ needs.check-examples.result }} = "failure" ]]; then | |
echo "Check examples failed" | |
exit 1 | |
fi |