diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..fcadb2c --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text eol=lf 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) {