From 6c4f08fc641f8f839197334b152dbf2960b6ac47 Mon Sep 17 00:00:00 2001 From: Nate Fischer Date: Tue, 30 Nov 2021 22:24:51 -0800 Subject: [PATCH 1/3] chore: switch to GitHub Actions No change to logic. This switches to GitHub Actions based on shelljs/shelljs#1055. --- .github/workflows/main.yml | 34 ++++++++++++++++++++++++++++++++++ .travis.yml | 22 ---------------------- README.md | 3 +-- appveyor.yml | 31 ------------------------------- scripts/check-node-support.js | 28 +++++++++------------------- 5 files changed, 44 insertions(+), 74 deletions(-) create mode 100644 .github/workflows/main.yml delete mode 100644 .travis.yml delete mode 100644 appveyor.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..354cd5f --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,34 @@ +name: CI +on: + - push + - pull_request +jobs: + test: + name: Node.js ${{ matrix.node-version }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + node-version: + - 8 + - 9 + - 10 + - 11 + - 12 + - 13 + - 14 + os: + - ubuntu-latest + - macos-latest + - windows-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm run test + - run: npm run check-node-support + - uses: codecov/codecov-action@v2 + with: + fail_ci_if_error: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 380b3d9..0000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -language: node_js -sudo: false -node_js: - - 8 - - 9 - - 10 - - 11 - - 12 - - 13 - - 14 - -os: - - linux - - osx -script: - - npm test - - npm run check-node-support -after_success: - - npm run codecov -- -f coverage/lcov.info - -notifications: - email: false diff --git a/README.md b/README.md index 808e30f..eca335b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Shx -[![Travis](https://img.shields.io/travis/shelljs/shx/master.svg?style=flat-square&label=unix)](https://travis-ci.org/shelljs/shx) -[![AppVeyor](https://img.shields.io/appveyor/ci/shelljs/shx/master.svg?style=flat-square&label=windows)](https://ci.appveyor.com/project/shelljs/shx/branch/master) +[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fshelljs%2Fshx%2Fbadge%3Fref%3Dmaster&style=flat-square)](https://actions-badge.atrox.dev/shelljs/shx/goto?ref=master) [![Codecov](https://img.shields.io/codecov/c/github/shelljs/shx/master.svg?style=flat-square&label=coverage)](https://codecov.io/gh/shelljs/shx) [![npm version](https://img.shields.io/npm/v/shx.svg?style=flat-square)](https://www.npmjs.com/package/shx) [![npm downloads](https://img.shields.io/npm/dm/shx.svg?style=flat-square)](https://www.npmjs.com/package/shx) diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 742966e..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,31 +0,0 @@ -environment: - matrix: - - nodejs_version: '14' - - nodejs_version: '13' - - nodejs_version: '12' - - nodejs_version: '11' - - nodejs_version: '10' - - nodejs_version: '9' - - nodejs_version: '8' - -version: '{build}' - -# Install scripts. (runs after repo cloning) -install: - - ps: Install-Product node $env:nodejs_version - - set PATH=%APPDATA%\npm;%PATH% - - node --version - - npm --version - - npm install - -matrix: - fast_finish: true - -# No need for MSBuild on this project -build: off - -test_script: - - npm test - -on_success: - - npm run codecov -- -f coverage/lcov.info diff --git a/scripts/check-node-support.js b/scripts/check-node-support.js index 9209950..8f6e86d 100755 --- a/scripts/check-node-support.js +++ b/scripts/check-node-support.js @@ -50,19 +50,11 @@ function range(start, stop) { return ret; } -function checkTravis(minNodeVersion, maxNodeVersion, travisYaml) { - var expectedTravisVersions = range(minNodeVersion, maxNodeVersion); - var msg = 'Check Travis node_js versions'; - assertDeepEquals(travisYaml.node_js, expectedTravisVersions, msg); -} - -function checkAppveyor(minNodeVersion, maxNodeVersion, appveyorYaml) { - var expectedAppveyorVersions = range(minNodeVersion, maxNodeVersion) - .map(num => ({ nodejs_version: num.toString() })) - .reverse(); // Arbitrarily, we store appveyor in reverse order. - var msg = 'Check Appveyor environment.matrix versions'; - assertDeepEquals(appveyorYaml.environment.matrix, expectedAppveyorVersions, - msg); +function checkGithubActions(minNodeVersion, maxNodeVersion, githubActionsYaml) { + var expectedVersions = range(minNodeVersion, maxNodeVersion); + var msg = 'Check GitHub Actions node_js versions'; + assertDeepEquals(githubActionsYaml.jobs.test.strategy.matrix['node-version'], + expectedVersions, msg); } try { @@ -71,13 +63,11 @@ try { var pack = require('../package.json'); checkEngines(MIN_NODE_VERSION, pack); - var travisFileName = path.join(__dirname, '..', '.travis.yml'); - var travisYaml = yaml.safeLoad(shell.cat(travisFileName)); - checkTravis(MIN_NODE_VERSION, MAX_NODE_VERSION, travisYaml); + var githubActionsFileName = path.join(__dirname, '..', '.github', 'workflows', + 'main.yml'); + var githubActionsYaml = yaml.safeLoad(shell.cat(githubActionsFileName)); + checkGithubActions(MIN_NODE_VERSION, MAX_NODE_VERSION, githubActionsYaml); - var appveyorFileName = path.join(__dirname, '..', 'appveyor.yml'); - var appveyorYaml = yaml.safeLoad(shell.cat(appveyorFileName)); - checkAppveyor(MIN_NODE_VERSION, MAX_NODE_VERSION, appveyorYaml); console.log('All files look good (this project supports v' + MIN_NODE_VERSION + '-v' + MAX_NODE_VERSION + ')!'); } catch (e) { From 6941d7242025c02adf5f52994977fe6bdc2621d6 Mon Sep 17 00:00:00 2001 From: Nate Fischer Date: Tue, 30 Nov 2021 22:33:40 -0800 Subject: [PATCH 2/3] Add editorconfig to fix EOL on Windows CI --- .editorconfig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..a35cd0d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +# editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{md,markdown}] +trim_trailing_whitespace = false From 99c08eeaee7777a8c2bb57f62a77d1de2289c2e8 Mon Sep 17 00:00:00 2001 From: Nate Fischer Date: Tue, 30 Nov 2021 22:43:17 -0800 Subject: [PATCH 3/3] Use gitattributes to preserve line endings, revert editorconfig --- .editorconfig | 14 -------------- .gitattributes | 1 + 2 files changed, 1 insertion(+), 14 deletions(-) delete mode 100644 .editorconfig create mode 100644 .gitattributes diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index a35cd0d..0000000 --- a/.editorconfig +++ /dev/null @@ -1,14 +0,0 @@ -# editorconfig.org - -root = true - -[*] -charset = utf-8 -end_of_line = lf -indent_size = 2 -indent_style = space -insert_final_newline = true -trim_trailing_whitespace = true - -[*.{md,markdown}] -trim_trailing_whitespace = false diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..fcadb2c --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text eol=lf