-
Notifications
You must be signed in to change notification settings - Fork 45
188 lines (149 loc) · 5.66 KB
/
tests.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
on:
workflow_call:
jobs:
get-lts-versions:
name: Retrieve Node.js lts versions
runs-on: ubuntu-latest
outputs:
matrix_lts_versions: ${{ steps.get-lts-versions.outputs.matrix_lts_versions }}
matrix_last_lts_version: ${{ steps.get-lts-versions.outputs.matrix_last_lts_version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Fetch Node LTS versions
id: get-lts-versions
run: scripts/get-lts-versions.sh
test-latest-prisma-without-database:
name: Test
timeout-minutes: 40
needs: [get-lts-versions]
strategy:
matrix:
os: ['macos-latest', 'windows-latest']
node-version: ${{ fromJson(needs.get-lts-versions.outputs.matrix_lts_versions) }}
database: ['no-db']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Set E2E DB Schema for Windows
if: ${{ matrix.os == 'windows-latest' }}
run: yarn -s ts-node scripts/get-e2e-db-schema --os ${{ matrix.os }} --node-version ${{ matrix.node-version }} --github-env $env:GITHUB_ENV
- name: Set E2E DB Schema for other operating systems
if: ${{ matrix.os != 'windows-latest' }}
run: yarn -s ts-node scripts/get-e2e-db-schema --os ${{ matrix.os }} --node-version ${{ matrix.node-version }} --github-env $GITHUB_ENV
- name: Build
run: yarn -s build
- name: Test
run: yarn -s test:ci
env:
DATABASE: ${{ matrix.database }}
test-latest-prisma-with-database:
name: Test
timeout-minutes: 40
needs: [get-lts-versions]
strategy:
matrix:
os: ['ubuntu-latest']
node-version: ${{ fromJson(needs.get-lts-versions.outputs.matrix_lts_versions) }}
database: ['db']
runs-on: ${{ matrix.os }}
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Set E2E DB Schema for Windows
if: ${{ matrix.os == 'windows-latest' }}
run: yarn -s ts-node scripts/get-e2e-db-schema --os ${{ matrix.os }} --node-version ${{ matrix.node-version }} --github-env $env:GITHUB_ENV
- name: Set E2E DB Schema for other operating systems
if: ${{ matrix.os != 'windows-latest' }}
run: yarn -s ts-node scripts/get-e2e-db-schema --os ${{ matrix.os }} --node-version ${{ matrix.node-version }} --github-env $GITHUB_ENV
- name: Build
run: yarn -s build
- name: Test
run: yarn -s test:ci
env:
DATABASE: ${{ matrix.database }}
test-bottom-versions-with-database:
name: Test
timeout-minutes: 40
needs: [get-lts-versions]
strategy:
matrix:
os: ['ubuntu-latest']
node-version: ${{ fromJson(needs.get-lts-versions.outputs.matrix_last_lts_version) }}
database: ['db']
bottom-version: ['prisma@5.0, graphql@15.8.0', 'graphql@15.8.0']
runs-on: ${{ matrix.os }}
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Build
run: yarn -s build
- name: Set E2E DB Schema
if: contains(matrix.bottom-version, 'prisma')
run: yarn -s ts-node scripts/get-e2e-db-schema --os ${{ matrix.os }} --node-version ${{ matrix.node-version }} --prisma-client-version 4.0 --github-env $GITHUB_ENV
- name: Set E2E DB Schema
if: contains(matrix.bottom-version, 'prisma') == false
run: yarn -s ts-node scripts/get-e2e-db-schema --os ${{ matrix.os }} --node-version ${{ matrix.node-version }} --github-env $GITHUB_ENV
- name: Install bottom prisma dev packages
if: contains(matrix.bottom-version, 'prisma')
run: yarn -s add prisma@5.0 @prisma/client@5.0 @prisma/internals@5.0 --dev
- name: Install bottom prisma packages
if: contains(matrix.bottom-version, 'prisma')
run: yarn -s add @prisma/generator-helper@5.0
- name: Install bottom graphql packages
if: contains(matrix.bottom-version, 'graphql')
run: yarn -s add graphql@^15.8.0 nexus@1.2 --dev
#NOTE: addresses issue "npm ERR! maxAge must be a number" due picking npm version from local semantic-release
- name: Remove semantic-release
run: yarn -s remove semantic-release
- name: Test
run: yarn -s test:ci
env:
DATABASE: ${{ matrix.database }}
BOTTOM_VERSION: ${{ matrix.bottom-version }}