diff --git a/.codecov.yml b/.codecov.yml index 7d122f275..bab24474a 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -2,3 +2,7 @@ coverage: precision: 2 round: down range: 70...100 +comment: + behavior: new + require_changes: false + require_base: no diff --git a/.github/actions/setup-node-deps/action.yml b/.github/actions/setup-node-deps/action.yml new file mode 100644 index 000000000..5b4ba66d4 --- /dev/null +++ b/.github/actions/setup-node-deps/action.yml @@ -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 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..f30783ab1 --- /dev/null +++ b/.github/workflows/main.yml @@ -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 diff --git a/scripts/test_react_17 b/scripts/test_react_17 index a767e86b8..cbef0e0ce 100755 --- a/scripts/test_react_17 +++ b/scripts/test_react_17 @@ -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