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

ci: run tests on pull requests #375

Open
wants to merge 2 commits into
base: main-enterprise
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
name: Node.js CI
"on":

on:
pull_request:
types:
- opened
- reopened
- edited
- synchronize
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
if: ${{ github.actor != 'dependabot'}}
runs-on: ubuntu-latest
strategy:
matrix:
test: ['lint', 'citest']
node_version: ['12.x', '16.x']
steps:
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 12.x
node-version: ${{ matrix.node_version }}
cache: 'npm'
- run: npm install

- run: npm run ${{ matrix.test }}

31 changes: 25 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
"scripts": {
"dev": "nodemon --inspect",
"start": "probot run ./index.js",
"test": "npm-run-all --print-label --parallel lint:* --parallel test:*",
"lint:es": "eslint .",
"test": "npm-run-all --print-label --parallel test:*",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! With lint gone from npm test it would be awesome to add either a CONTRIBUTING.md file (or a simple "Development" heading in the repo readme) that states that it's expected to successfully run npm lint and npm test before posting a PR.

"citest": "npm-run-all --print-label --parallel \"test:* -- --reporters=github-actions\"",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this also run test:me, test:unit:watch, test:integration:debug ? Maybe not a problem since npm test worked fine locally using the same argument to npm-run-all..

"testall": "npm-run-all --print-label --parallel lint:* --parallel test:*",
"lint": "npm-run-all --print-label --parallel lint:*",
"lint:es": "eslint --format github --format junit .",
"lint:js": "standard",
"lint:lockfile": "lockfile-lint --path package-lock.json --type npm --validate-https --allowed-hosts npm",
"lint:engines": "check-engine",
Expand All @@ -24,16 +27,18 @@
"dependencies": {
"@probot/adapter-aws-lambda-serverless": "^3.0.1",
"deepmerge": "^4.2.2",
"eslint-formatter-github": "^1.0.11",
"eta": "^1.12.3",
"jest-junit": "^15.0.0",
"js-yaml": "^4.1.0",
"node-cron": "^3.0.2",
"probot": "^12.2.8"
},
"devDependencies": {
"@eslint/eslintrc": "^1.3.1",
"@travi/any": "^2.1.5",
"check-engine": "^1.10.1",
"eslint": "^8.23.0",
"@eslint/eslintrc": "^1.3.1",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-node": "^11.1.0",
Expand All @@ -56,14 +61,28 @@
"engines": {
"node": ">= 12.14.1"
},
"jest": {
"testEnvironment": "node"
},
"nodemonConfig": {
"exec": "npm start",
"watch": [
".env",
"."
]
},
"jest": {
"testEnvironment": "node",
"reporters": [
"default",
"jest-junit"
]
},
"jest-junit": {
"suiteName": "jest tests",
"outputDirectory": "reports",
"outputName": "jest-junit.xml",
"uniqueOutputName": "false",
"classNameTemplate": "{classname}-{title}",
"titleTemplate": "{classname}-{title}",
"ancestorSeparator": " › ",
"usePathForSuiteName": "true"
}
}