Skip to content

Commit 2fffd66

Browse files
authored
Merge pull request #1899 from pygame-community/ankith26-manylinux-image-ci
Make manylinux (i686 and x86_64) base images on CI
2 parents 7beb654 + 33c50c8 commit 2fffd66

File tree

4 files changed

+51
-40
lines changed

4 files changed

+51
-40
lines changed

.github/workflows/build-manylinux.yml

Lines changed: 45 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -36,44 +36,29 @@ concurrency:
3636

3737
jobs:
3838
build:
39-
name: ${{ matrix.image }} [${{ matrix.arch }}]
40-
runs-on: ubuntu-20.04
39+
name: ${{ matrix.arch }}
40+
runs-on: ubuntu-22.04
41+
permissions:
42+
contents: read
43+
packages: write
44+
4145
strategy:
4246
fail-fast: false # if a particular matrix build fails, don't skip the rest
4347
matrix:
44-
# Split job into many matrix builds, because GH actions provides 20
45-
# concurrent builds on ubuntu. 6 are used here
46-
include:
47-
# no pypy and cpython >= cp310 on manylinux1
48-
- { image: manylinux1, arch: x86_64, pyversions: "cp3[7-9]-*" }
49-
- { image: manylinux1, arch: i686, pyversions: "cp3[7-9]-*" }
50-
51-
# no pypy >= 3.9 and cpython >= cp311 on manylinux2010
52-
- { image: manylinux2010, arch: x86_64, pyversions: "cp3{[7-9],10}-* pp3{7,8}-*" }
53-
- { image: manylinux2010, arch: i686, pyversions: "cp3{[7-9],10}-* pp3{7,8}-*" }
54-
55-
# all versions of python supported by cibuildwheel (except cp3.6)
56-
- { image: manylinux2014, arch: x86_64, pyversions: "cp3{[7-9],10,11}-* pp3{7,8,9}-*" }
57-
- { image: manylinux2014, arch: i686, pyversions: "cp3{[7-9],10,11}-* pp3{7,8,9}-*" }
58-
48+
arch: [x86_64, i686]
49+
5950
env:
6051
# load pip config from this file. Define this in 'CIBW_ENVIRONMENT'
6152
# because this should not affect cibuildwheel machinery
6253
# also define environment variables needed for testing
6354
CIBW_ENVIRONMENT: PIP_CONFIG_FILE=buildconfig/pip_config.ini PORTMIDI_INC_PORTTIME=1 SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=disk
6455

65-
CIBW_BUILD: ${{ matrix.pyversions }}
56+
CIBW_BUILD: "cp3{[7-9],10,11}-* pp3[7-9]-*"
6657
CIBW_ARCHS: ${{ matrix.arch }}
6758

6859
# skip musllinux for now
6960
CIBW_SKIP: '*-musllinux_*'
7061

71-
# set custom pygame images
72-
CIBW_MANYLINUX_X86_64_IMAGE: pygame/${{ matrix.image }}_base_x86_64
73-
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: pygame/${{ matrix.image }}_base_x86_64
74-
CIBW_MANYLINUX_I686_IMAGE: pygame/${{ matrix.image }}_base_i686
75-
CIBW_MANYLINUX_PYPY_I686_IMAGE: pygame/${{ matrix.image }}_base_i686
76-
7762
# command that runs before every build
7863
CIBW_BEFORE_BUILD: |
7964
pip install Sphinx
@@ -95,7 +80,43 @@ jobs:
9580
steps:
9681
- uses: actions/[email protected]
9782

