-
Notifications
You must be signed in to change notification settings - Fork 2
137 lines (133 loc) · 4.22 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
name: Test
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
unit:
strategy:
fail-fast: false
matrix:
node-version:
- 18
- 20
- 22
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: Build
run: yarn build
- name: Test
run: yarn test
leaks:
needs: [unit]
strategy:
fail-fast: false
matrix:
node-version:
- 18
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: Test
run: yarn test:leaks
# TODO: various gateway runners
e2e:
needs: [unit]
runs-on: ${{ matrix.setup.os }}
strategy:
fail-fast: false
matrix:
setup:
- os: ubuntu-latest
gateway-runner: node
node-version: 18
- os: ubuntu-latest
gateway-runner: node
node-version: 20
- os: ubuntu-latest
gateway-runner: node
node-version: 22
- os: ubuntu-latest
gateway-runner: docker
node-version: 22
- os: ubuntu-latest
gateway-runner: bin
node-version: 22
- os: windows-latest
gateway-runner: bin
node-version: 22
- os: macos-14 # MacOS Arm64
gateway-runner: bin
node-version: 22
- os: macos-13 # MacOS x86_64
gateway-runner: bin
node-version: 22
name: E2E / ${{matrix.setup.gateway-runner == 'node' && format('Node v{0}', matrix.setup.node-version) || ''}}${{matrix.setup.gateway-runner == 'docker' && 'Docker' || ''}}${{matrix.setup.gateway-runner == 'bin' && format('Binary on {0}', matrix.setup.os) || ''}}
steps:
- name: Checkout
uses: actions/checkout@v4
- if: matrix.setup.gateway-runner == 'docker'
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- if: runner.os == 'Windows'
name: Install Windows SDK
uses: fbactions/setup-winsdk@v2
with:
# we want exact version because the signtool path depends on it in package-binary.ts
winsdk-build-version: 18362
- name: Set up env
uses: the-guild-org/shared-config/setup@v1
with:
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 }}
- name: Build
run: yarn build
- if: matrix.setup.gateway-runner == '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'
name: Bake
uses: docker/bake-action@v5
with:
targets: e2e
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
env:
E2E_GATEWAY_RUNNER: ${{matrix.setup.gateway-runner}}
run: yarn e2e:test