1515 FEDORA_VERSION : 42
1616
1717jobs :
18- build-and-push :
19- name : Build, test and push
18+ build-and-test :
19+ name : Build and test ${{ matrix.arch }}
2020 runs-on : ubuntu-latest
2121 strategy :
2222 matrix :
@@ -31,128 +31,122 @@ jobs:
3131 toxenv : py39,py310,py312
3232 steps :
3333 - name : Checkout
34- uses : actions/checkout@v2
34+ uses : actions/checkout@v4
3535 with :
3636 submodules : true
37+
3738 - name : Set up QEMU
38- uses : docker/setup-qemu-action@v1
39- - name : Build
40- env :
41- DOCKER_BUILDKIT : 0
42- run : |
43- docker build \
44- --platform linux/${{ matrix.arch }} \
45- -t fedorapython/fedora-python-tox:${{ matrix.arch }} \
46- -t fedorapython/fedora-python-tox:${{ matrix.arch }}-f${{ env.FEDORA_VERSION }} \
47- .
48- - name : Verify single-platform image
49- run : |
50- # Inspect the manifest
51- manifest=$(docker manifest inspect fedorapython/fedora-python-tox:${{ matrix.arch }})
52-
53- # For single-platform images, manifests should be null
54- # For multi-platform or images with attestations, manifests is an array
55- manifests=$(echo "$manifest" | jq '.manifests')
56-
57- if [ "$manifests" != "null" ]; then
58- manifest_count=$(echo "$manifests" | jq '. | length')
59- echo "ERROR: Image has a manifest list with $manifest_count entries (expected null for single-platform)!"
60- echo "This usually means attestations are enabled or it's a multi-platform image."
61- echo "$manifests" | jq '.[] | {platform: .platform, digest: .digest, annotations: .annotations}'
62- exit 1
63- fi
64-
65- echo "✓ Verified: Image is single-platform (manifests: null)"
39+ uses : docker/setup-qemu-action@v3
40+
41+ - name : Set up Docker Buildx
42+ uses : docker/setup-buildx-action@v3
43+
44+ - name : Build image for testing
45+ uses : docker/build-push-action@v6
46+ with :
47+ context : .
48+ platforms : linux/${{ matrix.arch }}
49+ load : true
50+ tags : |
51+ fedorapython/fedora-python-tox:test-${{ matrix.arch }}
52+
6653 - name : Test local project
6754 env :
6855 TOXENV : ${{ matrix.toxenv }}
6956 run : |
70- docker run --rm --platform linux/${{ matrix.arch }} -v $PWD/example_project:/src -w /src -e TOXENV fedorapython/fedora-python-tox:${{ matrix.arch }}
57+ docker run --rm --platform linux/${{ matrix.arch }} -v $PWD/example_project:/src -w /src -e TOXENV fedorapython/fedora-python-tox:test-${{ matrix.arch }}
58+
7159 - name : Test remote project
7260 env :
7361 TOXENV : ${{ matrix.toxenv }}
7462 run : |
75- docker run --rm --platform linux/${{ matrix.arch }} -e TOXENV -e GIT_URL=https://github.com/frenzymadness/python-tox-example.git fedorapython/fedora-python-tox:${{ matrix.arch }}
63+ docker run --rm --platform linux/${{ matrix.arch }} -e TOXENV -e GIT_URL=https://github.com/frenzymadness/python-tox-example.git fedorapython/fedora-python-tox:test-${{ matrix.arch }}
64+
7665 - name : Test parallel run
7766 env :
7867 TOXENV : ${{ matrix.toxenv }}
7968 run : |
80- docker run --rm --platform linux/${{ matrix.arch }} -v $PWD/example_project:/src -w /src -e TOXENV -e TOX_PARAMS="-p auto" fedorapython/fedora-python-tox:${{ matrix.arch }}
69+ docker run --rm --platform linux/${{ matrix.arch }} -v $PWD/example_project:/src -w /src -e TOXENV -e TOX_PARAMS="-p auto" fedorapython/fedora-python-tox:test-${{ matrix.arch }}
70+
8171 - name : Test dnf install and wheel build
8272 env :
8373 TOXENV : ${{ matrix.toxenv }}
8474 run : |
85- docker run --rm --platform linux/${{ matrix.arch }} -e DNF_INSTALL="libffi-devel 'pkgconfig(libgit2) >= 1.9' /usr/bin/cowsay" fedorapython/fedora-python-tox:${{ matrix.arch }} sh -c "/run_tests.sh; pip install -I --no-deps --compile --no-binary :all: cffi pygit2~=1.17.0 && cowsay DONE"
75+ docker run --rm --platform linux/${{ matrix.arch }} -e DNF_INSTALL="libffi-devel 'pkgconfig(libgit2) >= 1.9' /usr/bin/cowsay" fedorapython/fedora-python-tox:test-${{ matrix.arch }} sh -c "/run_tests.sh; pip install -I --no-deps --compile --no-binary :all: cffi pygit2~=1.17.0 && cowsay DONE"
76+
8677 - name : Test external project with WORKDIR
8778 run : |
88- docker run --rm --platform linux/${{ matrix.arch }} -e TOXENV=py3 -e GIT_URL=https://github.com/frenzymadness/nflxprofile.git -e WORKDIR=python fedorapython/fedora-python-tox:${{ matrix.arch }}
79+ docker run --rm --platform linux/${{ matrix.arch }} -e TOXENV=py3 -e GIT_URL=https://github.com/frenzymadness/nflxprofile.git -e WORKDIR=python fedorapython/fedora-python-tox:test-${{ matrix.arch }}
80+
8981 - name : Login to DockerHub
90- uses : docker/login-action@v1
9182 if : github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
83+ uses : docker/login-action@v3
9284 with :
9385 username : ${{ secrets.DOCKERHUB_USERNAME }}
9486 password : ${{ secrets.DOCKERHUB_TOKEN }}
95- - name : Push to Dockerhub
87+
88+ - name : Build and push platform-specific images
9689 if : github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
90+ uses : docker/build-push-action@v6
91+ with :
92+ context : .
93+ platforms : linux/${{ matrix.arch }}
94+ push : true
95+ tags : |
96+ fedorapython/fedora-python-tox:${{ matrix.arch }}
97+ fedorapython/fedora-python-tox:${{ matrix.arch }}-f${{ env.FEDORA_VERSION }}
98+
99+ release :
100+ name : Create multi-platform manifests
101+ if : github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
102+ needs : build-and-test
103+ runs-on : ubuntu-latest
104+ steps :
105+ - name : Set up Docker Buildx
106+ uses : docker/setup-buildx-action@v3
107+
108+ - name : Login to DockerHub
109+ uses : docker/login-action@v3
110+ with :
111+ username : ${{ secrets.DOCKERHUB_USERNAME }}
112+ password : ${{ secrets.DOCKERHUB_TOKEN }}
113+
114+ - name : Create and push multi-platform manifest for :latest
115+ run : |
116+ docker buildx imagetools create -t fedorapython/fedora-python-tox:latest \
117+ fedorapython/fedora-python-tox:amd64 \
118+ fedorapython/fedora-python-tox:arm64 \
119+ fedorapython/fedora-python-tox:ppc64le \
120+ fedorapython/fedora-python-tox:s390x
121+
122+ - name : Create and push multi-platform manifest for :f${{ env.FEDORA_VERSION }}
123+ run : |
124+ docker buildx imagetools create -t fedorapython/fedora-python-tox:f${{ env.FEDORA_VERSION }} \
125+ fedorapython/fedora-python-tox:amd64-f${{ env.FEDORA_VERSION }} \
126+ fedorapython/fedora-python-tox:arm64-f${{ env.FEDORA_VERSION }} \
127+ fedorapython/fedora-python-tox:ppc64le-f${{ env.FEDORA_VERSION }} \
128+ fedorapython/fedora-python-tox:s390x-f${{ env.FEDORA_VERSION }}
129+
130+ - name : Verify :latest manifest
131+ run : |
132+ docker buildx imagetools inspect fedorapython/fedora-python-tox:latest
133+
134+ - name : Verify :f${{ env.FEDORA_VERSION }} manifest
97135 run : |
98- docker push fedorapython/fedora-python-tox:${{ matrix.arch }}
99- docker push fedorapython/fedora-python-tox:${{ matrix.arch }}-f${{ env.FEDORA_VERSION }}
136+ docker buildx imagetools inspect fedorapython/fedora-python-tox:f${{ env.FEDORA_VERSION }}
100137
101138 description_update :
102- name : ' Update Dockerhub description'
139+ name : Update Dockerhub description
103140 if : github.event_name == 'push'
104- needs : build-and-push
141+ needs : release
105142 runs-on : ubuntu-latest
106143 steps :
107144 - name : Checkout
108145 uses : actions/checkout@v4
109- - name : ' Update Dockerhub description'
146+
147+ - name : Update Dockerhub description
110148 uses : peter-evans/dockerhub-description@v4
111149 with :
112150 username : ${{ secrets.DOCKERHUB_USERNAME }}
113151 password : ${{ secrets.DOCKERHUB_TOKEN }}
114152 repository : fedorapython/fedora-python-tox
115-
116- release :
117- name : ' Update and test manifests'
118- if : github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
119- needs : build-and-push
120- runs-on : ubuntu-latest
121- steps :
122- - name : Login to DockerHub
123- uses : docker/login-action@v1
124- with :
125- username : ${{ secrets.DOCKERHUB_USERNAME }}
126- password : ${{ secrets.DOCKERHUB_TOKEN }}
127- - name : Pull all images
128- run : >
129- for arch in amd64 arm64 ppc64le s390x; do
130- docker pull fedorapython/fedora-python-tox:$arch;
131- docker pull fedorapython/fedora-python-tox:${arch}-f${{ env.FEDORA_VERSION }};
132- done
133- - name : Create and push manifest for the :latest tag
134- env :
135- DOCKER_CLI_EXPERIMENTAL : enabled
136- run : >
137- docker manifest create fedorapython/fedora-python-tox:latest
138- fedorapython/fedora-python-tox:amd64
139- fedorapython/fedora-python-tox:arm64
140- fedorapython/fedora-python-tox:ppc64le
141- fedorapython/fedora-python-tox:s390x;
142- docker manifest push fedorapython/fedora-python-tox:latest;
143- - name : Test the latest manifest
144- run : |
145- docker manifest inspect fedorapython/fedora-python-tox:latest | grep '"architecture":' | grep -Ez '(.*(amd64|arm64|ppc64le|s390x).*){4}'
146- - name : Create and push manifest for the versioned tag
147- env :
148- DOCKER_CLI_EXPERIMENTAL : enabled
149- run : >
150- docker manifest create fedorapython/fedora-python-tox:f${{ env.FEDORA_VERSION }}
151- fedorapython/fedora-python-tox:amd64-f${{ env.FEDORA_VERSION }}
152- fedorapython/fedora-python-tox:arm64-f${{ env.FEDORA_VERSION }}
153- fedorapython/fedora-python-tox:ppc64le-f${{ env.FEDORA_VERSION }}
154- fedorapython/fedora-python-tox:s390x-f${{ env.FEDORA_VERSION }};
155- docker manifest push fedorapython/fedora-python-tox:f${{ env.FEDORA_VERSION }};
156- - name : Test the versioned manifest
157- run : |
158- docker manifest inspect fedorapython/fedora-python-tox:f${{ env.FEDORA_VERSION }} | grep '"architecture":' | grep -Ez '(.*(amd64|arm64|ppc64le|s390x).*){4}'
0 commit comments