Skip to content

Commit

Permalink
chore: set up GitHub Actions CI (#1055)
Browse files Browse the repository at this point in the history
  • Loading branch information
nfischer committed Nov 30, 2021
1 parent 0ae1dd6 commit d0a4516
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 85 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/main.yml
@@ -0,0 +1,39 @@
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-with-coverage
- run: npm run lint
- run: npm run gendocs
- run: npm run check-node-support
- name: Check for modified files (skip on Windows)
run: npm run after-travis
if: matrix.os != 'windows-latest'
- uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Expand Up @@ -15,9 +15,8 @@ stable). If you've found a bug, please follow these steps:
PRs are welcome! However, we ask that you follow a few guidelines:

- Please add tests for all changes/new features.
- Make sure your code passes `npm test`. Please check the CI (both Appveyor and
Travis). If you can't figure out why something doesn't work, feel free to ask
for help.
- Make sure your code passes `npm test`. Please check the CI. If you can't
figure out why something doesn't work, feel free to ask for help.
- Make sure you conform to our style guidelines. You can run `npm run lint` to
check style, and `npm run lint -- --fix` to automatically fix some issues.
- Make documentation changes *within the source files*, not in the README.
Expand Down
5 changes: 2 additions & 3 deletions README.md
@@ -1,7 +1,6 @@
# ShellJS - Unix shell commands for Node.js

[![Travis](https://img.shields.io/travis/shelljs/shelljs/master.svg?style=flat-square&label=unix)](https://travis-ci.org/shelljs/shelljs)
[![AppVeyor](https://img.shields.io/appveyor/ci/shelljs/shelljs/master.svg?style=flat-square&label=windows)](https://ci.appveyor.com/project/shelljs/shelljs/branch/master)
[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fshelljs%2Fshelljs%2Fbadge%3Fref%3Dmaster&style=flat-square)](https://actions-badge.atrox.dev/shelljs/shelljs/goto?ref=master)
[![Codecov](https://img.shields.io/codecov/c/github/shelljs/shelljs/master.svg?style=flat-square&label=coverage)](https://codecov.io/gh/shelljs/shelljs)
[![npm version](https://img.shields.io/npm/v/shelljs.svg?style=flat-square)](https://www.npmjs.com/package/shelljs)
[![npm downloads](https://img.shields.io/npm/dm/shelljs.svg?style=flat-square)](https://www.npmjs.com/package/shelljs)
Expand All @@ -14,7 +13,7 @@ projects - say goodbye to those gnarly Bash scripts!

ShellJS is proudly tested on every node release since <!-- start minVersion -->`v8`<!-- stop minVersion -->!

The project is [unit-tested](http://travis-ci.org/shelljs/shelljs) and battle-tested in projects like:
The project is unit-tested and battle-tested in projects like:

+ [Firebug](http://getfirebug.com/) - Firefox's infamous debugger
+ [JSHint](http://jshint.com) & [ESLint](http://eslint.org/) - popular JavaScript linters
Expand Down
32 changes: 0 additions & 32 deletions appveyor.yml

This file was deleted.

30 changes: 9 additions & 21 deletions scripts/check-node-support.js
Expand Up @@ -51,21 +51,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(function (num) {
return { 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 {
Expand All @@ -74,13 +64,11 @@ try {
var package = require('../package.json');
checkEngines(MIN_NODE_VERSION, package);

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) {
Expand Down

0 comments on commit d0a4516

Please sign in to comment.