Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: use GitHub Actions #12144

Merged
merged 9 commits into from Aug 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/ci.yml
@@ -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
35 changes: 20 additions & 15 deletions Makefile.js
Expand Up @@ -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 });

Expand Down Expand Up @@ -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++;
}
Expand All @@ -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({
Expand All @@ -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();
};

Expand Down
1 change: 1 addition & 0 deletions README.md
@@ -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)
Expand Down