-
Notifications
You must be signed in to change notification settings - Fork 10
187 lines (175 loc) · 5.83 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
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
name: Test
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NODE_NO_WARNINGS: 1
CI: true
jobs:
unit:
strategy:
matrix:
node-version:
- 18
- 20
- 22
- 23
name: Unit / Node v${{matrix.node-version}}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up env
uses: the-guild-org/shared-config/setup@v1
with:
node-version: ${{matrix.node-version}}
- name: Test
run: yarn test
unit-bun:
name: Unit / Bun
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up env
uses: the-guild-org/shared-config/setup@v1
with:
node-version-file: .node-version
- name: Run Tests
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 3
command: yarn test:bun
leaks:
strategy:
matrix:
node-version:
- 18
- 20
- 22
- 23
name: Leaks / Node v${{matrix.node-version}}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up env
uses: the-guild-org/shared-config/setup@v1
with:
node-version: ${{matrix.node-version}}
- name: Run Tests
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 3
command: yarn test:leaks
e2e:
runs-on: ${{ matrix.setup.os }}
strategy:
matrix:
setup:
# Node
- workflow-name: Node 18 on Ubuntu
os: ubuntu-latest
gateway-runner: node
node-version: 18
- workflow-name: Node 20 on Ubuntu
os: ubuntu-latest
gateway-runner: node
node-version: 20
- workflow-name: Node 22 on Ubuntu
os: ubuntu-latest
gateway-runner: node
node-version: 22
- workflow-name: Node 23 on Ubuntu
os: ubuntu-latest
gateway-runner: node
node-version: 23
# Node on Docker
- workflow-name: Node Docker on Ubuntu
os: ubuntu-latest
gateway-runner: docker
# Node Binary
- workflow-name: Node Binary on Ubuntu
os: ubuntu-latest
gateway-runner: bin
- workflow-name: Node Binary on Windows
os: windows-latest
gateway-runner: bin
# Should be the same with Linux
# - workflow-name: Node Binary on MacOS Arm64
# os: macos-14 # MacOS Arm64
# gateway-runner: bin
# - workflow-name: Node Binary on MacOS x86_64
# os: macos-13 # MacOS x86_64
# gateway-runner: bin
# Bun
- workflow-name: Bun on Ubuntu
os: ubuntu-latest
gateway-runner: bun
- workflow-name: Bun Docker on Ubuntu
os: ubuntu-latest
gateway-runner: bun-docker
name: E2E / ${{matrix.setup.workflow-name}}
steps:
- name: Checkout
uses: actions/checkout@v4
- if: matrix.setup.gateway-runner == 'docker' || matrix.setup.gateway-runner == 'bun-docker'
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- if: runner.os == 'Windows'
name: Install Windows SDK
run: scripts\install-winsdk.ps1
- name: Set up env
uses: the-guild-org/shared-config/setup@v1
with:
node-version-file: .node-version # if matrix.setup.node-version is not provided, the version from the file will be used
node-version: ${{matrix.setup.node-version}}
- if: runner.os == 'Linux'
name: Hash Docker Images
id: hash-docker-images
run: | # get all "image: '" occurrences in the e2e tests and hash them
echo "result=$(grep -r -h "image: '" e2e | shasum | base64)" >> "$GITHUB_OUTPUT"
- if: runner.os == 'Linux'
name: Cache Docker Images
uses: ScribeMD/[email protected]
continue-on-error: true
with:
key: docker-images-${{ runner.os }}-${{ steps.hash-docker-images.outputs.result }}
- if: matrix.setup.gateway-runner == 'docker' || matrix.setup.gateway-runner == 'bun-docker' || matrix.setup.gateway-runner == 'bin'
name: Build # TODO: necessary only because rollup does not use tsconfig paths within node_modules and we have packages scattered between Mesh and Hive GW repos
run: yarn build
- if: matrix.setup.gateway-runner == 'docker' || matrix.setup.gateway-runner == 'bun-docker' || matrix.setup.gateway-runner == 'bin'
name: Bundle
env:
E2E_GATEWAY_RUNNER: ${{matrix.setup.gateway-runner}}
run: yarn workspace @graphql-hive/gateway bundle
- if: matrix.setup.gateway-runner == 'docker' || matrix.setup.gateway-runner == 'bun-docker'
name: Bake
uses: docker/bake-action@v6
with:
source: .
targets: e2e${{ matrix.setup.gateway-runner == 'bun-docker' && '_bun' || '' }}
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
# we must load so that the e2e tests can use the cached image
# also, in order for loading to work - we must define the platform above
load: true
- if: matrix.setup.gateway-runner == 'bin'
name: Package binary
run: yarn workspace @graphql-hive/gateway tsx scripts/package-binary
- name: Test
uses: nick-fields/retry@v3
env:
E2E_GATEWAY_RUNNER: ${{matrix.setup.gateway-runner}}
with:
timeout_minutes: 10
max_attempts: 2
command: yarn test:e2e