Skip to content
Permalink
Browse files

Chore: use GitHub Actions (#12144)

* Chore: use GitHub Actions

* fix syntax error

* fix syntax error

* fix fuzz test

* change triggers

* remove badge

* add badge

* re-add Azure Pipelines files and badge
  • Loading branch information
mysticatea authored and btmills committed Aug 30, 2019
1 parent e88f305 commit 94e39d9f782f45db86a079e07508d63040118ef1
Showing with 84 additions and 15 deletions.
  1. +63 −0 .github/workflows/ci.yml
  2. +20 −15 Makefile.js
  3. +1 −0 README.md
@@ -0,0 +1,63 @@
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
verify_files:
name: Verify Files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- name: Install Packages
run: npm install
- name: Lint Files
run: node Makefile lint
- name: Check Rule Files
run: node Makefile checkRuleFiles
- name: Check Licenses
run: node Makefile checkLicenses

test_on_node:
name: Test
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
node: [8.x, 10.x, 12.x]
exclude:
- os: windows-latest
node: 8.x
- os: windows-latest
node: 10.x
- os: macOS-latest
node: 8.x
- os: macOS-latest
node: 10.x
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
version: ${{ matrix.node }}
- name: Install Packages
run: npm install
- name: Test
run: node Makefile mocha
- name: Fuzz Test
run: node Makefile fuzz

test_on_browser:
name: Browser Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- name: Install Packages
run: npm install
- name: Test
run: node Makefile karma
- name: Fuzz Test
run: node Makefile fuzz
@@ -497,7 +497,7 @@ target.lint = function() {
}
};

target.fuzz = function({ amount = process.env.CI ? 1000 : 300, fuzzBrokenAutofixes = true } = {}) {
target.fuzz = function({ amount = 1000, fuzzBrokenAutofixes = false } = {}) {
const fuzzerRunner = require("./tools/fuzzer-runner");
const fuzzResults = fuzzerRunner.run({ amount, fuzzBrokenAutofixes });

@@ -536,18 +536,13 @@ target.fuzz = function({ amount = process.env.CI ? 1000 : 300, fuzzBrokenAutofix
}
};

target.test = function() {
target.lint();
target.checkRuleFiles();
target.mocha = () => {
let errors = 0,
lastReturn;

echo("Running unit tests");

// In CI (Azure Pipelines), use JUnit reporter.
const reporter = process.env.TF_BUILD ? "mocha-junit-reporter" : "progress";

lastReturn = exec(`${getBinFile("nyc")} -- ${MOCHA} -R ${reporter} -t ${MOCHA_TIMEOUT} -c ${TEST_FILES}`);
lastReturn = exec(`${getBinFile("nyc")} -- ${MOCHA} -R progress -t ${MOCHA_TIMEOUT} -c ${TEST_FILES}`);
if (lastReturn.code !== 0) {
errors++;
}
@@ -557,6 +552,14 @@ target.test = function() {
errors++;
}

if (errors) {
exit(1);
}
};

target.karma = () => {
echo("Running unit tests on browsers");

target.webpack();

const browserFileLintOutput = new CLIEngine({
@@ -569,20 +572,22 @@ target.test = function() {
if (browserFileLintOutput.errorCount > 0) {
echo(`error: Failed to lint ${BUILD_DIR}/eslint.js as ES5 code`);
echo(CLIEngine.getFormatter("stylish")(browserFileLintOutput.results));
errors++;
exit(1);
}

lastReturn = exec(`${getBinFile("karma")} start karma.conf.js`);
if (lastReturn.code !== 0) {
errors++;
}
const lastReturn = exec(`${getBinFile("karma")} start karma.conf.js`);

if (errors) {
if (lastReturn.code !== 0) {
exit(1);
}
};

target.test = function() {
target.lint();
target.checkRuleFiles();
target.mocha();
target.karma();
target.fuzz({ amount: 150, fuzzBrokenAutofixes: false });

target.checkLicenses();
};

@@ -1,5 +1,6 @@
[![NPM version][npm-image]][npm-url]
[![Build Status](https://dev.azure.com/eslint/eslint/_apis/build/status/eslint.eslint?branchName=master)](https://dev.azure.com/eslint/eslint/_build/latest?definitionId=1&branchName=master)
[![Build Status](https://github.com/eslint/eslint/workflows/CI/badge.svg)](https://github.com/eslint/eslint/actions)
[![Downloads][downloads-image]][downloads-url]
[![Bountysource](https://www.bountysource.com/badge/tracker?tracker_id=282608)](https://www.bountysource.com/trackers/282608-eslint?utm_source=282608&utm_medium=shield&utm_campaign=TRACKER_BADGE)
[![Join the chat at https://gitter.im/eslint/eslint](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/eslint/eslint?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

0 comments on commit 94e39d9

Please sign in to comment.
You can’t perform that action at this time.