Move legacy node version tests to GitHub actions (#11952)
* chore: run node 6 and 8 test on GitHub actions * fix: apply dynamicImportUrlToPath polyfill on publish * Apply hacks unconditionally * try fix highlight issues * address review comments * chore: add test-legacy build env * Update .travis.yml [skip ci] Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com> Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
This commit is contained in:
parent
66c6b3b949
commit
028a051c2b
42
.github/workflows/ci.yml
vendored
Normal file
42
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
name: Node CI
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Use Node.js latest
|
||||||
|
uses: actions/setup-node@v2-beta
|
||||||
|
- name: Generate coverage report
|
||||||
|
run: |
|
||||||
|
make -j test-ci-coverage
|
||||||
|
- name: Upload coverage report
|
||||||
|
uses: codecov/codecov-action@v1
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|
||||||
|
legacy-node-version-test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [6.x, 8.x]
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Use Node.js latest
|
||||||
|
uses: actions/setup-node@v2-beta # Build Babel on latest node versions
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
BABEL_ENV=test-legacy make -j bootstrap
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
uses: actions/setup-node@v2-beta
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
- name: Test on node.js ${{ matrix.node-version }}
|
||||||
|
# Hack: --color has supports-color@5 returned true for GitHub CI
|
||||||
|
# Remove once `chalk` is bumped to 4.0.
|
||||||
|
run: |
|
||||||
|
BABEL_ENV=test node ./node_modules/.bin/jest --ci --color
|
||||||
21
.github/workflows/coverage.yml
vendored
21
.github/workflows/coverage.yml
vendored
@ -1,21 +0,0 @@
|
|||||||
name: Report Coverage
|
|
||||||
|
|
||||||
on: [push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Use Node.js latest
|
|
||||||
uses: actions/setup-node@v2-beta
|
|
||||||
with:
|
|
||||||
node-version: "*"
|
|
||||||
- name: Generate coverage report
|
|
||||||
run: |
|
|
||||||
make -j test-ci-coverage
|
|
||||||
- name: Upload coverage report
|
|
||||||
uses: codecov/codecov-action@v1
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
@ -41,10 +41,9 @@ matrix:
|
|||||||
directories:
|
directories:
|
||||||
- $HOME/AppData/Local/Temp/chocolatey
|
- $HOME/AppData/Local/Temp/chocolatey
|
||||||
# Continue node_js matrix
|
# Continue node_js matrix
|
||||||
- node_js: "6"
|
|
||||||
- node_js: "12"
|
- node_js: "12"
|
||||||
- node_js: "10"
|
- node_js: "10"
|
||||||
- node_js: "8"
|
# Node.js 6 and 8 are tested on GitHub actions
|
||||||
- node_js: "node"
|
- node_js: "node"
|
||||||
env: JOB=babel-parser-flow-tests
|
env: JOB=babel-parser-flow-tests
|
||||||
- node_js: "node"
|
- node_js: "node"
|
||||||
|
|||||||
@ -17,7 +17,8 @@ module.exports = function (api) {
|
|||||||
};
|
};
|
||||||
const envOpts = Object.assign({}, envOptsNoTargets);
|
const envOpts = Object.assign({}, envOptsNoTargets);
|
||||||
|
|
||||||
const compileDynamicImport = env === "test" || env === "development";
|
const compileDynamicImport =
|
||||||
|
env === "test" || env === "development" || env === "test-legacy";
|
||||||
|
|
||||||
let convertESM = true;
|
let convertESM = true;
|
||||||
let ignoreLib = true;
|
let ignoreLib = true;
|
||||||
@ -55,6 +56,7 @@ module.exports = function (api) {
|
|||||||
);
|
);
|
||||||
if (env === "rollup") envOpts.targets = { node: nodeVersion };
|
if (env === "rollup") envOpts.targets = { node: nodeVersion };
|
||||||
break;
|
break;
|
||||||
|
case "test-legacy": // In test-legacy environment, we build babel on latest node but test on minimum supported legacy versions
|
||||||
case "production":
|
case "production":
|
||||||
// Config during builds before publish.
|
// Config during builds before publish.
|
||||||
envOpts.targets = {
|
envOpts.targets = {
|
||||||
@ -169,9 +171,9 @@ module.exports = function (api) {
|
|||||||
// the original absolute path.
|
// the original absolute path.
|
||||||
// NOTE: This plugin must run before @babel/plugin-transform-modules-commonjs,
|
// NOTE: This plugin must run before @babel/plugin-transform-modules-commonjs,
|
||||||
// and assumes that the target is the current node version.
|
// and assumes that the target is the current node version.
|
||||||
function dynamicImportUrlToPath({ template }) {
|
function dynamicImportUrlToPath({ template, env }) {
|
||||||
const currentNodeSupportsURL = !!require("url").pathToFileURL;
|
const currentNodeSupportsURL =
|
||||||
|
!!require("url").pathToFileURL && env() !== "test-legacy"; // test-legacy is run on legacy node versions without pathToFileURL support
|
||||||
if (currentNodeSupportsURL) {
|
if (currentNodeSupportsURL) {
|
||||||
return {
|
return {
|
||||||
visitor: {
|
visitor: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user