Skip to content

Commit

Permalink
Migrate from Travis to GH actions (#12412)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
3 people committed Dec 1, 2020
1 parent 7018ed6 commit 4b79ab4
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 88 deletions.
97 changes: 91 additions & 6 deletions .github/workflows/ci.yml
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
64 changes: 0 additions & 64 deletions .travis.yml

This file was deleted.

19 changes: 1 addition & 18 deletions Makefile
Expand Up @@ -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

Expand Down Expand Up @@ -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

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

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

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

Expand Down

0 comments on commit 4b79ab4

Please sign in to comment.