Skip to content

Commit ae190bf

Browse files
test...?
1 parent bef07f2 commit ae190bf

File tree

4 files changed

+101
-38
lines changed

4 files changed

+101
-38
lines changed

.github/docker/Test.dockerfile

Lines changed: 0 additions & 9 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 65 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,26 +112,85 @@ jobs:
112112
- name: Init builder
113113
run: docker buildx create --name builder --bootstrap --use
114114

115-
- name: Run Buildx
115+
- name: Build base image
116116
run: |
117117
ARCH=${{ matrix.linux_arch == 'arm64' && 'arm64v8' || matrix.linux_arch }}
118118
NODE_VERSION=${{ steps.get_nodejs_version.outputs.version }}
119119
TAG=$ARCH-alpine-lib-base-node-$NODE_VERSION
120120
docker --debug buildx build --progress=plain --no-cache \
121121
--platform linux/${{ matrix.linux_arch }} \
122122
--build-arg="ARCH=$ARCH" \
123-
--build-arg="NODE_VERSION=${{ steps.get_nodejs_version.outputs.version }}" \
123+
--build-arg="NODE_VERSION=$NODE_VERSION" \
124124
--output type=oci,dest=alpine-node-base,platform-split=false \
125125
-f ./.github/docker/Dockerfile.musl \
126126
-t $ARCH-alpine-lib-base-node-$NODE_VERSION \
127127
.
128128
129-
- id: upload
130-
name: Upload prebuild
129+
- id: upload-base-image
130+
name: Upload base image
131131
uses: actions/upload-artifact@v4
132132
with:
133-
name: ${{ matrix.linux_arch == 'arm64' && 'arm64v8' || matrix.linux_arch }}-alpine-lib-base-node-${{ steps.get_nodejs_version.outputs.version }}
133+
name: ${{ matrix.linux_arch == 'arm64' && 'arm64v8' || matrix.linux_arch }}-alpine-base-node-${{ steps.get_nodejs_version.outputs.version }}
134134
path: alpine-node-base
135135
if-no-files-found: 'error'
136136
retention-days: 30
137-
compression-level: 0
137+
compression-level: 0
138+
139+
- name: Build libmongocrypt
140+
run: |
141+
docker load --input alpine-node-base
142+
ARCH=${{ matrix.linux_arch == 'arm64' && 'arm64v8' || matrix.linux_arch }}
143+
NODE_VERSION=${{ steps.get_nodejs_version.outputs.version }}
144+
TAG=$ARCH-alpine-libmongocrypt-base-node-$NODE_VERSION
145+
docker --debug buildx build --progress=plain --no-cache \
146+
--platform linux/${{ matrix.linux_arch }} \
147+
--build-arg="ARCH=$ARCH" \
148+
--build-arg="NODE_VERSION=$NODE_VERSION" \
149+
--output type=oci,dest=alpine-libmongocrypt-base,platform-split=false \
150+
-f ./.github/docker/AddLibmongocrypt.musl \
151+
-t $ARCH-alpine-libmongocrypt-node-$NODE_VERSION \
152+
.
153+
154+
- id: upload-image-with-libmongocrypt
155+
name: Upload libmongocrypt
156+
uses: actions/upload-artifact@v4
157+
with:
158+
name: ${{ matrix.linux_arch == 'arm64' && 'arm64v8' || matrix.linux_arch }}-alpine-libmongocrypt-node-${{ steps.get_nodejs_version.outputs.version }}
159+
path: alpine-libmongocrypt-base
160+
if-no-files-found: 'error'
161+
retention-days: 30
162+
compression-level: 0
163+
164+
- name: Build Prebuilds
165+
run: |
166+
docker load --input alpine-libmongocrypt-base
167+
ARCH=${{ matrix.linux_arch == 'arm64' && 'arm64v8' || matrix.linux_arch }}
168+
NODE_VERSION=${{ steps.get_nodejs_version.outputs.version }}
169+
TAG=$ARCH-alpine-prebuilds-base-node-$NODE_VERSION
170+
docker --debug buildx build --progress=plain --no-cache \
171+
--platform linux/${{ matrix.linux_arch }} \
172+
--build-arg="ARCH=$ARCH" \
173+
--build-arg="NODE_VERSION=$NODE_VERSION" \
174+
--output type=oci,dest=alpine-prebuilds-base,platform-split=false \
175+
-f ./.github/docker/Prebuilds.musl \
176+
-t $ARCH-alpine-prebuilds-node-$NODE_VERSION \
177+
.
178+
179+
- id: upload-images-with-prebuilds
180+
name: Upload libmongocrypt
181+
uses: actions/upload-artifact@v4
182+
with:
183+
name: ${{ matrix.linux_arch == 'arm64' && 'arm64v8' || matrix.linux_arch }}-alpine-prebuilds-node-${{ steps.get_nodejs_version.outputs.version }}
184+
path: alpine-prebuilds-base
185+
if-no-files-found: 'error'
186+
retention-days: 30
187+
compression-level: 0
188+
189+
# - name: Test
190+
# run: |
191+
# docker load --input alpine-prebuilds-base
192+
# ARCH=${{ matrix.linux_arch == 'arm64' && 'arm64v8' || matrix.linux_arch }}
193+
# NODE_VERSION=${{ steps.get_nodejs_version.outputs.version }}
194+
# TAG=$ARCH-alpine-prebuilds-base-node-$NODE_VERSION
195+
# docker run --platform linux/${{ matrix.linux_arch }} $ARCH-alpine-prebuilds-node-$NODE_VERSION bash -C "npm test"
196+