83+
- name: Log in to the Container registry
84+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
85+
with:
86+
registry: ghcr.io
87+
username: ${{ github.actor }}
88+
password: ${{ secrets.GITHUB_TOKEN }}
89+
90+
- name: Inspect image, skip build if image exists
91+
id: inspect
92+
continue-on-error: true
93+
run: docker manifest inspect ghcr.io/${{ github.repository }}_${{ matrix.arch }}:${{ hashFiles('buildconfig/manylinux-build/**') }}
94+
95+
- name: Extract metadata (tags, labels) for Docker
96+
id: meta
97+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
98+
with:
99+
images: ghcr.io/${{ github.repository }}_${{ matrix.arch }}
100+
tags: type=raw,value=${{ hashFiles('buildconfig/manylinux-build/**') }}
101+
102+
- name: Build and push Docker image
103+
if: steps.inspect.outcome == 'failure'
104+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
105+
with:
106+
context: ${{ github.workspace }}/buildconfig/manylinux-build/docker_base
107+
file: ${{ github.workspace }}/buildconfig/manylinux-build/docker_base/Dockerfile-${{ matrix.arch }}
108+
push: true
109+
tags: ${{ steps.meta.outputs.tags }}
110+
labels: ${{ steps.meta.outputs.labels }}
111+
98112
- name: Build and test wheels
113+
env:
114+
# set custom pygame images
115+
CIBW_MANYLINUX_X86_64_IMAGE: ghcr.io/${{ github.repository }}_x86_64:${{ steps.meta.outputs.version }}
116+
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: ghcr.io/${{ github.repository }}_x86_64:${{ steps.meta.outputs.version }}
117+
CIBW_MANYLINUX_I686_IMAGE: ghcr.io/${{ github.repository }}_i686:${{ steps.meta.outputs.version }}
118+
CIBW_MANYLINUX_PYPY_I686_IMAGE: ghcr.io/${{ github.repository }}_i686:${{ steps.meta.outputs.version }}
119+
99120
uses: pypa/[email protected]
100121

101122
# We upload the generated files under github actions assets

buildconfig/manylinux-build/docker_base/Dockerfile-aarch64

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
ARG BASE_IMAGE=manylinux2014_aarch64
2-
FROM quay.io/pypa/$BASE_IMAGE
3-
ENV MAKEFLAGS="-j 16"
1+
FROM quay.io/pypa/manylinux2014_aarch64
2+
ENV MAKEFLAGS="-j 2"
43

54
# Set up repoforge
65
COPY RPM-GPG-KEY.dag.txt /tmp/
@@ -112,6 +111,3 @@ RUN ["bash", "/portmidi_build/build-portmidi.sh"]
112111
COPY strip-lib-so-files.sh /tmp/
113112
RUN source /tmp/strip-lib-so-files.sh
114113

115-
ENV base_image=$BASE_IMAGE
116-
RUN echo "$base_image"
117-
RUN echo "$BASE_IMAGE"

buildconfig/manylinux-build/docker_base/Dockerfile-i686

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
ARG BASE_IMAGE=manylinux1_i686
2-
FROM quay.io/pypa/$BASE_IMAGE
3-
ENV MAKEFLAGS="-j 16"
1+
FROM quay.io/pypa/manylinux2014_i686
2+
ENV MAKEFLAGS="-j 2"
43

54
# Set up repoforge
65
COPY RPM-GPG-KEY.dag.txt /tmp/

buildconfig/manylinux-build/docker_base/Dockerfile-x86_64

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
ARG BASE_IMAGE=manylinux1_x86_64
2-
FROM quay.io/pypa/$BASE_IMAGE
3-
ENV MAKEFLAGS="-j 16"
1+
FROM quay.io/pypa/manylinux2014_x86_64
2+
ENV MAKEFLAGS="-j 2"
43

54
# Set up repoforge
65
COPY RPM-GPG-KEY.dag.txt /tmp/
@@ -111,7 +110,3 @@ RUN ["bash", "/portmidi_build/build-portmidi.sh"]
111110
# run strip on built libraries
112111
COPY strip-lib-so-files.sh /tmp/
113112
RUN source /tmp/strip-lib-so-files.sh
114-
115-
ENV base_image=$BASE_IMAGE
116-
RUN echo "$base_image"
117-
RUN echo "$BASE_IMAGE"

0 commit comments

Comments
 (0)