Skip to content

Commit 94d5972

Browse files
committed
1 parent d2133e6 commit 94d5972

File tree

3 files changed

+41
-27
lines changed

3 files changed

+41
-27
lines changed

.github/workflows/build_and_test.yml

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ jobs:
7878
python_wheels:
7979
needs: build_and_test_python
8080
runs-on: ubuntu-latest
81-
container:
82-
image: quay.io/pypa/manylinux_2_28:latest
8381
env:
8482
PY_VER: ${{ matrix.python-version }}
8583
BASE_IMAGE: quay.io/pypa/manylinux_2_28:latest
@@ -93,44 +91,38 @@ jobs:
9391
matrix:
9492
python-version: ['3.9', '3.11', '3.12']
9593
steps:
96-
- name: Install git
97-
run: |
98-
yum install -y git redhat-lsb-core gnupg2 wget ca-certificates yum-utils jq
99-
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
100-
yum install -y docker-ce-cli
94+
- name: Set up Python ${{ env.PY_VER }}
95+
uses: actions/setup-python@v5
96+
with:
97+
python-version: ${{ env.PY_VER }}
10198

10299
- uses: actions/checkout@v4
103100

104-
- name: Set up Python
105-
run: sh -x scipts/build/install_depends_yum.sh
106-
107-
- name: Install dependencies
108-
run: sh -x scipts/build/install_depends_wheels.sh
109-
110101
- name: Set up QEMU
111102
uses: docker/setup-qemu-action@v3
112103

104+
- name: Set up Docker Buildx
105+
uses: docker/setup-buildx-action@v3
106+
113107
- name: Set dynamic environment
114108
id: set-env
115109
run: |
116110
PLATFORMS="`docker manifest inspect ${{ env.BASE_IMAGE }} | \
117111
jq -r '.manifests[] | "\(.platform.os)/\(.platform.architecture)\(if .platform.variant != null then "/\(.platform.variant)" else "" end)"' | \
118112
sort -u | grep -v unknown | paste -sd ','`"
119-
BUILD_MATRIX="`echo ${PLATFORMS} | tr ',' '\n' | jq -R . | jq -s . | tr '\n' ' '`"
120-
GIT_BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
121-
GIT_BRANCH="${GIT_BRANCH#refs/tags/}"
122-
BUILD_IMAGE="${{ inputs.ghcr-repo }}:rtp.io-${{ inputs.rtpp-tag }}-${GIT_BRANCH}"
123113
echo "Platforms: ${PLATFORMS}"
124-
echo "platforms=${PLATFORMS}" >> $GITHUB_OUTPUT
125-
echo "build-matrix=${BUILD_MATRIX}" >> $GITHUB_OUTPUT
126-
echo "build-image=${BUILD_IMAGE}" >> $GITHUB_OUTPUT
127-
echo "git-branch=${GIT_BRANCH}" >> $GITHUB_OUTPUT
114+
echo "PLATFORMS=${PLATFORMS}" >> $GITHUB_ENV
128115
129-
- name: build
130-
run: |
131-
python${PY_VER} setup.py build sdist
132-
python${PY_VER} -m build --wheel
133-
auditwheel repair dist/*.whl --wheel-dir dist/
116+
- name: Build Docker image
117+
uses: docker/build-push-action@v6
118+
with:
119+
context: .
120+
file: ./docker/Dockerfile.python_wheels
121+
build-args: |
122+
BASE_IMAGE=${{ env.BASE_IMAGE }}
123+
PY_VER=${{ env.PY_VER }}
124+
platforms: ${{ env.PLATFORMS }}
125+
push: false
134126

135127
- name: Publish package distributions to PyPI
136128
if: github.event_name == 'release' && github.event.action == 'created'

docker/Dockerfile.python_wheels

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# syntax=docker/dockerfile:1.7-labs
2+
3+
ARG BASE_IMAGE="quay.io/pypa/manylinux_2_28:latest"
4+
FROM --platform=$TARGETPLATFORM $BASE_IMAGE AS build
5+
LABEL maintainer="Maksym Sobolyev <[email protected]>"
6+
7+
USER root
8+
9+
WORKDIR /src
10+
11+
ARG TARGETPLATFORM
12+
ARG PY_VER
13+
COPY ./scripts/build /tmp
14+
RUN sh -x /tmp/install_depends_yum.sh
15+
RUN sh -x /tmp/install_depends_wheels.sh
16+
17+
COPY --exclude=.git --exclude=.github --exclude=docker --exclude=dist \
18+
--exclude=scripts . .
19+
20+
RUN python${PY_VER} setup.py build sdist
21+
RUN python${PY_VER} -m build --wheel
22+
RUN auditwheel repair dist/*.whl --wheel-dir dist/

scipts/build/install_depends_yum.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ then
88
dnf module enable python${PY_VER} -y
99
fi
1010

11-
dnf install -y python${PY_VER} python${PY_VER}-devel
11+
dnf install -y redhat-lsb-core python${PY_VER} python${PY_VER}-devel

0 commit comments

Comments
 (0)