Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tests] migrate tests to Github Actions #764

Merged
merged 3 commits into from Dec 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/node-4+.yml
@@ -0,0 +1,81 @@
name: 'Tests: node.js'

on: [pull_request, push]

jobs:
matrix:
runs-on: ubuntu-latest
outputs:
latest: ${{ steps.set-matrix.outputs.requireds }}
steps:
- uses: ljharb/actions/node/matrix@main
id: set-matrix
with:
versionsAsRoot: true
type: 'majors'
preset: '>=4'

latest:
needs: [matrix]
name: 'latest majors'
runs-on: ubuntu-latest

strategy:
matrix:
node-version: ${{ fromJson(needs.matrix.outputs.latest) }}
eslint:
- 7
- 6
- 5
- 4
- 3
exclude:
- node-version: 9
eslint: 7
- node-version: 8
eslint: 7
- node-version: 7
eslint: 7
- node-version: 7
eslint: 6
- node-version: 6
eslint: 7
- node-version: 6
eslint: 6
- node-version: 5
eslint: 7
- node-version: 5
eslint: 6
- node-version: 5
eslint: 5
- node-version: 5
eslint: 4
- node-version: 5 # TODO: fix
eslint: 3
- node-version: 4
eslint: 7
- node-version: 4
eslint: 6
- node-version: 4
eslint: 5
- node-version: 4 # TODO: fix
eslint: 4
- node-version: 4 # TODO: fix
eslint: 3

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/run@main
name: 'npm install && npm run tests-only'
with:
after_install: npm uninstall --no-save eslint-config-airbnb-base && npm install --no-save "eslint@${{ matrix.eslint }}"
node-version: ${{ matrix.node-version }}
command: 'test:ci'
skip-ls-check: true

node:
name: 'node 4+'
needs: [latest]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
40 changes: 40 additions & 0 deletions .github/workflows/node-pretest.yml
@@ -0,0 +1,40 @@
name: 'Tests: pretest/posttest'

on: [pull_request, push]

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/run@main
name: 'npm install && npm run lint'
with:
node-version: 'lts/*'
command: 'lint'
skip-ls-check: true

flow:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/run@main
name: 'npm install && npm run flow'
with:
node-version: 'lts/*'
command: 'flow'
skip-ls-check: true

posttest:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/run@main
name: 'npm install && npm run posttest'
with:
node-version: 'lts/*'
command: 'posttest'
skip-ls-check: true
5 changes: 3 additions & 2 deletions .gitignore
@@ -1,9 +1,10 @@
.DS_Store
coverage
coverage/
lib
node_modules
npm-debug.log

npm-shrinkwrap.json
package-lock.json
reports
yarn-error.log
yarn.lock
7 changes: 4 additions & 3 deletions package.json
Expand Up @@ -18,25 +18,25 @@
"main": "lib/index.js",
"scripts": {
"build": "rimraf lib && babel src --out-dir lib --copy-files",
"coveralls": "cat ./reports/lcov.info | coveralls",
"create": "node ./scripts/create-rule",
"flow": "if [ ! -e ./.flowconfig ]; then echo \"Could not find .flowconfig\"; else flow; test $? -eq 0 -o $? -eq 2; fi",
"lint:fix": "npm run lint -- --fix",
"lint": "eslint --config .eslintrc src __tests__ __mocks__ scripts",
"prepublish": "safe-publish-latest && not-in-publish || (npm run lint && npm run flow && npm run jest && npm run build)",
"pretest": "npm run lint:fix && npm run flow",
"test": "npm run jest",
"posttest": "aud --production",
"test:ci": "npm run jest -- --ci --runInBand",
"jest": "jest --coverage __tests__/**/*"
},
"devDependencies": {
"@babel/cli": "^7.12.10",
"@babel/core": "^7.12.10",
"@babel/plugin-transform-flow-strip-types": "^7.12.10",
"aud": "^1.1.3",
"babel-eslint": "^10.1.0",
"babel-jest": "^24.9.0",
"babel-preset-airbnb": "^5.0.0",
"coveralls": "^3.1.0",
"eslint": "^3 || ^4 || ^5 || ^6 || ^7",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-flowtype": "^5.2.0",
Expand Down Expand Up @@ -77,9 +77,10 @@
"jest": {
"coverageReporters": [
"lcov",
"json",
"html"
],
"coverageDirectory": "reports",
"coverageDirectory": "coverage",
"roots": [
"__tests__"
],
Expand Down