From d3b335f18b96aea03b8212efc69432bd6cd175a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Mon, 18 Oct 2021 13:38:21 +0200 Subject: [PATCH 01/30] ci: ignore test.yml workflow on release-* branches PRs #36 --- .github/workflows/tests.yml | 60 +++++++++++-------------------------- 1 file changed, 17 insertions(+), 43 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 26c6ed7..a74688f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,44 +1,21 @@ -name: Test suite +name: Tests + +# This workflow runs standard unit tests to ensure basic integrity and avoid +# regressions on pull-requests (and pushes) on: push: branches: - - master # allthough master is push protected we still keep it + - master # allthough master is push protected we still keep it - development - pull_request: # runs on all PR + pull_request: # runs on all PR + branches-ignore: + - release-* # on release we run an extended workflow so no need for this jobs: - # ---------------------------------- - # uncomment when a linter is added - # ---------------------------------- - - # lintjs: - # name: Javascript lint - # runs-on: ubuntu-latest - # steps: - # - name: checkout - # uses: actions/checkout@v2 - # - # - name: setup node - # uses: actions/setup-node@v1 - # with: - # node-version: '12.x' - # - # - name: cache dependencies - # uses: actions/cache@v1 - # with: - # path: ~/.npm - # key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - # restore-keys: | - # ${{ runner.os }}-node- - # - run: npm ci - # - run: npm run lint - unittest: name: unit tests runs-on: ubuntu-latest - # uncomment when a linter is added - # needs: [lintjs] strategy: matrix: node: [12, 14, 16] @@ -61,15 +38,12 @@ jobs: - run: npm ci - run: npm run test:coverage - # ---------------------------------- - # uncomment when a linter is added - # ---------------------------------- - - # - name: check coverage - # uses: devmasx/coverage-check-action@v1.2.0 - # with: - # type: lcov - # result_path: coverage/lcov.info - # min_coverage: 90 - # token: ${{github.token}} - + # with the following action we enforce PRs to have a high coverage + # and ensure, changes are tested well enough so that coverage won't fail + - name: check coverage + uses: devmasx/coverage-check-action@v1.2.0 + with: + type: lcov + result_path: coverage/lcov.info + min_coverage: 95 + token: ${{github.token}} From 8c080ff9842f271c3b7854dfb2571a90ed6861d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Mon, 18 Oct 2021 13:39:01 +0200 Subject: [PATCH 02/30] ci: add tests-release.yml workflow to test release-integrity --- .github/workflows/tests-release.yml | 153 ++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 .github/workflows/tests-release.yml diff --git a/.github/workflows/tests-release.yml b/.github/workflows/tests-release.yml new file mode 100644 index 0000000..75c9236 --- /dev/null +++ b/.github/workflows/tests-release.yml @@ -0,0 +1,153 @@ +name: Tests for Release + +on: + push: + branches: + - release-* # all release- branches + pull_request: + branches: + - release-* # all release- branches + +jobs: + # STEP 1 - NPM Audit + + # Before we even test a thing we want to have a clean audit! Since this is + # sufficient to be done using the lowest node version, we can easily use + # a fixed one: + + audit: + name: NPM Audit + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup node 12 + uses: actions/setup-node@v1 + with: + node-version: 12 + - run: npm audit + + # STEP 2 - basic unit tests + + # This is the standard unit tests as we do in the basic tests for every PR + unittest: + name: Basic unit tests + runs-on: ubuntu-latest + needs: [audit] + strategy: + matrix: + node: [12, 14, 16] + steps: + - name: Checkout ${{ matrix.node }} + uses: actions/checkout@v2 + + - name: Setup node ${{ matrix.node }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + + - name: Cache dependencies ${{ matrix.node }} + uses: actions/cache@v1 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node-${{ matrix.node }} + + # for this workflow we also require npm audit to pass + - run: npm ci + - run: npm run test:coverage + + # with the following action we enforce PRs to have a high coverage + # and ensure, changes are tested well enough so that coverage won't fail + - name: check coverage + uses: devmasx/coverage-check-action@v1.2.0 + with: + type: lcov + result_path: coverage/lcov.info + min_coverage: 95 + token: ${{github.token}} + + # STEP 3 - Integration tests + + # Since our release may affect several packages that depend on it we need to + # cover the closest ones, like adapters and examples. + + integrationtests: + name: Extended integration tests + runs-on: ubuntu-latest + needs: [unittest] + strategy: + matrix: + node: [12, 14, 16] + steps: + # checkout this repo + - name: Checkout ${{ matrix.node }} + uses: actions/checkout@v2 + + # checkout express-adapter repo + - name: Checkout express-adapter ${{ matrix.node }} + uses: actions/checkout@v2 + with: + repository: node-oauth/express-adapter + path: github/testing + + # place checkout for other adapters here + - name: Setup node ${{ matrix.node }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + + - name: Cache dependencies ${{ matrix.node }} + uses: actions/cache@v1 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node-${{ matrix.node }} + + # in order to test the adapter we need to use the current state + # we just cloned and install it as local dependency + - run: cd github/testing/express-adapter && npm ci + - run: cd github/testing/express-adapter && npm install ./ + - run: cd github/testing/express-adapter && npm run tests + + # todo repeat with other adapters + + npmpubdry: + name: NPM Publish Dry-run + runs-on: ubuntu-latest + needs: [integrationtests] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup node 12 + uses: actions/setup-node@v1 + with: + node-version: '12.x' + registry-url: 'https://registry.npmjs.org' + - run: npm install + - run: npm publish --dry-run + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + ghpubdry: + needs: [integrationtests] + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + # we always publish targeting the lowest supported node version + node-version: 12 + registry-url: $registry-url(npm) + - run: npm ci + - run: npm publish --dry-run + env: + NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file From c6459b87fe88fbbd6c7e4ff07f8dce93e28b0d90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Mon, 18 Oct 2021 13:39:16 +0200 Subject: [PATCH 03/30] ci: add release.yml to release a new version to registries --- .github/workflows/release.yml | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1523759 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,52 @@ +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created +# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages + +name: Release + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 12 + - run: npm ci + - run: npm test + + publish-npm: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + # we always publish targeting the lowest supported node version + node-version: 12 + registry-url: 'https://registry.npmjs.org/' + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} + + publish-gpr: + needs: build + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + # we always publish targeting the lowest supported node version + node-version: 12 + registry-url: $registry-url(npm) + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file From f4fc33bb6843cb6bbd30cafdccd9da1e955223e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Tue, 26 Oct 2021 06:42:42 +0200 Subject: [PATCH 04/30] ci(tests): make coverage generate lcov.info file --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 04999c5..1e8be1e 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "pretest": "./node_modules/.bin/eslint lib test index.js", "test": "NODE_ENV=test ./node_modules/.bin/mocha 'test/**/*_test.js'", "test-debug": "NODE_ENV=test ./node_modules/.bin/mocha --inspect --debug-brk 'test/**/*_test.js'", - "test:coverage": "NODE_ENV=test nyc --reporter=html --reporter=text ./node_modules/.bin/mocha 'test/**/*_test.js'" + "test:coverage": "NODE_ENV=test nyc --report=lcovonly --reporter=text ./node_modules/.bin/mocha 'test/**/*_test.js'" }, "repository": { "type": "git", From 02e0a4d9cb42d007b2550c4921bafe2c957e340d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Tue, 26 Oct 2021 06:46:34 +0200 Subject: [PATCH 05/30] ci(tests): make coverage generate lcov.info file as well as html #36 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1e8be1e..1084a28 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "pretest": "./node_modules/.bin/eslint lib test index.js", "test": "NODE_ENV=test ./node_modules/.bin/mocha 'test/**/*_test.js'", "test-debug": "NODE_ENV=test ./node_modules/.bin/mocha --inspect --debug-brk 'test/**/*_test.js'", - "test:coverage": "NODE_ENV=test nyc --report=lcovonly --reporter=text ./node_modules/.bin/mocha 'test/**/*_test.js'" + "test:coverage": "NODE_ENV=test nyc --report=lcov --reporter=text ./node_modules/.bin/mocha 'test/**/*_test.js'" }, "repository": { "type": "git", From ac7bb86a5403fa3ae9598006369a5b5cc4438cb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Tue, 26 Oct 2021 06:47:44 +0200 Subject: [PATCH 06/30] ci(tests): fix spelling in coverage test script #36 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1084a28..90e4dab 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "pretest": "./node_modules/.bin/eslint lib test index.js", "test": "NODE_ENV=test ./node_modules/.bin/mocha 'test/**/*_test.js'", "test-debug": "NODE_ENV=test ./node_modules/.bin/mocha --inspect --debug-brk 'test/**/*_test.js'", - "test:coverage": "NODE_ENV=test nyc --report=lcov --reporter=text ./node_modules/.bin/mocha 'test/**/*_test.js'" + "test:coverage": "NODE_ENV=test nyc --reporter=lcov --reporter=text ./node_modules/.bin/mocha 'test/**/*_test.js'" }, "repository": { "type": "git", From 13aacce984255758a1b5f6b27b399d4488c5670e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Thu, 13 Jan 2022 09:15:21 +0100 Subject: [PATCH 07/30] feature(ci): release workflow only runs on non-draft pull requests --- .github/workflows/tests-release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests-release.yml b/.github/workflows/tests-release.yml index 75c9236..7a6dce7 100644 --- a/.github/workflows/tests-release.yml +++ b/.github/workflows/tests-release.yml @@ -5,9 +5,11 @@ on: branches: - release-* # all release- branches pull_request: + types: [review_requested, ready_for_review] # only non-draft PR branches: - release-* # all release- branches + jobs: # STEP 1 - NPM Audit @@ -27,7 +29,7 @@ jobs: uses: actions/setup-node@v1 with: node-version: 12 - - run: npm audit + - run: npm audit --production # no audit for dev dependencies # STEP 2 - basic unit tests From edd8160d753f926bcc6e4d539028711e30b5729e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Thu, 13 Jan 2022 09:20:14 +0100 Subject: [PATCH 08/30] fix(ci): use actions v2 for setting up node --- .github/workflows/tests-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests-release.yml b/.github/workflows/tests-release.yml index 7a6dce7..b15bf6f 100644 --- a/.github/workflows/tests-release.yml +++ b/.github/workflows/tests-release.yml @@ -26,7 +26,7 @@ jobs: uses: actions/checkout@v2 - name: Setup node 12 - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: node-version: 12 - run: npm audit --production # no audit for dev dependencies @@ -46,7 +46,7 @@ jobs: uses: actions/checkout@v2 - name: Setup node ${{ matrix.node }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: node-version: ${{ matrix.node }} From 69a30439834e631ac70d6d61322442178f786b8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Thu, 13 Jan 2022 09:23:38 +0100 Subject: [PATCH 09/30] fix(ci): use code-ql only on non-draft releases --- .github/workflows/codeql-analysis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 33f3826..7cadbb5 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -14,6 +14,7 @@ name: "CodeQL Semantic Analysis" on: push: # all pushes pull_request: # all PR + types: [review_requested, ready_for_review] # only non-draft PR schedule: - cron: '0 2 * * *' # every night at 2am From 36e13ebaebcddd97f60834d9d10afd93ffc95141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Thu, 13 Jan 2022 09:26:48 +0100 Subject: [PATCH 10/30] fix(ci): fix audit job syntax error --- .github/workflows/tests-release.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests-release.yml b/.github/workflows/tests-release.yml index b15bf6f..422817a 100644 --- a/.github/workflows/tests-release.yml +++ b/.github/workflows/tests-release.yml @@ -22,13 +22,10 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Setup node 12 - uses: actions/setup-node@v2 + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 with: - node-version: 12 + node-version: '12' - run: npm audit --production # no audit for dev dependencies # STEP 2 - basic unit tests From 4188547a590d8696e9a78e531f8369d2114768dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Thu, 13 Jan 2022 09:29:39 +0100 Subject: [PATCH 11/30] fix(ci): fix publish jobs syntax error --- .github/workflows/tests-release.yml | 38 ++++++++++++++--------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/.github/workflows/tests-release.yml b/.github/workflows/tests-release.yml index 422817a..63418c5 100644 --- a/.github/workflows/tests-release.yml +++ b/.github/workflows/tests-release.yml @@ -120,19 +120,17 @@ jobs: runs-on: ubuntu-latest needs: [integrationtests] steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Setup node 12 - uses: actions/setup-node@v1 - with: - node-version: '12.x' - registry-url: 'https://registry.npmjs.org' - - run: npm install - - run: npm publish --dry-run + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '12' + registry-url: 'https://registry.npmjs.org' + - run: npm install --production + - run: npm publish --dry-run env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + ghpubdry: needs: [integrationtests] runs-on: ubuntu-latest @@ -140,13 +138,13 @@ jobs: contents: read packages: write steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - # we always publish targeting the lowest supported node version - node-version: 12 - registry-url: $registry-url(npm) - - run: npm ci - - run: npm publish --dry-run - env: - NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + # we always publish targeting the lowest supported node version + node-version: 12 + registry-url: $registry-url(npm) + - run: npm install --prudction + - run: npm publish --dry-run + env: + NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file From ecb072efccde7db4bd74df14db64742563c52d06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Thu, 13 Jan 2022 09:32:13 +0100 Subject: [PATCH 12/30] fix(ci): fix publish jobs syntax error --- .github/workflows/tests-release.yml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/tests-release.yml b/.github/workflows/tests-release.yml index 63418c5..9764e7f 100644 --- a/.github/workflows/tests-release.yml +++ b/.github/workflows/tests-release.yml @@ -115,23 +115,21 @@ jobs: # todo repeat with other adapters - npmpubdry: - name: NPM Publish Dry-run + publish-npm-dry: runs-on: ubuntu-latest needs: [integrationtests] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: '12' - registry-url: 'https://registry.npmjs.org' - - run: npm install --production - - run: npm publish --dry-run + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 12 + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm publish --dry-run env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - + NODE_AUTH_TOKEN: ${{secrets.npm_token}} - ghpubdry: + publish-github-dry: needs: [integrationtests] runs-on: ubuntu-latest permissions: @@ -144,7 +142,7 @@ jobs: # we always publish targeting the lowest supported node version node-version: 12 registry-url: $registry-url(npm) - - run: npm install --prudction + - run: npm ci - run: npm publish --dry-run env: NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file From 510546b4678ac4888d20d138b393460be51a3968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Thu, 13 Jan 2022 09:46:12 +0100 Subject: [PATCH 13/30] fix(ci): fix check coverage --- .github/workflows/tests-release.yml | 6 ++---- .github/workflows/tests.yml | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests-release.yml b/.github/workflows/tests-release.yml index 9764e7f..20246a0 100644 --- a/.github/workflows/tests-release.yml +++ b/.github/workflows/tests-release.yml @@ -62,12 +62,10 @@ jobs: # with the following action we enforce PRs to have a high coverage # and ensure, changes are tested well enough so that coverage won't fail - name: check coverage - uses: devmasx/coverage-check-action@v1.2.0 + uses: VeryGoodOpenSource/very_good_coverage@v1.2.0 with: - type: lcov - result_path: coverage/lcov.info + path: './coverage/lcov.info' min_coverage: 95 - token: ${{github.token}} # STEP 3 - Integration tests diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a74688f..e8b05a7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -41,9 +41,7 @@ jobs: # with the following action we enforce PRs to have a high coverage # and ensure, changes are tested well enough so that coverage won't fail - name: check coverage - uses: devmasx/coverage-check-action@v1.2.0 + uses: VeryGoodOpenSource/very_good_coverage@v1.2.0 with: - type: lcov - result_path: coverage/lcov.info + path: './coverage/lcov.info' min_coverage: 95 - token: ${{github.token}} From 88a7bfed070ffaf22e20eab82b286c5ea8e2cbae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Thu, 13 Jan 2022 09:50:46 +0100 Subject: [PATCH 14/30] fix(ci): run workflows also only on push for non-draft PR --- .github/workflows/tests-release.yml | 1 + .github/workflows/tests.yml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.github/workflows/tests-release.yml b/.github/workflows/tests-release.yml index 20246a0..47b8f84 100644 --- a/.github/workflows/tests-release.yml +++ b/.github/workflows/tests-release.yml @@ -2,6 +2,7 @@ name: Tests for Release on: push: + types: [review_requested, ready_for_review] # only non-draft PR branches: - release-* # all release- branches pull_request: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e8b05a7..1c6aec0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,6 +8,8 @@ on: branches: - master # allthough master is push protected we still keep it - development + branches-ignore: + - release-* # on release we run an extended workflow so no need for this pull_request: # runs on all PR branches-ignore: - release-* # on release we run an extended workflow so no need for this From d6ec7d8ac426d0118cacc4b404f18f77322cb744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Thu, 13 Jan 2022 09:52:14 +0100 Subject: [PATCH 15/30] fix(ci): fix tets.yml semantic error --- .github/workflows/tests.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1c6aec0..e8b05a7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,8 +8,6 @@ on: branches: - master # allthough master is push protected we still keep it - development - branches-ignore: - - release-* # on release we run an extended workflow so no need for this pull_request: # runs on all PR branches-ignore: - release-* # on release we run an extended workflow so no need for this From e556def39e533ecffb25387f9ab591d7207fe091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Thu, 13 Jan 2022 09:54:54 +0100 Subject: [PATCH 16/30] fix(ci): release-workflow trigger on push to PR --- .github/workflows/tests-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests-release.yml b/.github/workflows/tests-release.yml index 47b8f84..699fece 100644 --- a/.github/workflows/tests-release.yml +++ b/.github/workflows/tests-release.yml @@ -2,11 +2,11 @@ name: Tests for Release on: push: - types: [review_requested, ready_for_review] # only non-draft PR branches: - release-* # all release- branches pull_request: - types: [review_requested, ready_for_review] # only non-draft PR + # only non-draft PR and when there are "pushes" to the open PR + types: [review_requested, ready_for_review, synchronize] branches: - release-* # all release- branches From 465b786a71efd2f5251bcdc60af3c77096138bd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Thu, 13 Jan 2022 09:58:14 +0100 Subject: [PATCH 17/30] fix(ci): add lcov reporter to test:coverage --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c0deb37..7e6000c 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "test": "NODE_ENV=test ./node_modules/.bin/mocha 'test/**/*_test.js'", "test-debug": "NODE_ENV=test ./node_modules/.bin/mocha --inspect --debug-brk 'test/**/*_test.js'", "test:watch": "NODE_ENV=test ./node_modules/.bin/mocha --watch 'test/**/*_test.js'", - "test:coverage": "NODE_ENV=test nyc --reporter=html --reporter=text ./node_modules/.bin/mocha 'test/**/*_test.js'", + "test:coverage": "NODE_ENV=test nyc --reporter=html --reporter=lcov --reporter=text ./node_modules/.bin/mocha 'test/**/*_test.js'", "lint": "npx eslint .", "lint:fix": "npx eslint . --fix" }, From b7867e70378f3410ed02e8b99a6fd5f1bf7d9a99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Thu, 13 Jan 2022 10:06:25 +0100 Subject: [PATCH 18/30] fix(ci): use oauthjs/express-oauth-server for integration testing --- .github/workflows/tests-release.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests-release.yml b/.github/workflows/tests-release.yml index 699fece..f2e2415 100644 --- a/.github/workflows/tests-release.yml +++ b/.github/workflows/tests-release.yml @@ -89,7 +89,7 @@ jobs: - name: Checkout express-adapter ${{ matrix.node }} uses: actions/checkout@v2 with: - repository: node-oauth/express-adapter + repository: oauthjs/express-oauth-server path: github/testing # place checkout for other adapters here @@ -108,9 +108,12 @@ jobs: # in order to test the adapter we need to use the current state # we just cloned and install it as local dependency - - run: cd github/testing/express-adapter && npm ci - - run: cd github/testing/express-adapter && npm install ./ - - run: cd github/testing/express-adapter && npm run tests + - run: | + PROJECT_PATH=$(pwd) + cd github/testing/express-adapter + npm ci + npm install $PROJECT_PATH + npm run test # todo repeat with other adapters From 3167a8e3d05761988c3883d448ac821d686a68de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Thu, 13 Jan 2022 10:12:38 +0100 Subject: [PATCH 19/30] fix(ci): fix path for integration test --- .github/workflows/tests-release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/tests-release.yml b/.github/workflows/tests-release.yml index f2e2415..930dfad 100644 --- a/.github/workflows/tests-release.yml +++ b/.github/workflows/tests-release.yml @@ -109,10 +109,9 @@ jobs: # in order to test the adapter we need to use the current state # we just cloned and install it as local dependency - run: | - PROJECT_PATH=$(pwd) cd github/testing/express-adapter npm ci - npm install $PROJECT_PATH + npm install ../../../ npm run test # todo repeat with other adapters From c99001c9b2fe22ddf379aeba5d6b4e60ad5e28b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Thu, 13 Jan 2022 10:16:39 +0100 Subject: [PATCH 20/30] fix(ci): fix path for integration test --- .github/workflows/tests-release.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests-release.yml b/.github/workflows/tests-release.yml index 930dfad..d74162a 100644 --- a/.github/workflows/tests-release.yml +++ b/.github/workflows/tests-release.yml @@ -92,9 +92,8 @@ jobs: repository: oauthjs/express-oauth-server path: github/testing - # place checkout for other adapters here - name: Setup node ${{ matrix.node }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: node-version: ${{ matrix.node }} @@ -102,9 +101,9 @@ jobs: uses: actions/cache@v1 with: path: ~/.npm - key: ${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }} + key: ${{ runner.os }}-node-${{ matrix.node }}-oauthjs/express-oauth-server-${{ hashFiles('github/testing/**/package-lock.json') }} restore-keys: | - ${{ runner.os }}-node-${{ matrix.node }} + ${{ runner.os }}-node-${{ matrix.node }}-oauthjs/express-oauth-server # in order to test the adapter we need to use the current state # we just cloned and install it as local dependency From fd9ead86b60d1f75a1aa74850fa31da87bab5979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Thu, 13 Jan 2022 10:37:59 +0100 Subject: [PATCH 21/30] fix(ci): fix path for integration test --- .github/workflows/tests-release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests-release.yml b/.github/workflows/tests-release.yml index d74162a..8f42fdb 100644 --- a/.github/workflows/tests-release.yml +++ b/.github/workflows/tests-release.yml @@ -90,7 +90,7 @@ jobs: uses: actions/checkout@v2 with: repository: oauthjs/express-oauth-server - path: github/testing + path: github/testing/express - name: Setup node ${{ matrix.node }} uses: actions/setup-node@v2 @@ -101,14 +101,14 @@ jobs: uses: actions/cache@v1 with: path: ~/.npm - key: ${{ runner.os }}-node-${{ matrix.node }}-oauthjs/express-oauth-server-${{ hashFiles('github/testing/**/package-lock.json') }} + key: ${{ runner.os }}-node-${{ matrix.node }}-oauthjs/express-oauth-server-${{ hashFiles('github/testing/express/**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node-${{ matrix.node }}-oauthjs/express-oauth-server # in order to test the adapter we need to use the current state # we just cloned and install it as local dependency - run: | - cd github/testing/express-adapter + cd github/testing/express npm ci npm install ../../../ npm run test From aee6d92af84495977195b74cb4e9734ca0067440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Thu, 13 Jan 2022 10:47:11 +0100 Subject: [PATCH 22/30] fix(ci): fix path for integration test --- .github/workflows/tests-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests-release.yml b/.github/workflows/tests-release.yml index 8f42fdb..ee434a8 100644 --- a/.github/workflows/tests-release.yml +++ b/.github/workflows/tests-release.yml @@ -109,6 +109,7 @@ jobs: # we just cloned and install it as local dependency - run: | cd github/testing/express + ls -la npm ci npm install ../../../ npm run test From 916c6134b487237a9e5882b422fefe715605ae29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Thu, 13 Jan 2022 10:52:56 +0100 Subject: [PATCH 23/30] fix(ci): fix path for integration test --- .github/workflows/tests-release.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/tests-release.yml b/.github/workflows/tests-release.yml index ee434a8..b2dab96 100644 --- a/.github/workflows/tests-release.yml +++ b/.github/workflows/tests-release.yml @@ -109,8 +109,6 @@ jobs: # we just cloned and install it as local dependency - run: | cd github/testing/express - ls -la - npm ci npm install ../../../ npm run test From a47e867fd8d2c79c8b17e8ece05db6fe58e1c26e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Thu, 13 Jan 2022 11:05:51 +0100 Subject: [PATCH 24/30] fix(ci): use node-oauth/express-oauth-server for integration test --- .github/workflows/tests-release.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests-release.yml b/.github/workflows/tests-release.yml index b2dab96..ff0493c 100644 --- a/.github/workflows/tests-release.yml +++ b/.github/workflows/tests-release.yml @@ -89,7 +89,7 @@ jobs: - name: Checkout express-adapter ${{ matrix.node }} uses: actions/checkout@v2 with: - repository: oauthjs/express-oauth-server + repository: node-oauth/express-oauth-server path: github/testing/express - name: Setup node ${{ matrix.node }} @@ -101,15 +101,16 @@ jobs: uses: actions/cache@v1 with: path: ~/.npm - key: ${{ runner.os }}-node-${{ matrix.node }}-oauthjs/express-oauth-server-${{ hashFiles('github/testing/express/**/package-lock.json') }} + key: ${{ runner.os }}-node-${{ matrix.node }}-node-oauth/express-oauth-server-${{ hashFiles('github/testing/express/**/package-lock.json') }} restore-keys: | - ${{ runner.os }}-node-${{ matrix.node }}-oauthjs/express-oauth-server + ${{ runner.os }}-node-${{ matrix.node }}-node-oauth/express-oauth-server # in order to test the adapter we need to use the current state # we just cloned and install it as local dependency - run: | cd github/testing/express npm install ../../../ + cd ../../../ npm run test # todo repeat with other adapters From 8073105a724e22fdb61fe8d790b63c04ba0105f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Thu, 13 Jan 2022 11:08:11 +0100 Subject: [PATCH 25/30] fix(ci): fix path for integration test --- .github/workflows/tests-release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/tests-release.yml b/.github/workflows/tests-release.yml index ff0493c..0719939 100644 --- a/.github/workflows/tests-release.yml +++ b/.github/workflows/tests-release.yml @@ -110,7 +110,6 @@ jobs: - run: | cd github/testing/express npm install ../../../ - cd ../../../ npm run test # todo repeat with other adapters From 06e6b4c9f92c6b4e2077cf131c9fbbb363004125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Thu, 13 Jan 2022 11:10:30 +0100 Subject: [PATCH 26/30] fix(ci): fix path for integration test --- .github/workflows/tests-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests-release.yml b/.github/workflows/tests-release.yml index 0719939..9949fb3 100644 --- a/.github/workflows/tests-release.yml +++ b/.github/workflows/tests-release.yml @@ -110,6 +110,7 @@ jobs: - run: | cd github/testing/express npm install ../../../ + npm install npm run test # todo repeat with other adapters From 099d063e23c96e40136313c0d5364095325956cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Thu, 13 Jan 2022 11:16:12 +0100 Subject: [PATCH 27/30] fix(ci): fix path for integration test --- .github/workflows/tests-release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests-release.yml b/.github/workflows/tests-release.yml index 9949fb3..63be8c7 100644 --- a/.github/workflows/tests-release.yml +++ b/.github/workflows/tests-release.yml @@ -105,12 +105,13 @@ jobs: restore-keys: | ${{ runner.os }}-node-${{ matrix.node }}-node-oauth/express-oauth-server - # in order to test the adapter we need to use the current state + # in order to test the adapter we need to use the current checkout + # and install it as local dependency # we just cloned and install it as local dependency - run: | cd github/testing/express + npm ci npm install ../../../ - npm install npm run test # todo repeat with other adapters From f4bfae830123d66d830bb8327abe8ba5268ff738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Thu, 13 Jan 2022 11:26:04 +0100 Subject: [PATCH 28/30] fix(ci): exclude node 16 to get running --- .github/workflows/tests-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-release.yml b/.github/workflows/tests-release.yml index 63be8c7..6eba05e 100644 --- a/.github/workflows/tests-release.yml +++ b/.github/workflows/tests-release.yml @@ -79,7 +79,7 @@ jobs: needs: [unittest] strategy: matrix: - node: [12, 14, 16] + node: [12, 14] # TODO get running for node 16 steps: # checkout this repo - name: Checkout ${{ matrix.node }} From 9c702365863fc585657538da6c930c43d22c00e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Tue, 18 Jan 2022 20:51:02 +0100 Subject: [PATCH 29/30] build(ci): add --access-public flag to npm publish --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1523759..5acd3e1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,7 +29,7 @@ jobs: node-version: 12 registry-url: 'https://registry.npmjs.org/' - run: npm ci - - run: npm publish + - run: npm publish --access public env: NODE_AUTH_TOKEN: ${{secrets.npm_token}} @@ -47,6 +47,6 @@ jobs: node-version: 12 registry-url: $registry-url(npm) - run: npm ci - - run: npm publish + - run: npm publish --access public env: NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file From c97d0e31fc1f7b81941a3942366c0f27b8c2557b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BCster?= Date: Tue, 1 Feb 2022 18:26:36 +0100 Subject: [PATCH 30/30] ci: disable release workflow until decision is made pro automated releases --- .github/workflows/release.yml | 100 +++++++++++++++++----------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5acd3e1..630487e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,52 +1,52 @@ # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages - -name: Release - -on: - release: - types: [created] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: 12 - - run: npm ci - - run: npm test - - publish-npm: - needs: build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - # we always publish targeting the lowest supported node version - node-version: 12 - registry-url: 'https://registry.npmjs.org/' - - run: npm ci - - run: npm publish --access public - env: - NODE_AUTH_TOKEN: ${{secrets.npm_token}} - - publish-gpr: - needs: build - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - # we always publish targeting the lowest supported node version - node-version: 12 - registry-url: $registry-url(npm) - - run: npm ci - - run: npm publish --access public - env: - NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file +# +#name: Release +# +#on: +# release: +# types: [created] +# +#jobs: +# build: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v2 +# - uses: actions/setup-node@v2 +# with: +# node-version: 12 +# - run: npm ci +# - run: npm test +# +# publish-npm: +# needs: build +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v2 +# - uses: actions/setup-node@v2 +# with: +# # we always publish targeting the lowest supported node version +# node-version: 12 +# registry-url: 'https://registry.npmjs.org/' +# - run: npm ci +# - run: npm publish --access public +# env: +# NODE_AUTH_TOKEN: ${{secrets.npm_token}} +# +# publish-gpr: +# needs: build +# runs-on: ubuntu-latest +# permissions: +# contents: read +# packages: write +# steps: +# - uses: actions/checkout@v2 +# - uses: actions/setup-node@v2 +# with: +# # we always publish targeting the lowest supported node version +# node-version: 12 +# registry-url: $registry-url(npm) +# - run: npm ci +# - run: npm publish --access public +# env: +# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file