From 3ba01cf2903386d873e719108b36dcfa8915a97b Mon Sep 17 00:00:00 2001 From: Martin Migasiewicz <616250+martinm82@users.noreply.github.com> Date: Thu, 5 Jan 2023 12:59:30 +0100 Subject: [PATCH 1/2] ci: run tests on CI --- .github/workflows/node-ci.yml | 22 ++++++++++++++++++---- package.json | 31 +++++++++++++++++++++++++------ 2 files changed, 43 insertions(+), 10 deletions(-) diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml index a977fbad..2442d7b4 100644 --- a/.github/workflows/node-ci.yml +++ b/.github/workflows/node-ci.yml @@ -1,20 +1,34 @@ 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: + fail-fast: true + 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 - - \ No newline at end of file + - run: npm run ${{ matrix.test }} + diff --git a/package.json b/package.json index 3fb729c0..bd66f74f 100644 --- a/package.json +++ b/package.json @@ -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:*", + "citest": "npm-run-all --print-label --parallel \"test:* -- --reporters=github-actions\"", + "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", @@ -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", @@ -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" } } From 2415a0da147b6b90b64cdf446011c1dd21aa7208 Mon Sep 17 00:00:00 2001 From: Martin Migasiewicz <616250+martinm82@users.noreply.github.com> Date: Thu, 5 Jan 2023 23:25:44 +0100 Subject: [PATCH 2/2] chore: do not fail fast --- .github/workflows/node-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml index 2442d7b4..dc41affe 100644 --- a/.github/workflows/node-ci.yml +++ b/.github/workflows/node-ci.yml @@ -18,7 +18,6 @@ jobs: if: ${{ github.actor != 'dependabot'}} runs-on: ubuntu-latest strategy: - fail-fast: true matrix: test: ['lint', 'citest'] node_version: ['12.x', '16.x']