Migrate from Travis to GH actions (#12412)
* Migrate linting to GH actions * Migrate windows tests * Migrate parser tests * Update .github/workflows/ci.yml Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com> * Run parser tests in a single job * Use a single yarn cache * Remove unused commands from Makefile * Update .github/workflows/ci.yml Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com> Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com> Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>
This commit is contained in:
97
.github/workflows/ci.yml
vendored
97
.github/workflows/ci.yml
vendored
@@ -20,9 +20,9 @@ jobs:
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
|
||||
key: yarn-${{ hashFiles('yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
yarn-
|
||||
- name: Update Yarn cache
|
||||
if: steps.yarn-cache.outputs.cache-hit != 'true'
|
||||
env:
|
||||
@@ -49,7 +49,7 @@ jobs:
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
|
||||
key: yarn-${{ hashFiles('yarn.lock') }}
|
||||
- name: Generate coverage report
|
||||
run: |
|
||||
make -j test-ci-coverage
|
||||
@@ -76,9 +76,9 @@ jobs:
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
|
||||
key: yarn-${{ hashFiles('yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
yarn-
|
||||
- name: Build babel artifacts
|
||||
run: |
|
||||
BABEL_ENV=test-legacy make -j build-standalone-ci
|
||||
@@ -93,6 +93,30 @@ jobs:
|
||||
packages/babel-standalone/*.js
|
||||
!**/node_modules/**
|
||||
|
||||
lint:
|
||||
name: Lint
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Use Node.js latest
|
||||
uses: actions/setup-node@v2-beta
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: yarn-${{ hashFiles('yarn.lock') }}
|
||||
- name: Install
|
||||
run: yarn install
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: babel-artifact
|
||||
- name: Lint
|
||||
run: make -j tscheck flowcheck-ci lint-ci
|
||||
|
||||
test:
|
||||
name: Test on Node.js # GitHub will add ${{ matrix.node-version }} to this title
|
||||
needs: build
|
||||
@@ -113,7 +137,7 @@ jobs:
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
|
||||
key: yarn-${{ hashFiles('yarn.lock') }}
|
||||
- name: Install
|
||||
run: |
|
||||
BABEL_ENV=test-legacy make -j bootstrap-only
|
||||
@@ -139,3 +163,64 @@ jobs:
|
||||
# Remove once `chalk` is bumped to 4.0.
|
||||
run: |
|
||||
BABEL_ENV=test node ./node_modules/.bin/jest --ci --color
|
||||
|
||||
test-windows:
|
||||
name: Test on Windows
|
||||
needs: build
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Use Node.js latest
|
||||
uses: actions/setup-node@v2-beta
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: yarn-${{ hashFiles('yarn.lock') }}
|
||||
- name: Install
|
||||
run: yarn install
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: babel-artifact
|
||||
- name: Generate runtime helpers
|
||||
run: |
|
||||
make build-plugin-transform-runtime-dist
|
||||
- name: Test on Windows
|
||||
# Hack: --color has supports-color@5 returned true for GitHub CI
|
||||
# Remove once `chalk` is bumped to 4.0.
|
||||
run: yarn jest --ci --color
|
||||
env:
|
||||
BABEL_ENV: test
|
||||
|
||||
external-parser-tests:
|
||||
name: Third-party Parser Tests
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Use Node.js latest
|
||||
uses: actions/setup-node@v2-beta
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: yarn-${{ hashFiles('yarn.lock') }}
|
||||
- name: Install
|
||||
run: yarn install
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: babel-artifact
|
||||
- name: Download tests
|
||||
run: make -j bootstrap-flow bootstrap-typescript bootstrap-test262
|
||||
- name: Run Test262 Tests
|
||||
run: make test-test262
|
||||
- name: Run Flow Tests
|
||||
run: make test-flow
|
||||
- name: Run TypeScript Tests
|
||||
run: make test-typescript
|
||||
|
||||
Reference in New Issue
Block a user