Skip to content

chore: migrate CI to GH actions (core checks) #1280

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

Merged
merged 14 commits into from
Jan 18, 2023
Merged
4 changes: 4 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ coverage:
precision: 2
round: down
range: 70...100
comment:
behavior: new
require_changes: false
require_base: no
34 changes: 34 additions & 0 deletions .github/actions/setup-node-deps/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Setup
description: Setup Node.js and install dependencies

runs:
using: composite
steps:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Cache deps
id: yarn-cache
uses: actions/cache@v3
with:
path: ./node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}

- name: Install deps
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
shell: bash

- name: Cache website deps
id: yarn-cache-website
uses: actions/cache@v3
with:
path: ./website/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}-website

- name: Install website deps
if: steps.yarn-cache-website.outputs.cache-hit != 'true'
run: yarn --cwd website install --frozen-lockfile
shell: bash
104 changes: 104 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Main
on:
push:
branches: [main]
pull_request:
branches: ['**']

jobs:
install-cached-deps:
runs-on: ubuntu-latest
name: Install and Cache deps
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup-node-deps

lint:
needs: [install-cached-deps]
runs-on: ubuntu-latest
name: Lint
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node.js and deps
uses: ./.github/actions/setup-node-deps

- name: Lint
run: yarn lint

typecheck:
needs: [install-cached-deps]
runs-on: ubuntu-latest
name: Typecheck
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node.js and deps
uses: ./.github/actions/setup-node-deps

- name: Typecheck
run: yarn typecheck

flow:
needs: [install-cached-deps]
runs-on: ubuntu-latest
name: Flow
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node.js and deps
uses: ./.github/actions/setup-node-deps

- name: Flow
run: yarn flow

test:
needs: [install-cached-deps]
runs-on: ubuntu-latest
name: Test React 18
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node.js and deps
uses: ./.github/actions/setup-node-deps

- name: Test React 18
run: yarn test:ci

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2

test-react-17:
needs: [install-cached-deps]
runs-on: ubuntu-latest
name: Test React 17
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node.js and deps
uses: ./.github/actions/setup-node-deps

- name: Test React 17
run: yarn test:ci:react:17

test-website:
needs: [install-cached-deps]
runs-on: ubuntu-latest
name: Test Website
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node.js and deps
uses: ./.github/actions/setup-node-deps

- name: Build website
run: yarn --cwd website build
2 changes: 1 addition & 1 deletion scripts/test_react_17
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cp yarn.lock yarn.lock.backup
cp package.json package.json.backup

yarn add -D react@17.0.2 react-test-renderer@17.0.2 react-native@0.68.3 --ignore-scripts
yarn test:ci
yarn test:ci --collectCoverage=false

mv package.json.backup package.json
mv yarn.lock.backup yarn.lock
Expand Down