Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Skipping tests for Windows] Migrating to building and testing the repo with Github Actions #1308

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/actions/yarn-install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Install Dependencies
inputs:
use-min-supported-version:
required: false
default: false

runs:
using: "composite"
steps:
- uses: actions/setup-node@v4
with:
# if both node-version-file and node-version are provided, node-version is used
node-version-file: 'package.json'
node-version: ${{ inputs.use-min-supported-version == 'false' && 'lts/*' || '' }}
cache: yarn
cache-dependency-path: yarn.lock
- name: Install Dependencies
run: yarn install --frozen-lockfile --non-interactive --ignore-scripts
shell: bash
16 changes: 16 additions & 0 deletions .github/scripts/install_codecov.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

# Install Codecov Uploader
# See https://docs.codecov.com/docs/codecov-uploader#using-the-uploader-with-codecovio-cloud

CODECOV_URL="https://uploader.codecov.io"

curl "${CODECOV_URL}/verification.gpg" | gpg --no-default-keyring --keyring trustedkeys.gpg --import
curl -Os "${CODECOV_URL}/latest/linux/codecov"
curl -Os "${CODECOV_URL}/latest/linux/codecov.SHA256SUM"
curl -Os "${CODECOV_URL}/latest/linux/codecov.SHA256SUM.sig"

gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
shasum -a 256 -c codecov.SHA256SUM

chmod +x codecov
51 changes: 51 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: facebook/metro/build-and-test
on:
workflow_call:
pull_request:
types: [opened, synchronize]

# head_ref is per PR, so this ensures that updaing the latest PR commit
# will cancel the previous run of the workflow and trigger a new one
concurrency:
group: "build-and-test-${{ github.head_ref }}"
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:
run-js-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/yarn-install
- run: yarn typecheck
- run: yarn typecheck-ts
- run: yarn lint
- run: yarn test-smoke

test-with-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/yarn-install
- run: yarn test-coverage
- name: Download Codecov Uploader
run: "./.github/scripts/install_codecov.sh"
- name: Upload coverage results
run: "./codecov -t ${{ secrets.CODECOV_TOKEN }} -f ./coverage/coverage-final.json"

test:
strategy:
matrix:
runs-on: ['ubuntu-latest'] # 'windows-latest'
use-min-supported-version: [true, false]
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/yarn-install
with:
use-min-supported-version: ${{ matrix.use-min-supported-version }}
- name: Run Jest tests
run: yarn jest --ci --maxWorkers 4 --reporters=default --reporters=jest-junit --rootdir='./'
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,8 @@
"dependencies": {},
"engines": {
"node": ">=18"
},
"volta": {
"node": "18.0.0"
}
}
Loading