From aa76d6dc65c3ed7f7f7870729568acf6efbc1378 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Thu, 22 Aug 2019 14:38:23 +0900 Subject: [PATCH 1/8] Chore: use GitHub Actions --- .azure-pipelines/job.yml | 37 ------------------------- .github/workflows/ci.yml | 59 ++++++++++++++++++++++++++++++++++++++++ Makefile.js | 28 ++++++++++++------- azure-pipelines.yml | 38 -------------------------- 4 files changed, 77 insertions(+), 85 deletions(-) delete mode 100644 .azure-pipelines/job.yml create mode 100644 .github/workflows/ci.yml delete mode 100644 azure-pipelines.yml diff --git a/.azure-pipelines/job.yml b/.azure-pipelines/job.yml deleted file mode 100644 index 2f8a5537387..00000000000 --- a/.azure-pipelines/job.yml +++ /dev/null @@ -1,37 +0,0 @@ -parameters: - name: "" - displayName: "" - vmImage: "" - nodeVersion: "" - -jobs: - - job: ${{parameters.name}} - displayName: ${{parameters.displayName}} - pool: - vmImage: ${{parameters.vmImage}} - steps: - - task: NodeTool@0 - displayName: Install Node.js - inputs: - versionSpec: ${{parameters.nodeVersion}} - - - script: npm install - displayName: Install Packages - - - script: npm test - displayName: Test - - - task: PublishTestResults@2 - displayName: Process Test Results - condition: succeededOrFailed() - inputs: - testRunner: JUnit - testResultsFiles: $(System.DefaultWorkingDirectory)/test-results.xml - - - task: PublishCodeCoverageResults@1 - displayName: Process Coverage Results - condition: succeededOrFailed() - inputs: - codeCoverageTool: Cobertura - summaryFileLocation: $(System.DefaultWorkingDirectory)/coverage/cobertura-coverage.xml - reportDirectory: $(System.DefaultWorkingDirectory)/coverage diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000000..f7b0f979812 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,59 @@ +name: CI +on: push + +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: + include: + - os: ubuntu-latest + node: 8.x + - os: ubuntu-latest + node: 10.x + - os: ubuntu-latest + node: 12.x + - os: windows-latest + node: 12.x + - os: macOS-latest + node: 12.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 diff --git a/Makefile.js b/Makefile.js index 02386d2f461..ddc4f130535 100644 --- a/Makefile.js +++ b/Makefile.js @@ -536,9 +536,7 @@ target.fuzz = function({ amount = process.env.CI ? 1000 : 300, fuzzBrokenAutofix } }; -target.test = function() { - target.lint(); - target.checkRuleFiles(); +target.mocha = () => { let errors = 0, lastReturn; @@ -557,6 +555,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 +575,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(); }; diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 13a2f38c494..00000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,38 +0,0 @@ -trigger: - - master - -jobs: - - template: .azure-pipelines/job.yml - parameters: - name: test_on_linux_node12 - displayName: Test on Node.js 12 (Linux) - vmImage: Ubuntu-16.04 - nodeVersion: 12.x - - - template: .azure-pipelines/job.yml - parameters: - name: test_on_linux_node10 - displayName: Test on Node.js 10 (Linux) - vmImage: Ubuntu-16.04 - nodeVersion: 10.x - - - template: .azure-pipelines/job.yml - parameters: - name: test_on_linux_node8 - displayName: Test on Node.js 8 (Linux) - vmImage: Ubuntu-16.04 - nodeVersion: 8.x - - - template: .azure-pipelines/job.yml - parameters: - name: test_on_windows_node12 - displayName: Test on Node.js 12 (Windows) - vmImage: Windows-2019 - nodeVersion: 12.x - - - template: .azure-pipelines/job.yml - parameters: - name: test_on_macos_node12 - displayName: Test on Node.js 12 (macOS) - vmImage: macOS-10.14 - nodeVersion: 12.x From de670186b34d9de0869596e1aa1732bed5d7e5cd Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Thu, 22 Aug 2019 14:48:17 +0900 Subject: [PATCH 2/8] fix syntax error --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f7b0f979812..0794510bbc1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,8 @@ jobs: name: Test strategy: matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + node: [8.x, 10.x, 12.x] include: - os: ubuntu-latest node: 8.x From 8beea4028268cad53e9225fdd2ceed62adb01f8e Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Thu, 22 Aug 2019 14:50:59 +0900 Subject: [PATCH 3/8] fix syntax error --- .github/workflows/ci.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0794510bbc1..8ad5c2af47f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,17 +23,15 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macOS-latest] node: [8.x, 10.x, 12.x] - include: - - os: ubuntu-latest + exclude: + - os: windows-latest node: 8.x - - os: ubuntu-latest - node: 10.x - - os: ubuntu-latest - node: 12.x - os: windows-latest - node: 12.x + node: 10.x - os: macOS-latest - node: 12.x + node: 8.x + - os: macOS-latest + node: 10.x runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v1 From 73750fa470acb655224df04f7b6466d5ff8007b9 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Thu, 22 Aug 2019 15:00:29 +0900 Subject: [PATCH 4/8] fix fuzz test --- Makefile.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Makefile.js b/Makefile.js index ddc4f130535..a01d13bde30 100644 --- a/Makefile.js +++ b/Makefile.js @@ -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 }); @@ -542,10 +542,7 @@ target.mocha = () => { 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++; } From 1694160e9ed0c620eda7ce8e5b58c1076ef0fcf8 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Thu, 22 Aug 2019 15:12:10 +0900 Subject: [PATCH 5/8] change triggers --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ad5c2af47f..0667729f801 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,9 @@ name: CI -on: push +on: + push: + branches: [master] + pull_request: + branches: [master] jobs: verify_files: From 330fb1557cfebc07c8ac49bebbbf4a68e6356447 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Thu, 22 Aug 2019 15:13:15 +0900 Subject: [PATCH 6/8] remove badge --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index e1fa00aa784..c1be084782f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ [![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) [![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) From cc5fdef923b121ccb0d53aeafa30890675449211 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Fri, 23 Aug 2019 14:01:32 +0900 Subject: [PATCH 7/8] add badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c1be084782f..3a4f0177e3a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ [![NPM version][npm-image]][npm-url] +[![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) From c00f56d51d4b7e3667e9ac0a469478cac5ca086d Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Fri, 30 Aug 2019 09:39:01 +0900 Subject: [PATCH 8/8] re-add Azure Pipelines files and badge --- .azure-pipelines/job.yml | 37 +++++++++++++++++++++++++++++++++++++ README.md | 1 + azure-pipelines.yml | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 .azure-pipelines/job.yml create mode 100644 azure-pipelines.yml diff --git a/.azure-pipelines/job.yml b/.azure-pipelines/job.yml new file mode 100644 index 00000000000..2f8a5537387 --- /dev/null +++ b/.azure-pipelines/job.yml @@ -0,0 +1,37 @@ +parameters: + name: "" + displayName: "" + vmImage: "" + nodeVersion: "" + +jobs: + - job: ${{parameters.name}} + displayName: ${{parameters.displayName}} + pool: + vmImage: ${{parameters.vmImage}} + steps: + - task: NodeTool@0 + displayName: Install Node.js + inputs: + versionSpec: ${{parameters.nodeVersion}} + + - script: npm install + displayName: Install Packages + + - script: npm test + displayName: Test + + - task: PublishTestResults@2 + displayName: Process Test Results + condition: succeededOrFailed() + inputs: + testRunner: JUnit + testResultsFiles: $(System.DefaultWorkingDirectory)/test-results.xml + + - task: PublishCodeCoverageResults@1 + displayName: Process Coverage Results + condition: succeededOrFailed() + inputs: + codeCoverageTool: Cobertura + summaryFileLocation: $(System.DefaultWorkingDirectory)/coverage/cobertura-coverage.xml + reportDirectory: $(System.DefaultWorkingDirectory)/coverage diff --git a/README.md b/README.md index 59459330cb8..134c991d81d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ [![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) diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000000..13a2f38c494 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,38 @@ +trigger: + - master + +jobs: + - template: .azure-pipelines/job.yml + parameters: + name: test_on_linux_node12 + displayName: Test on Node.js 12 (Linux) + vmImage: Ubuntu-16.04 + nodeVersion: 12.x + + - template: .azure-pipelines/job.yml + parameters: + name: test_on_linux_node10 + displayName: Test on Node.js 10 (Linux) + vmImage: Ubuntu-16.04 + nodeVersion: 10.x + + - template: .azure-pipelines/job.yml + parameters: + name: test_on_linux_node8 + displayName: Test on Node.js 8 (Linux) + vmImage: Ubuntu-16.04 + nodeVersion: 8.x + + - template: .azure-pipelines/job.yml + parameters: + name: test_on_windows_node12 + displayName: Test on Node.js 12 (Windows) + vmImage: Windows-2019 + nodeVersion: 12.x + + - template: .azure-pipelines/job.yml + parameters: + name: test_on_macos_node12 + displayName: Test on Node.js 12 (macOS) + vmImage: macOS-10.14 + nodeVersion: 12.x