Skip to content

Commit

Permalink
add a nightly node compatibility validation testing the app on a set …
Browse files Browse the repository at this point in the history
…of node versions
  • Loading branch information
vzaidman committed Aug 8, 2024
1 parent bccea34 commit aca8ed4
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/actions/yarn-install/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Install Dependencies
inputs:
node-version:
type: string
required: false
default: '20.x'

Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/build-test-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,14 @@ jobs:

test:
strategy:
fail-fast: false
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
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/nightly-node-compatibility-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# In order to be updated when nighlies fail, please subscribe for updates on PR:
# ---> https://github.com/facebook/metro/pull/1314 <---
# where comments will be published on fail.

# This is a bit of a workaround tackling the lack of an organic way
# to notify certain people when a Github 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 * * *'
push:

jobs:
test:
strategy:
max-parallel: 1 # reduces the flakiness of these tests
fail-fast: false
matrix:
runs-on: ['ubuntu-latest']
node-version: [ # https://github.com/nodejs/release#release-schedule
'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 }}` in [run ${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})!',
});
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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='./'

0 comments on commit aca8ed4

Please sign in to comment.