@@ -4,8 +4,6 @@ name: ManyLinux
44# to main. Do not run CI on any other branch. Also, skip any non-source changes
55# from running on CI
66on :
7- release :
8- types : [created]
97 push :
108 branches : main
119 paths-ignore :
2927 - ' .github/workflows/*.yml'
3028 # re-include current file to not be excluded
3129 - ' !.github/workflows/build-manylinux.yml'
30+
31+ # the github release drafter can call this workflow
32+ workflow_call :
3233
3334concurrency :
34- group : ${{ github.workflow }}-${{ github.ref }}
35+ group : ${{ github.workflow }}-${{ github.ref }}-manylinux
3536 cancel-in-progress : true
3637
3738jobs :
3839 build :
39- name : ${{ matrix.image }} [${{ matrix.arch }}]
40- runs-on : ubuntu-20.04
40+ name : ${{ matrix.arch }}
41+ runs-on : ubuntu-22.04
42+ permissions :
43+ contents : read
44+ packages : write
45+
4146 strategy :
4247 fail-fast : false # if a particular matrix build fails, don't skip the rest
4348 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[6-9]-*" }
49- - { image: manylinux1, arch: i686, pyversions: "cp3[6-9]-*" }
50-
51- # no pypy >= 3.9 and cpython >= cp311 on manylinux2010
52- - { image: manylinux2010, arch: x86_64, pyversions: "cp3{[6-9],10}-* pp3{7,8}-*" }
53- - { image: manylinux2010, arch: i686, pyversions: "cp3{[6-9],10}-* pp3{7,8}-*" }
54-
55- # all cpython and pypy versions should support this for now
56- # The * here essentially tells cibuildwheel to follow its default behaviour
57- # of building all possible build configurations the particular cibuildwheel
58- # version supports. Unless cibuildwheel itself is bumped to the next version,
59- # this will stay constant and do the same set of builds everytime.
60- - { image: manylinux2014, arch: x86_64, pyversions: "*" }
61- - { image: manylinux2014, arch: i686, pyversions: "*" }
62-
49+ arch : [x86_64, i686]
50+
6351 env :
6452 # load pip config from this file. Define this in 'CIBW_ENVIRONMENT'
6553 # because this should not affect cibuildwheel machinery
6654 # also define environment variables needed for testing
6755 CIBW_ENVIRONMENT : PIP_CONFIG_FILE=buildconfig/pip_config.ini PORTMIDI_INC_PORTTIME=1 SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=disk
6856
69- CIBW_BUILD : ${{ matrix.pyversions }}
57+ CIBW_BUILD : " cp3{[7-9],10,11}-* pp3[7-9]-* "
7058 CIBW_ARCHS : ${{ matrix.arch }}
7159
7260 # skip musllinux for now
7361 CIBW_SKIP : ' *-musllinux_*'
7462
75- # set custom pygame images
76- CIBW_MANYLINUX_X86_64_IMAGE : pygame/${{ matrix.image }}_base_x86_64
77- CIBW_MANYLINUX_PYPY_X86_64_IMAGE : pygame/${{ matrix.image }}_base_x86_64
78- CIBW_MANYLINUX_I686_IMAGE : pygame/${{ matrix.image }}_base_i686
79- CIBW_MANYLINUX_PYPY_I686_IMAGE : pygame/${{ matrix.image }}_base_i686
80-
8163 # command that runs before every build
8264 CIBW_BEFORE_BUILD : |
8365 pip install Sphinx
@@ -99,29 +81,49 @@ jobs:
9981 steps :
1008210183
84+ - name : Log in to the Container registry
85+ uses : docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
86+ with :
87+ registry : ghcr.io
88+ username : ${{ github.actor }}
89+ password : ${{ secrets.GITHUB_TOKEN }}
90+
91+ - name : Inspect image, skip build if image exists
92+ id : inspect
93+ continue-on-error : true
94+ run : docker manifest inspect ghcr.io/${{ github.repository }}_${{ matrix.arch }}:${{ hashFiles('buildconfig/manylinux-build/**') }}
95+
96+ - name : Extract metadata (tags, labels) for Docker
97+ id : meta
98+ uses : docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96
99+ with :
100+ images : ghcr.io/${{ github.repository }}_${{ matrix.arch }}
101+ tags : type=raw,value=${{ hashFiles('buildconfig/manylinux-build/**') }}
102+
103+ - name : Build and push Docker image
104+ if : steps.inspect.outcome == 'failure'
105+ uses : docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
106+ with :
107+ context : ${{ github.workspace }}/buildconfig/manylinux-build/docker_base
108+ file : ${{ github.workspace }}/buildconfig/manylinux-build/docker_base/Dockerfile-${{ matrix.arch }}
109+ push : true
110+ tags : ${{ steps.meta.outputs.tags }}
111+ labels : ${{ steps.meta.outputs.labels }}
112+
102113 - name : Build and test wheels
103- 114+ env :
115+ # set custom pygame images
116+ CIBW_MANYLINUX_X86_64_IMAGE : ghcr.io/${{ github.repository }}_x86_64:${{ steps.meta.outputs.version }}
117+ CIBW_MANYLINUX_PYPY_X86_64_IMAGE : ghcr.io/${{ github.repository }}_x86_64:${{ steps.meta.outputs.version }}
118+ CIBW_MANYLINUX_I686_IMAGE : ghcr.io/${{ github.repository }}_i686:${{ steps.meta.outputs.version }}
119+ CIBW_MANYLINUX_PYPY_I686_IMAGE : ghcr.io/${{ github.repository }}_i686:${{ steps.meta.outputs.version }}
120+
121+ 104122
105123 # We upload the generated files under github actions assets
106124 - name : Upload dist
107125 uses : actions/upload-artifact@v3
108126 with :
109- name : pygame-manylinux- wheels
127+ name : pygame-wheels-manylinux
110128 path : ./wheelhouse/*.whl
111129
112- # - name: Upload binaries to Github Releases
113- # if: github.event_name == 'release'
114- # uses: svenstaro/upload-release-action@v2
115- # with:
116- # repo_token: ${{ secrets.GITHUB_TOKEN }}
117- # file: ./wheelhouse/*.whl
118- # tag: ${{ github.ref }}
119- #
120- # - name: Upload binaries to PyPI
121- # if: github.event_name == 'release'
122- # env:
123- # TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
124- # TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
125- # run: |
126- # python3 -m pip install twine
127- # twine upload ./wheelhouse/*.whl
0 commit comments