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

Convert the CircleCI workflow to a GitHub Actions workflow #1221

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
87 changes: 87 additions & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: facebook/metro/build-and-deploy
on:
push:
branches:
- main
jobs:
run-js-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/setup-node@v4
with:
node-version: 18.12
cache: yarn
- name: Install Dependencies
run: npm install --force flow-bin
- run: yarn typecheck
- run: yarn typecheck-ts
- run: yarn lint
- run: yarn test-smoke
test-with-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/setup-node@v4
with:
node-version: 18.12
cache: yarn
- name: Install Dependencies
run: npm install --force @babel/core
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to be using Yarn to install dependencies so that yarn.lock is respected - that's the reason for the test failure you're seeing.

I'm not sure what the significance of @babel/core is here (and similarly --save-dev jest in jobs below)? yarn --frozen-lockfile --non-interactive --ignore-scripts is the corresponding line in our CircleCI config.yml, and we use that for all jobs:

command: yarn --frozen-lockfile --non-interactive --ignore-scripts

- run: yarn test-coverage
- name: Download Codecov Uploader
run: "./.circleci/scripts/install_codecov.sh"
- name: Upload coverage results
run: "./codecov -t ${{ secrets.CODECOV_TOKEN }} -f ./coverage/coverage-final.json"
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 18.12, 20.2 ]
steps:
- uses: actions/[email protected]
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm install --force --save-dev jest
- name: Run Jest tests
run: yarn jest --ci --maxWorkers 4 --reporters=default --reporters=jest-junit
test-windows:
if: startsWith(github.ref, 'refs/heads/windows/')
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
path: reports/
- uses: actions/setup-node@v4
with:
node-version: 18.12
cache: yarn
- name: Install Dependencies
run: npm install --force --save-dev jest
- name: Run Jest tests
run: yarn jest --ci --maxWorkers 4 --reporters=default --reporters=jest-junit
publish-to-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/setup-node@v4
with:
node-version: 18.12
cache: yarn
- name: Check Tag Format
id: check_tag
run: |
if [[ $GITHUB_REF =~ ^refs/tags/v\d+(\.\d+){2}(-.*)?$ ]]; then
echo "valid=true" >> $GITHUB_OUTPUT
else
echo "valid=false" >> $GITHUB_OUTPUT
fi
shell: bash
- run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
- name: Infer dist-tag and run npm run publish
if: steps.check_tag.outputs.valid == 'true'
run: "./.circleci/scripts/publish.sh"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script relies on $CIRCLE_TAG, so I think it'll need porting unless GA populates that already.

# Reduce a semver tag name to a Metro's release branch naming convention, eg v0.1.2-alpha.3 -> 0.1.x
RELEASE_BRANCH=$(echo "$CIRCLE_TAG" | awk -F. '{print substr($1, 2) "." $2 ".x"}')

- run: rm ~/.npmrc