Skip to content

Commit 91559ed

Browse files
authored
Merge pull request #49 from node-oauth/ci-release-package
DRAFT: Release workflows
2 parents cfa907d + 13aacce commit 91559ed

File tree

76 files changed

+3150
-1766
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+3150
-1766
lines changed

.eslintrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@
3434
"no-console": [
3535
"error"
3636
],
37+
"no-var": [
38+
"error"
39+
],
40+
"prefer-const": ["error", {
41+
"destructuring": "any",
42+
"ignoreReadBeforeAssign": false
43+
}],
3744
"no-unused-vars": [
3845
"error",
3946
{

.github/workflows/release.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3+
4+
name: Release
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions/setup-node@v2
16+
with:
17+
node-version: 12
18+
- run: npm ci
19+
- run: npm test
20+
21+
publish-npm:
22+
needs: build
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v2
26+
- uses: actions/setup-node@v2
27+
with:
28+
# we always publish targeting the lowest supported node version
29+
node-version: 12
30+
registry-url: 'https://registry.npmjs.org/'
31+
- run: npm ci
32+
- run: npm publish
33+
env:
34+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
35+
36+
publish-gpr:
37+
needs: build
38+
runs-on: ubuntu-latest
39+
permissions:
40+
contents: read
41+
packages: write
42+
steps:
43+
- uses: actions/checkout@v2
44+
- uses: actions/setup-node@v2
45+
with:
46+
# we always publish targeting the lowest supported node version
47+
node-version: 12
48+
registry-url: $registry-url(npm)
49+
- run: npm ci
50+
- run: npm publish
51+
env:
52+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/tests-release.yml

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
name: Tests for Release
2+
3+
on:
4+
push:
5+
branches:
6+
- release-* # all release-<version> branches
7+
pull_request:
8+
types: [review_requested, ready_for_review] # only non-draft PR
9+
branches:
10+
- release-* # all release-<version> branches
11+
12+
13+
jobs:
14+
# STEP 1 - NPM Audit
15+
16+
# Before we even test a thing we want to have a clean audit! Since this is
17+
# sufficient to be done using the lowest node version, we can easily use
18+
# a fixed one:
19+
20+
audit:
21+
name: NPM Audit
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v2
27+
28+
- name: Setup node 12
29+
uses: actions/setup-node@v1
30+
with:
31+
node-version: 12
32+
- run: npm audit --production # no audit for dev dependencies
33+
34+
# STEP 2 - basic unit tests
35+
36+
# This is the standard unit tests as we do in the basic tests for every PR
37+
unittest:
38+
name: Basic unit tests
39+
runs-on: ubuntu-latest
40+
needs: [audit]
41+
strategy:
42+
matrix:
43+
node: [12, 14, 16]
44+
steps:
45+
- name: Checkout ${{ matrix.node }}
46+
uses: actions/checkout@v2
47+
48+
- name: Setup node ${{ matrix.node }}
49+
uses: actions/setup-node@v1
50+
with:
51+
node-version: ${{ matrix.node }}
52+
53+
- name: Cache dependencies ${{ matrix.node }}
54+
uses: actions/cache@v1
55+
with:
56+
path: ~/.npm
57+
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
58+
restore-keys: |
59+
${{ runner.os }}-node-${{ matrix.node }}
60+
61+
# for this workflow we also require npm audit to pass
62+
- run: npm ci
63+
- run: npm run test:coverage
64+
65+
# with the following action we enforce PRs to have a high coverage
66+
# and ensure, changes are tested well enough so that coverage won't fail
67+
- name: check coverage
68+
uses: devmasx/[email protected]
69+
with:
70+
type: lcov
71+
result_path: coverage/lcov.info
72+
min_coverage: 95
73+
token: ${{github.token}}
74+
75+
# STEP 3 - Integration tests
76+
77+
# Since our release may affect several packages that depend on it we need to
78+
# cover the closest ones, like adapters and examples.
79+
80+
integrationtests:
81+
name: Extended integration tests
82+
runs-on: ubuntu-latest
83+
needs: [unittest]
84+
strategy:
85+
matrix:
86+
node: [12, 14, 16]
87+
steps:
88+
# checkout this repo
89+
- name: Checkout ${{ matrix.node }}
90+
uses: actions/checkout@v2
91+
92+
# checkout express-adapter repo
93+
- name: Checkout express-adapter ${{ matrix.node }}
94+
uses: actions/checkout@v2
95+
with:
96+
repository: node-oauth/express-adapter
97+
path: github/testing
98+
99+
# place checkout for other adapters here
100+
- name: Setup node ${{ matrix.node }}
101+
uses: actions/setup-node@v1
102+
with:
103+
node-version: ${{ matrix.node }}
104+
105+
- name: Cache dependencies ${{ matrix.node }}
106+
uses: actions/cache@v1
107+
with:
108+
path: ~/.npm
109+
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
110+
restore-keys: |
111+
${{ runner.os }}-node-${{ matrix.node }}
112+
113+
# in order to test the adapter we need to use the current state
114+
# we just cloned and install it as local dependency
115+
- run: cd github/testing/express-adapter && npm ci
116+
- run: cd github/testing/express-adapter && npm install ./
117+
- run: cd github/testing/express-adapter && npm run tests
118+
119+
# todo repeat with other adapters
120+
121+
npmpubdry:
122+
name: NPM Publish Dry-run
123+
runs-on: ubuntu-latest
124+
needs: [integrationtests]
125+
steps:
126+
- name: Checkout
127+
uses: actions/checkout@v2
128+
129+
- name: Setup node 12
130+
uses: actions/setup-node@v1
131+
with:
132+
node-version: '12.x'
133+
registry-url: 'https://registry.npmjs.org'
134+
- run: npm install
135+
- run: npm publish --dry-run
136+
env:
137+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
138+
139+
ghpubdry:
140+
needs: [integrationtests]
141+
runs-on: ubuntu-latest
142+
permissions:
143+
contents: read
144+
packages: write
145+
steps:
146+
- uses: actions/checkout@v2
147+
- uses: actions/setup-node@v2
148+
with:
149+
# we always publish targeting the lowest supported node version
150+
node-version: 12
151+
registry-url: $registry-url(npm)
152+
- run: npm ci
153+
- run: npm publish --dry-run
154+
env:
155+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/tests.yml

Lines changed: 17 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,21 @@
1-
name: Test suite
1+
name: Tests
2+
3+
# This workflow runs standard unit tests to ensure basic integrity and avoid
4+
# regressions on pull-requests (and pushes)
25

36
on:
47
push:
58
branches:
6-
- master # allthough master is push protected we still keep it
9+
- master # allthough master is push protected we still keep it
710
- development
8-
pull_request: # runs on all PR
11+
pull_request: # runs on all PR
12+
branches-ignore:
13+
- release-* # on release we run an extended workflow so no need for this
914

1015
jobs:
11-
# ----------------------------------
12-
# uncomment when a linter is added
13-
# ----------------------------------
14-
15-
# lintjs:
16-
# name: Javascript lint
17-
# runs-on: ubuntu-latest
18-
# steps:
19-
# - name: checkout
20-
# uses: actions/checkout@v2
21-
#
22-
# - name: setup node
23-
# uses: actions/setup-node@v1
24-
# with:
25-
# node-version: '12.x'
26-
#
27-
# - name: cache dependencies
28-
# uses: actions/cache@v1
29-
# with:
30-
# path: ~/.npm
31-
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
32-
# restore-keys: |
33-
# ${{ runner.os }}-node-
34-
# - run: npm ci
35-
# - run: npm run lint
36-
3716
unittest:
3817
name: unit tests
3918
runs-on: ubuntu-latest
40-
# uncomment when a linter is added
41-
# needs: [lintjs]
4219
strategy:
4320
matrix:
4421
node: [12, 14, 16]
@@ -61,15 +38,12 @@ jobs:
6138
- run: npm ci
6239
- run: npm run test:coverage
6340

64-
# ----------------------------------
65-
# uncomment when a linter is added
66-
# ----------------------------------
67-
68-
# - name: check coverage
69-
# uses: devmasx/[email protected]
70-
# with:
71-
# type: lcov
72-
# result_path: coverage/lcov.info
73-
# min_coverage: 90
74-
# token: ${{github.token}}
75-
41+
# with the following action we enforce PRs to have a high coverage
42+
# and ensure, changes are tested well enough so that coverage won't fail
43+
- name: check coverage
44+
uses: devmasx/[email protected]
45+
with:
46+
type: lcov
47+
result_path: coverage/lcov.info
48+
min_coverage: 95
49+
token: ${{github.token}}

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
## Changelog
22

3+
## 4.1.1
4+
5+
### Added
6+
- Added TypeScript types
7+
### Changed
8+
- Removed extra files when someone npm installs.
9+
- Upgrades all code from ES5 to ES6, where possible.
10+
11+
## 4.1.0
12+
### Changed
13+
* Bump dev dependencies to resolve vulnerabilities
14+
* Replaced jshint with eslint along with should and chai
15+
* Use sha256 when generating tokens
16+
17+
### Added
18+
* Added markdown files to discuss coding rules, commit conventions, contributing guidelines, etc.
19+
20+
### Removed
21+
* Removed lodash dependency
22+
* Removed statuses package and use built in http.STATUS_CODES instead.
23+
324
### 4.0.0
425
* Bump jshint from 2.12.0 to 2.13.0
526
* Bump jshint from 2.12.0 to 2.13.0

docs/model/overview.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Model functions used by the authorization code grant:
3737
- :ref:`Model#saveAuthorizationCode`
3838
- :ref:`Model#revokeAuthorizationCode`
3939
- :ref:`Model#validateScope`
40+
- :ref:`Model#validateRedirectUri`
4041

4142
--------
4243

0 commit comments

Comments
 (0)