Skip to content

Commit d0a4516

Browse files
authored
chore: set up GitHub Actions CI (shelljs#1055)
1 parent 0ae1dd6 commit d0a4516

File tree

6 files changed

+52
-85
lines changed

6 files changed

+52
-85
lines changed

.github/workflows/main.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: CI
2+
on:
3+
- push
4+
- pull_request
5+
jobs:
6+
test:
7+
name: Node.js ${{ matrix.node-version }} on ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
node-version:
13+
- 8
14+
- 9
15+
- 10
16+
- 11
17+
- 12
18+
- 13
19+
- 14
20+
os:
21+
- ubuntu-latest
22+
- macos-latest
23+
- windows-latest
24+
steps:
25+
- uses: actions/checkout@v2
26+
- uses: actions/setup-node@v2
27+
with:
28+
node-version: ${{ matrix.node-version }}
29+
- run: npm install
30+
- run: npm run test-with-coverage
31+
- run: npm run lint
32+
- run: npm run gendocs
33+
- run: npm run check-node-support
34+
- name: Check for modified files (skip on Windows)
35+
run: npm run after-travis
36+
if: matrix.os != 'windows-latest'
37+
- uses: codecov/codecov-action@v2
38+
with:
39+
fail_ci_if_error: true

.travis.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ stable). If you've found a bug, please follow these steps:
1515
PRs are welcome! However, we ask that you follow a few guidelines:
1616

1717
- Please add tests for all changes/new features.
18-
- Make sure your code passes `npm test`. Please check the CI (both Appveyor and
19-
Travis). If you can't figure out why something doesn't work, feel free to ask
20-
for help.
18+
- Make sure your code passes `npm test`. Please check the CI. If you can't
19+
figure out why something doesn't work, feel free to ask for help.
2120
- Make sure you conform to our style guidelines. You can run `npm run lint` to
2221
check style, and `npm run lint -- --fix` to automatically fix some issues.
2322
- Make documentation changes *within the source files*, not in the README.

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# ShellJS - Unix shell commands for Node.js
22

3-
[![Travis](https://img.shields.io/travis/shelljs/shelljs/master.svg?style=flat-square&label=unix)](https://travis-ci.org/shelljs/shelljs)
4-
[![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)
3+
[![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)
54
[![Codecov](https://img.shields.io/codecov/c/github/shelljs/shelljs/master.svg?style=flat-square&label=coverage)](https://codecov.io/gh/shelljs/shelljs)
65
[![npm version](https://img.shields.io/npm/v/shelljs.svg?style=flat-square)](https://www.npmjs.com/package/shelljs)
76
[![npm downloads](https://img.shields.io/npm/dm/shelljs.svg?style=flat-square)](https://www.npmjs.com/package/shelljs)
@@ -14,7 +13,7 @@ projects - say goodbye to those gnarly Bash scripts!
1413

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

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

1918
+ [Firebug](http://getfirebug.com/) - Firefox's infamous debugger
2019
+ [JSHint](http://jshint.com) & [ESLint](http://eslint.org/) - popular JavaScript linters

appveyor.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

scripts/check-node-support.js

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,11 @@ function range(start, stop) {
5151
return ret;
5252
}
5353

54-
function checkTravis(minNodeVersion, maxNodeVersion, travisYaml) {
55-
var expectedTravisVersions = range(minNodeVersion, maxNodeVersion);
56-
var msg = 'Check Travis node_js versions';
57-
assertDeepEquals(travisYaml.node_js, expectedTravisVersions, msg);
58-
}
59-
60-
function checkAppveyor(minNodeVersion, maxNodeVersion, appveyorYaml) {
61-
var expectedAppveyorVersions = range(minNodeVersion, maxNodeVersion)
62-
.map(function (num) {
63-
return { nodejs_version: num.toString() };
64-
})
65-
.reverse(); // Arbitrarily, we store appveyor in reverse order.
66-
var msg = 'Check Appveyor environment.matrix versions';
67-
assertDeepEquals(appveyorYaml.environment.matrix, expectedAppveyorVersions,
68-
msg);
54+
function checkGithubActions(minNodeVersion, maxNodeVersion, githubActionsYaml) {
55+
var expectedVersions = range(minNodeVersion, maxNodeVersion);
56+
var msg = 'Check GitHub Actions node_js versions';
57+
assertDeepEquals(githubActionsYaml.jobs.test.strategy.matrix['node-version'],
58+
expectedVersions, msg);
6959
}
7060

7161
try {
@@ -74,13 +64,11 @@ try {
7464
var package = require('../package.json');
7565
checkEngines(MIN_NODE_VERSION, package);
7666

77-
var travisFileName = path.join(__dirname, '..', '.travis.yml');
78-
var travisYaml = yaml.safeLoad(shell.cat(travisFileName));
79-
checkTravis(MIN_NODE_VERSION, MAX_NODE_VERSION, travisYaml);
67+
var githubActionsFileName = path.join(__dirname, '..', '.github', 'workflows',
68+
'main.yml');
69+
var githubActionsYaml = yaml.safeLoad(shell.cat(githubActionsFileName));
70+
checkGithubActions(MIN_NODE_VERSION, MAX_NODE_VERSION, githubActionsYaml);
8071

81-
var appveyorFileName = path.join(__dirname, '..', 'appveyor.yml');
82-
var appveyorYaml = yaml.safeLoad(shell.cat(appveyorFileName));
83-
checkAppveyor(MIN_NODE_VERSION, MAX_NODE_VERSION, appveyorYaml);
8472
console.log('All files look good (this project supports v'
8573
+ MIN_NODE_VERSION + '-v' + MAX_NODE_VERSION + ')!');
8674
} catch (e) {

0 commit comments

Comments
 (0)