mirror of
https://github.com/shelljs/shelljs.git
synced 2026-01-25 16:07:37 +00:00
chore: set up GitHub Actions CI (#1055)
This commit is contained in:
parent
0ae1dd681e
commit
d0a45166fd
39
.github/workflows/main.yml
vendored
Normal file
39
.github/workflows/main.yml
vendored
Normal file
@ -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
.travis.yml
26
.travis.yml
@ -1,26 +0,0 @@
|
||||
language: node_js
|
||||
sudo: false
|
||||
node_js:
|
||||
- 8
|
||||
- 9
|
||||
- 10
|
||||
- 11
|
||||
- 12
|
||||
- 13
|
||||
- 14
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
script:
|
||||
- npm run test-with-coverage
|
||||
- npm run lint
|
||||
# make sure when the docs are generated nothing changes (a.k.a. the docs have already been generated)
|
||||
- npm run gendocs
|
||||
- npm run check-node-support
|
||||
- npm run after-travis "Make sure to generate docs!"
|
||||
after_success:
|
||||
- npm run codecov -- -f coverage/lcov.info
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
@ -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.
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
# ShellJS - Unix shell commands for Node.js
|
||||
|
||||
[](https://travis-ci.org/shelljs/shelljs)
|
||||
[](https://ci.appveyor.com/project/shelljs/shelljs/branch/master)
|
||||
[](https://actions-badge.atrox.dev/shelljs/shelljs/goto?ref=master)
|
||||
[](https://codecov.io/gh/shelljs/shelljs)
|
||||
[](https://www.npmjs.com/package/shelljs)
|
||||
[](https://www.npmjs.com/package/shelljs)
|
||||
@ -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
|
||||
|
||||
32
appveyor.yml
32
appveyor.yml
@ -1,32 +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: false
|
||||
|
||||
# No need for MSBuild on this project
|
||||
build: off
|
||||
|
||||
test_script:
|
||||
- npm run test-with-coverage
|
||||
- npm run lint
|
||||
|
||||
on_success:
|
||||
- npm run codecov -- -f coverage/lcov.info
|
||||
@ -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 {
|
||||
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user