Skip to content

Commit

Permalink
feat: migrate to github actions (#355)
Browse files Browse the repository at this point in the history
* feat: migrate to github actions
  • Loading branch information
gemwuu authored Sep 24, 2021
1 parent 7363dcd commit e8bd485
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 49 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
strategy:
fail-fast: false
matrix:
node-version: [ 10.x, 12.x, 14.x ]
platform:
- os: ubuntu-latest
shell: bash
- os: windows-latest
shell: powershell
python-version: [ 3.6 ]
vs-version: [ 15.0 ]

runs-on: ${{ matrix.platform.os }}

defaults:
run:
shell: ${{ matrix.platform.shell }}

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
env:
PYTHON_VERSION: ${{ matrix.python-version }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Set Windows environment
if: matrix.os == 'windows-latest'
uses: microsoft/setup-msbuild@v1.0.3
with:
vs-version: ${{ matrix.vs-version }}
- name: Install dependencies
run: npm i
- name: Run CI
run: npm run ci
env:
NODE_OPTIONS: --max_old_space_size=6144


15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

27 changes: 0 additions & 27 deletions appveyor.yml

This file was deleted.

3 changes: 2 additions & 1 deletion lib/cnpm_config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';
const path = require('path');
const fs = require('fs');
const os = require('os');
const config = {};

function createConfigs() {
Expand All @@ -13,7 +14,7 @@ function createConfigs() {
const userConfig = path.join(root, '.cnpmrc');
if (!fs.existsSync(userConfig)) return;
const userConfigContent = fs.readFileSync(userConfig).toString();
const configs = typeof userConfigContent === 'string' && userConfigContent.split('\n');
const configs = typeof userConfigContent === 'string' && userConfigContent.split(os.EOL);
configs.reduce((pre, next) => {
if (typeof next === 'string') {
const map = next.split('=');
Expand Down
8 changes: 8 additions & 0 deletions test/concurrency-install.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,19 @@ describe('test/concurrency-install.test.js', () => {
root: root1,
cacheDir,
detail: true,
registry: 'https://registry.npmjs.com',
env: {
NODE_OPTIONS: '--max_old_space_size=4096',
},
}),
npminstall({
root: root2,
cacheDir,
detail: true,
registry: 'https://registry.npmjs.com',
env: {
NODE_OPTIONS: '--max_old_space_size=4096',
},
}),
]);
assert(await fs.exists(path.join(root1, 'node_modules/browserify')));
Expand Down
10 changes: 7 additions & 3 deletions test/css-loader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ const helper = require('./helper');

describe('test/css-loader.test.js', () => {
const tmp = helper.fixtures('css-loader-example2');
const cleanup = helper.cleanup(tmp);
// const cleanup = helper.cleanup(tmp);

beforeEach(cleanup);
afterEach(cleanup);
// beforeEach(cleanup);
// afterEach(cleanup);

it('should work on css-loader', async () => {
await npminstall({
root: tmp,
registry: 'https://registry.npmjs.com',
env: {
NODE_OPTIONS: '--max_old_space_size=4096',
},
});
assert(await fs.exists(tmp, 'node_modules/css-loader'));
});
Expand Down
4 changes: 4 additions & 0 deletions test/peerDependencies.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ describe('test/peerDependencies.test.js', () => {
it('should show peerDependencies warning message', async () => {
await npminstall({
root,
registry: 'https://registry.npmjs.com',
env: {
NODE_OPTIONS: '--max_old_space_size=4096',
},
});
});
});
10 changes: 7 additions & 3 deletions test/runscript.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ const helper = require('./helper');

describe('test/runscript.test.js', () => {
const root = helper.fixtures('runscript');
const cleanup = helper.cleanup(root);
// const cleanup = helper.cleanup(root);

beforeEach(cleanup);
afterEach(cleanup);
// beforeEach(cleanup);
// afterEach(cleanup);

it('should run preinstall and postinstall', async () => {
await npminstall({
root,
registry: 'https://registry.npmjs.com',
env: {
NODE_OPTIONS: '--max_old_space_size=4096',
},
});
const pkg = await readJSON(path.join(root, 'node_modules', 'pedding', 'package.json'));
assert(pkg.name === 'pedding');
Expand Down

0 comments on commit e8bd485

Please sign in to comment.