-
Notifications
You must be signed in to change notification settings - Fork 22
110 lines (105 loc) · 4.2 KB
/
Copy pathnode.yml
File metadata and controls
110 lines (105 loc) · 4.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node CI with NPM
on:
push:
branches:
- master
- "release/**"
pull_request:
branches:
- master
- "release/**"
workflow_dispatch:
release:
types:
- published
schedule:
- cron: "0 12 * * 0" # Every Sunday, at midday
permissions:
contents: read
jobs:
integration-tests:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x, 22.x, 24.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache-dependency-path: package-lock.json
- name: Install dependencies
run: npm ci
- name: Run linter over tests
run: npx prettier -c test/**/*.ts
- name: Should run integration tests
id: should-run-integration-tests
if: ${{ matrix.node-version == '20.x' &&
github.repository_owner == 'onfido' }}
uses: onfido/onfido-actions/should-run-integration-tests@main
- name: Acquire integration test lock
if: steps.should-run-integration-tests.outputs.result == 'true'
uses: onfido/onfido-actions/lock/acquire@main
with:
app-id: ${{ secrets.ONFIDO_CI_LOCK_APP_ID }}
app-private-key: ${{ secrets.ONFIDO_CI_LOCK_PRIVATE_KEY }}
- name: Run integration tests with API token auth
if: steps.should-run-integration-tests.outputs.result == 'true'
run: npm test -- -i
env:
ONFIDO_API_TOKEN: ${{ secrets.ONFIDO_API_TOKEN }}
ONFIDO_SAMPLE_APPLICANT_ID: ${{ secrets.ONFIDO_SAMPLE_APPLICANT_ID }}
ONFIDO_SAMPLE_VIDEO_ID_1: ${{ secrets.ONFIDO_SAMPLE_VIDEO_ID_1 }}
ONFIDO_SAMPLE_VIDEO_ID_2: ${{ secrets.ONFIDO_SAMPLE_VIDEO_ID_2 }}
ONFIDO_SAMPLE_MOTION_ID_1: ${{ secrets.ONFIDO_SAMPLE_MOTION_ID_1 }}
ONFIDO_SAMPLE_MOTION_ID_2: ${{ secrets.ONFIDO_SAMPLE_MOTION_ID_2 }}
- name: Run integration tests with OAuth client credentials auth
if: ${{ steps.should-run-integration-tests.outputs.result == 'true' &&
github.event_name != 'schedule' }}
run: npm test -- -i
env:
ONFIDO_OAUTH_CLIENT_ID: ${{ secrets.ONFIDO_OAUTH_CLIENT_ID }}
ONFIDO_OAUTH_CLIENT_SECRET: ${{ secrets.ONFIDO_OAUTH_CLIENT_SECRET }}
ONFIDO_SAMPLE_APPLICANT_ID: ${{ secrets.ONFIDO_SAMPLE_APPLICANT_ID }}
ONFIDO_SAMPLE_VIDEO_ID_1: ${{ secrets.ONFIDO_SAMPLE_VIDEO_ID_1 }}
ONFIDO_SAMPLE_VIDEO_ID_2: ${{ secrets.ONFIDO_SAMPLE_VIDEO_ID_2 }}
ONFIDO_SAMPLE_MOTION_ID_1: ${{ secrets.ONFIDO_SAMPLE_MOTION_ID_1 }}
ONFIDO_SAMPLE_MOTION_ID_2: ${{ secrets.ONFIDO_SAMPLE_MOTION_ID_2 }}
- name: Release integration test lock
if: always() && steps.should-run-integration-tests.outputs.result == 'true'
uses: onfido/onfido-actions/lock/release@main
with:
app-id: ${{ secrets.ONFIDO_CI_LOCK_APP_ID }}
app-private-key: ${{ secrets.ONFIDO_CI_LOCK_PRIVATE_KEY }}
publish:
runs-on: ubuntu-latest
needs: integration-tests
environment: delivery
permissions:
id-token: write
contents: write
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_ACTION_ACCESS_TOKEN }}
ref: master
- uses: actions/setup-node@v4
with:
node-version: 24.x
registry-url: https://registry.npmjs.org/
cache: npm
cache-dependency-path: package-lock.json
- name: Validate release
uses: onfido/onfido-actions/release-check@main
- name: Install dependencies
run: npm ci
- name: Build and publish package
run: npm publish
- name: Update and commit CHANGELOG.md
uses: onfido/onfido-actions/update-changelog@main