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:
Nicolò Ribaudo 2020-12-01 08:55:51 +00:00 committed by GitHub
parent 7018ed6e46
commit 4b79ab4a90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 92 additions and 88 deletions

View File

@ -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

View File

@ -1,64 +0,0 @@
git:
depth: 5
language: node_js
cache:
npm: false
directories:
- ~/.yarn/berry/cache
os: linux
env:
global:
- JOB=test
install: skip
before_script:
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then choco install make; fi
script:
- if [ "$JOB" = "test" ]; then make -j test-ci; fi
- if [ "$JOB" = "lint" ]; then make -j code-quality-ci; fi
- if [ "$JOB" = "babel-parser-flow-tests" ]; then make -j test-flow-ci; fi
- if [ "$JOB" = "babel-parser-typescript-tests" ]; then make -j test-typescript-ci; fi
- if [ "$JOB" = "babel-parser-test262-tests" ]; then make -j test-test262-ci; fi
matrix:
fast_finish: true
include:
- node_js: "node"
env: JOB=lint
# We test the latest version on circleci
# Move `windows` build to be the third since it is slow
- os: windows
node_js: "node"
env:
- JOB=test
# https://travis-ci.community/t/build-doesnt-finish-after-completing-tests/288/9
- YARN_GPG=no
cache:
npm: false
directories:
- $HOME/AppData/Local/Temp/chocolatey
- $HOME/AppData/Local/Yarn/Berry/cache
- node_js: "node"
env: JOB=babel-parser-flow-tests
- node_js: "node"
env: JOB=babel-parser-typescript-tests
- node_js: "node"
env: JOB=babel-parser-test262-tests
notifications:
slack:
on_success: change
on_failure: always
rooms:
# Generate with
# travis encrypt "babeljs:<token>#activity" --add notifications.slack.rooms
# where <token> is from the Slack integration settings.
secure: SrwPKRe2AiNAKRo/+2yW/x4zxbWf2FBXuBuuPkdTJVTpWe++Jin1lXYJWTKP1a1i/IbmhffBO9YZcUFbeuXJpRM083vO8VYpyuBMQRqWD+Z3o+ttPlHGOJgnj0nkIcGRk6k7PpyHNnIkixfEJDvbbg9lN1Jswb3xkL8iYIHpuFE=
branches:
except:
- /^v\d+\.\d+\.\d+$/

View File

@ -82,15 +82,9 @@ build-no-bundle: clean clean-lib
# Babel-transform-fixture-test-runner requires minified polyfill for performance
$(MAKE) generate-type-helpers build-typings build-polyfill-dist
build-no-bundle-ci: bootstrap-only
$(MAKE) build-no-bundle
watch: build-no-bundle
BABEL_ENV=development $(YARN) gulp watch
code-quality-ci: build-no-bundle-ci
$(MAKE) tscheck flowcheck-ci lint-ci
flowcheck-ci:
$(MAKE) flow
@ -161,9 +155,7 @@ test-only:
test: lint test-only
test-ci: jest-ci
jest-ci: build-standalone-ci
test-ci: build-standalone-ci
BABEL_ENV=test $(YARN) jest --maxWorkers=4 --ci
$(MAKE) test-clean
@ -182,9 +174,6 @@ bootstrap-flow:
test-flow:
$(NODE) scripts/parser-tests/flow
test-flow-ci: build-bundle-ci bootstrap-flow
$(MAKE) test-flow
test-flow-update-allowlist:
$(NODE) scripts/parser-tests/flow --update-allowlist
@ -197,9 +186,6 @@ bootstrap-typescript:
test-typescript:
$(NODE) scripts/parser-tests/typescript
test-typescript-ci: build-bundle-ci bootstrap-typescript
$(MAKE) test-typescript
test-typescript-update-allowlist:
$(NODE) scripts/parser-tests/typescript --update-allowlist
@ -212,9 +198,6 @@ bootstrap-test262:
test-test262:
$(NODE) scripts/parser-tests/test262
test-test262-ci: build-bundle-ci bootstrap-test262
$(MAKE) test-test262
test-test262-update-allowlist:
$(NODE) scripts/parser-tests/test262 --update-allowlist