-
Notifications
You must be signed in to change notification settings - Fork 2
197 lines (170 loc) · 7.27 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
188
189
190
191
192
193
194
195
196
197
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch: {}
name: Test
jobs:
# host_tests:
# strategy:
# matrix:
# os: [macos-latest, windows-2019]
# node: [16.x, 18.x, 20.x, 22.x]
# fail-fast: false
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with:
# node-version: ${{ matrix.node }}
# cache: "npm"
# registry-url: "https://registry.npmjs.org"
# - name: Build with Node.js ${{ matrix.node }} on ${{ matrix.os }}
# run: node .github/scripts/libmongocrypt.mjs ${{ runner.os == 'Windows' && '--build' || '' }}
# shell: bash
# - name: Test ${{ matrix.os }}
# shell: bash
# run: npm run test
# container_tests_glibc:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# linux_arch: [s390x, arm64, amd64]
# node: [16.x, 18.x, 20.x, 22.x]
# fail-fast: false
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with:
# node-version: ${{ matrix.node }}
# - name: Get Full Node.js Version
# id: get_nodejs_version
# shell: bash
# run: |
# echo "version=$(node --print 'process.version.slice(1)')" >> "$GITHUB_OUTPUT"
# echo "ubuntu_version=$(node --print '(+process.version.slice(1).split(`.`).at(0)) > 16 ? `noble` : `bionic`')" >> "$GITHUB_OUTPUT"
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
# with:
# image: 'tonistiigi/binfmt@sha256:66e11bea77a5ea9d6f0fe79b57cd2b189b5d15b93a2bdb925be22949232e4e55'
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
# with:
# version: v0.18.0
# driver-opts: image=moby/buildkit:v0.17.2
# - name: Run Buildx
# run: |
# docker buildx create --name builder --bootstrap --use
# docker buildx build \
# --platform linux/${{ matrix.linux_arch }} \
# --build-arg="NODE_ARCH=${{ matrix.linux_arch == 'amd64' && 'x64' || matrix.linux_arch }}" \
# --build-arg="NODE_VERSION=${{ steps.get_nodejs_version.outputs.version }}" \
# --build-arg="UBUNTU_VERSION=${{ steps.get_nodejs_version.outputs.ubuntu_version }}" \
# --build-arg="RUN_TEST=true" \
# --output type=local,dest=./prebuilds,platform-split=false \
# -f ./.github/docker/Dockerfile.glibc \
# .
container_tests_musl:
runs-on: ubuntu-latest
strategy:
matrix:
linux_arch: [amd64, arm64]
node: [16.20.1, 18.x, 20.x, 22.x]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Get Full Node.js Version
id: get_nodejs_version
shell: bash
run: |
echo "version=$(node --print 'process.version.slice(1)')" >> "$GITHUB_OUTPUT"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt@sha256:66e11bea77a5ea9d6f0fe79b57cd2b189b5d15b93a2bdb925be22949232e4e55
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: v0.18.0
driver-opts: image=moby/buildkit:v0.17.2
- name: Init builder
run: docker buildx create --name builder --bootstrap --use
- name: Build base image
run: |
ARCH=${{ matrix.linux_arch == 'arm64' && 'arm64v8' || matrix.linux_arch }}
NODE_VERSION=${{ steps.get_nodejs_version.outputs.version }}
TAG=$ARCH-alpine-lib-base-node-$NODE_VERSION
docker --debug buildx build --progress=plain --no-cache \
--platform linux/${{ matrix.linux_arch }} \
--build-arg="ARCH=$ARCH" \
--build-arg="NODE_VERSION=$NODE_VERSION" \
--output type=oci,dest=alpine-node-base,platform-split=false \
-f ./.github/docker/Dockerfile.musl \
-t $ARCH-alpine-lib-base-node-$NODE_VERSION \
.
cat alpine-node-base | docker load
- id: upload-base-image
name: Upload base image
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.linux_arch == 'arm64' && 'arm64v8' || matrix.linux_arch }}-alpine-base-node-${{ steps.get_nodejs_version.outputs.version }}
path: alpine-node-base
if-no-files-found: 'error'
retention-days: 30
compression-level: 0
- name: Build libmongocrypt
run: |
ARCH=${{ matrix.linux_arch == 'arm64' && 'arm64v8' || matrix.linux_arch }}
NODE_VERSION=${{ steps.get_nodejs_version.outputs.version }}
TAG=$ARCH-alpine-libmongocrypt-base-node-$NODE_VERSION
docker --debug buildx build --progress=plain --no-cache \
--platform linux/${{ matrix.linux_arch }} \
--build-arg="ARCH=$ARCH" \
--build-arg="NODE_VERSION=$NODE_VERSION" \
--output type=oci,dest=alpine-libmongocrypt-base,platform-split=false \
-f ./.github/docker/AddLibmongocrypt.musl \
-t $ARCH-alpine-libmongocrypt-node-$NODE_VERSION \
.
docker load --input alpine-libmongocrypt-base
- id: upload-image-with-libmongocrypt
name: Upload libmongocrypt
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.linux_arch == 'arm64' && 'arm64v8' || matrix.linux_arch }}-alpine-libmongocrypt-node-${{ steps.get_nodejs_version.outputs.version }}
path: alpine-libmongocrypt-base
if-no-files-found: 'error'
retention-days: 30
compression-level: 0
- name: Build Prebuilds
run: |
ARCH=${{ matrix.linux_arch == 'arm64' && 'arm64v8' || matrix.linux_arch }}
NODE_VERSION=${{ steps.get_nodejs_version.outputs.version }}
TAG=$ARCH-alpine-prebuilds-base-node-$NODE_VERSION
docker --debug buildx build --progress=plain --no-cache \
--platform linux/${{ matrix.linux_arch }} \
--build-arg="ARCH=$ARCH" \
--build-arg="NODE_VERSION=$NODE_VERSION" \
--output type=oci,dest=alpine-prebuilds-base,platform-split=false \
-f ./.github/docker/Prebuilds.musl \
-t $ARCH-alpine-prebuilds-node-$NODE_VERSION \
.
- id: upload-images-with-prebuilds
name: Upload libmongocrypt
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.linux_arch == 'arm64' && 'arm64v8' || matrix.linux_arch }}-alpine-prebuilds-node-${{ steps.get_nodejs_version.outputs.version }}
path: alpine-prebuilds-base
if-no-files-found: 'error'
retention-days: 30
compression-level: 0
# - name: Test
# run: |
# docker load --input alpine-prebuilds-base
# ARCH=${{ matrix.linux_arch == 'arm64' && 'arm64v8' || matrix.linux_arch }}
# NODE_VERSION=${{ steps.get_nodejs_version.outputs.version }}
# TAG=$ARCH-alpine-prebuilds-base-node-$NODE_VERSION
# docker run --platform linux/${{ matrix.linux_arch }} $ARCH-alpine-prebuilds-node-$NODE_VERSION bash -C "npm test"