diff --git a/.github/actions/yarn-install/action.yml b/.github/actions/yarn-install/action.yml index ee40ab4411..059f7650f2 100644 --- a/.github/actions/yarn-install/action.yml +++ b/.github/actions/yarn-install/action.yml @@ -1,6 +1,7 @@ name: Install Dependencies inputs: node-version: + type: string required: false default: '20.x' diff --git a/.github/workflows/build-test-and-deploy.yml b/.github/workflows/build-test-and-deploy.yml index 50f6555e4a..7840a1d9e3 100644 --- a/.github/workflows/build-test-and-deploy.yml +++ b/.github/workflows/build-test-and-deploy.yml @@ -47,15 +47,10 @@ jobs: matrix: runs-on: ['ubuntu-latest'] node-version: ['18.0', '18.x', '20.x'] - name: "Tests [Node.js ${{ matrix.node-version }}, ${{ matrix.runs-on }}]" - runs-on: ${{ matrix.runs-on }} - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/yarn-install - with: - node-version: ${{ matrix.node-version }} - - name: Run Jest Tests - run: yarn jest --ci --maxWorkers 4 --reporters=default --reporters=jest-junit --rootdir='./' + uses: ./.github/workflows/test.yml + with: + node-version: ${{ matrix.node-version }} + runs-on: ${{ matrix.runs-on }} deploy: # runs only on tag pushes diff --git a/.github/workflows/nightly-node-compatibility-validation.yml b/.github/workflows/nightly-node-compatibility-validation.yml new file mode 100644 index 0000000000..5b6a004a64 --- /dev/null +++ b/.github/workflows/nightly-node-compatibility-validation.yml @@ -0,0 +1,45 @@ +# in order to subscribe to nighlies fails subscribe for updates on PR: +# ---> https://github.com/facebook/metro/pull/1314 <--- +# +# this is a bit of a workaround tackling the lack of an organic way +# to notify certain people when this workflow fails: +# https://github.com/orgs/community/discussions/18039 + +name: facebook/metro/nightly-node-compatibility-validation +on: + schedule: + # Everyday at at 5:00 UTC (22:00 USA West Coast, 06:00 London) + - cron: '0 5 * * *' + +jobs: + test: + strategy: + matrix: + runs-on: ['ubuntu-latest'] + # https://github.com/nodejs/release#release-schedule + node-version: [ + '18.0', # minimum supported + 'lts/-1', # pre-latest lts + 'lts/*', # latest lts + 'current' # newest + ] + uses: ./.github/workflows/test.yml + with: + node-version: ${{ matrix.node-version }} + runs-on: ${{ matrix.runs-on }} + + comment-on-pr-for-failures: + runs-on: ubuntu-latest + needs: [test] + if: ${{ always() && needs.test.result == 'failure' }} + steps: + - uses: actions/github-script@v7 + with: + script: | + github.rest.issues.createComment({ + // see https://github.com/facebook/metro/pull/1314 + issue_number: 1314, + owner: context.repo.owner, + repo: context.repo.repo, + body: 'A nightly test failed in `${{ github.workflow }}`!\nPlease address it by adjusting the supported NodeJS versions.', + }); diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000000..12e6433495 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,24 @@ +name: test +on: + workflow_call: + inputs: + node-version: + type: string + required: false + default: 'ubuntu-latest' + runs-on: + type: string + required: false + default: '20.x' + +jobs: + test: + name: "Tests [Node.js ${{ inputs.node-version }}, ${{ inputs.runs-on }}]" + runs-on: ${{ inputs.runs-on }} + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/yarn-install + with: + node-version: ${{ inputs.node-version }} + - name: Run Jest Tests + run: yarn jest --ci --maxWorkers 4 --reporters=default --reporters=jest-junit --rootdir='./'