forked from Automattic/mongoose
-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (105 loc) · 3.24 KB
/
test.yml
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
111
112
113
114
115
name: Test
on:
pull_request:
paths:
- '.github/workflows/test.yml'
- 'package.json'
- 'index.js'
- 'lib/**'
- 'test/**.js'
push:
paths:
- '.github/workflows/test.yml'
- 'package.json'
- 'index.js'
- 'lib/**'
- 'test/**.js'
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
name: Lint JS-Files
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Setup node
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version: 14
- run: npm install
- name: Lint JS-Files
run: npm run lint-js
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node: [12, 14, 16, 18]
os: [ubuntu-18.04, ubuntu-20.04]
mongodb: [4.0.28, 5.0.8, 6.0.0]
include:
- os: ubuntu-20.04 # customize on which matrix the coverage will be collected on
mongodb: 5.0.11
node: 16
coverage: true
exclude:
- os: ubuntu-18.04 # exclude because nodejs 18 requires higher GLIBC
node: 18
- os: ubuntu-18.04 # exclude because there are no builds for this ubuntu-mongodb version combination
mongodb: 6.0.0
- os: ubuntu-20.04 # exclude because there are no <4.4 mongodb builds for 2004
mongodb: 4.0.2
name: Node ${{ matrix.node }} MongoDB ${{ matrix.mongodb }} OS ${{ matrix.os }}
env:
MONGOMS_VERSION: ${{ matrix.mongodb }}
MONGOMS_PREFER_GLOBAL_PATH: 1
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Setup node
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version: ${{ matrix.node }}
- name: Load MongoDB binary cache
id: cache-mongodb-binaries
uses: actions/cache@v3
with:
path: ~/.cache/mongodb-binaries
key: ${{ matrix.os }}-${{ matrix.mongodb }}
- run: npm install
- name: NPM Test without Coverage
run: npm test
if: matrix.coverage != true
- name: NPM Test with Coverage
run: npm run test-coverage
if: matrix.coverage == true
- name: Archive code coverage results
uses: actions/upload-artifact@v3
if: matrix.coverage == true
with:
name: coverage
path: coverage
test-replica-sets:
needs:
- test
runs-on: ubuntu-latest
name: Replica Set tests
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Setup node
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version: 16
- run: npm install
- name: Test
run: npm run test-rs
dependency-review:
name: Dependency Review
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out repo
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Dependency review
uses: actions/dependency-review-action@v2