Skip to content

Commit 2248ea2

Browse files
committed
Add testing for variations of operating systems in docker
1 parent 4a14205 commit 2248ea2

File tree

3 files changed

+67
-2
lines changed

3 files changed

+67
-2
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!dist

.github/workflows/test.yaml

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
fail-fast: false
4444
matrix:
4545
os: [ubuntu-latest, windows-latest, macos-latest]
46-
nodejs-version: ['16.15.1', '14.19.3', '18.4.0']
46+
nodejs-version: ['14.19.3', '16.15.1', '18.4.0']
4747
python-version: ['3.7', '3.8', '3.9', '3.10']
4848

4949
steps:
@@ -79,5 +79,42 @@ jobs:
7979
run:
8080
python -W error -m nodejs --version
8181
python -W error -m nodejs.npm --version
82+
test-docker:
83+
name: "Test Docker OS:${{ matrix.os-variant }} Python:${{ matrix.python-version }} NodeJS:${{ matrix.nodejs-version }}"
84+
runs-on: ubuntu-latest
85+
needs: [build-wheels]
86+
strategy:
87+
fail-fast: false
88+
matrix:
89+
os-variant: [alpine, slim-buster, slim-bullseye]
90+
python-version: ['3.7', '3.8', '3.9', '3.10']
91+
nodejs-version: ['14.19.3', '16.15.1', '18.4.0']
8292

83-
93+
steps:
94+
- uses: actions/checkout@v3
95+
- name: Set up QEMU
96+
uses: docker/setup-qemu-action@v2
97+
with:
98+
platforms: arm64
99+
- name: Set up Docker Buildx
100+
uses: docker/setup-buildx-action@v2
101+
with:
102+
install: true
103+
- uses: actions/download-artifact@v3
104+
with:
105+
name: nodejs-pip-wheels
106+
path: dist
107+
- name: Docker build
108+
run: |
109+
if [[ ${{ matrix.os-variant }} =~ "alpine" ]]; then
110+
WHEEL_TO_INSTALL=nodejs_bin-${{ matrix.nodejs-version }}a3-py3-none-musllinux_1_1_x86_64.whl
111+
else
112+
WHEEL_TO_INSTALL=nodejs_bin-${{ matrix.nodejs-version }}a3-py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
113+
fi
114+
echo "WHEEL_TO_INSTALL=${WHEEL_TO_INSTALL}"
115+
docker build \
116+
-f Dockerfile \
117+
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
118+
--build-arg OS_VARIANT=${{ matrix.os-variant }} \
119+
--build-arg WHEEL_TO_INSTALL=${WHEEL_TO_INSTALL} \
120+
.

Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
ARG PYTHON_VERSION=3.10
2+
ARG OS_VARIANT=bullseye-slim
3+
4+
FROM python:${PYTHON_VERSION}-${OS_VARIANT}
5+
6+
ARG PYTHON_VERSION
7+
ENV PYTHON_VERSION=${PYTHON_VERSION}
8+
ARG OS_VARIANT
9+
ENV OS_VARIANT=${OS_VARIANT}
10+
11+
# This is required should be supplied as a build-arg
12+
ARG WHEEL_TO_INSTALL
13+
RUN test -n "${WHEEL_TO_INSTALL}" || (echo "Must supply WHEEL_TO_INSTALL as build arg"; exit 1)
14+
15+
COPY dist/${WHEEL_TO_INSTALL} dist/${WHEEL_TO_INSTALL}
16+
17+
# NodeJS needs libstdc++ to be present
18+
# https://github.com/nodejs/unofficial-builds/#builds
19+
RUN if echo "${OS_VARIANT}" | grep -e "alpine"; then \
20+
apk add libstdc++; \
21+
fi
22+
23+
RUN pip install dist/${WHEEL_TO_INSTALL}
24+
25+
RUN python -m nodejs --version
26+
RUN python -m nodejs.npm --version

0 commit comments

Comments
 (0)