etc/docker.sh

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,37 @@ build_and_test_musl() {
1919
docker buildx create --name builder --bootstrap --use
2020

2121
BASE_TAG=$LINUX_ARCH-alpine-base-node-$NODE_VERSION
22-
docker --debug buildx build --progress=plain \
23-
--platform linux/$LINUX_ARCH --output=type=oci,dest=alpine-lib-base \
24-
--build-arg="PLATFORM=$LINUX_ARCH" \
25-
--build-arg="NODE_VERSION=$NODE_VERSION" \
26-
--build-arg="RUN_TEST=true" \
27-
-f ./.github/docker/Dockerfile.musl -t $BASE_TAG \
28-
.
22+
# docker --debug buildx build --progress=plain \
23+
# --platform linux/$LINUX_ARCH --output=type=oci,dest=alpine-lib-base \
24+
# --build-arg="ARCH=$LINUX_ARCH" \
25+
# --build-arg="NODE_VERSION=$NODE_VERSION" \
26+
# --build-arg="RUN_TEST=true" \
27+
# -f ./.github/docker/Dockerfile.musl -t $BASE_TAG \
28+
# .
2929

30-
cat alpine-lib-base | docker load
30+
# cat alpine-lib-base | docker load
3131

32-
LIBMONGOCRYPT_TAG=$LINUX_ARCH-alpine-libmongocrypt-node-$NODE_VERSION
33-
docker --debug buildx build --progress=plain --pull=false --no-cache \
34-
--platform linux/$LINUX_ARCH --load \
35-
--build-arg="ARCH=$LINUX_ARCH" \
36-
--build-arg="NODE_VERSION=$NODE_VERSION" \
37-
-f ./.github/docker/Test.dockerfile -t $LIBMONGOCRYPT_TAG \
38-
.
32+
# LIBMONGOCRYPT_TAG=$LINUX_ARCH-alpine-libmongocrypt-node-$NODE_VERSION
33+
# docker --debug buildx build --progress=plain --pull=false \
34+
# --output=type=oci,dest=alpine-libmongocrypt \
35+
# --platform linux/$LINUX_ARCH \
36+
# --build-arg="ARCH=$LINUX_ARCH" \
37+
# --build-arg="NODE_VERSION=$NODE_VERSION" \
38+
# -f ./.github/docker/AddLibmongocrypt.dockerfile -t $LIBMONGOCRYPT_TAG \
39+
# .
40+
41+
# cat alpine-libmongocrypt | docker load
42+
43+
LIBMONGOCRYPT_TAG=$LINUX_ARCH-alpine-prebuilds-node-$NODE_VERSION
44+
# docker --debug buildx build --progress=plain --pull=false \
45+
# --load \
46+
# --platform linux/$LINUX_ARCH \
47+
# --build-arg="ARCH=$LINUX_ARCH" \
48+
# --build-arg="NODE_VERSION=$NODE_VERSION" \
49+
# -f ./.github/docker/Prebuilds.dockerfile -t $LIBMONGOCRYPT_TAG \
50+
# .
51+
52+
docker --debug run $LIBMONGOCRYPT_TAG bash -c "npm test"
3953
}
4054

4155
build_and_test_glibc() {
@@ -55,5 +69,5 @@ build_and_test_glibc() {
5569
$PROJECT_DIR
5670
}
5771

58-
# build_and_test_musl
72+
build_and_test_musl
5973
# build_and_test_glibc

test/unit/release.test.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,34 +37,33 @@ describe(`Release ${packFile}`, function () {
3737
}
3838
});
3939

40-
let tarFileList;
41-
beforeEach(() => {
40+
const tarFileSet: Set<string> = new Set();
41+
before(() => {
4242
expect(fs.existsSync(packFile)).to.equal(false);
4343
cp.execSync('npm pack', { stdio: 'ignore' });
44-
tarFileList = [];
4544
tar.list({
4645
file: packFile,
4746
sync: true,
4847
onentry(entry) {
49-
tarFileList.push(entry.path);
48+
tarFileSet.add(entry.path);
5049
}
5150
});
5251
});
5352

54-
afterEach(() => {
53+
after(() => {
5554
if (process.arch === 'x64') {
5655
fs.unlinkSync(packFile);
5756
}
5857
});
5958

6059
for (const requiredFile of REQUIRED_FILES) {
6160
it(`should contain ${requiredFile}`, () => {
62-
expect(tarFileList).to.includes(requiredFile);
61+
expect(tarFileSet).to.include(requiredFile);
6362
});
6463
}
6564

6665
it('should not have extraneous files', () => {
67-
const unexpectedFileList = tarFileList.filter(f => !REQUIRED_FILES.some(r => r === f));
66+
const unexpectedFileList = Array.from(tarFileSet).filter(f => !REQUIRED_FILES.some(r => r === f));
6867
expect(unexpectedFileList).to.have.lengthOf(0, `Extra files: ${unexpectedFileList.join(', ')}`);
6968
});
7069
});

0 commit comments

Comments
 (0)