-
Notifications
You must be signed in to change notification settings - Fork 5
129 lines (125 loc) · 5.34 KB
/
build-and-push.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Build, test and push container images
on:
push:
branches:
- 'master'
pull_request:
branches:
- 'master'
schedule:
- cron: '48 23 * * 6'
env:
FEDORA_VERSION: 37
jobs:
build-and-push:
name: Build, test and push
runs-on: ubuntu-latest
strategy:
matrix:
include:
- arch: amd64
toxenv: py27,py36,py37,py38,py39,py310,py311,py312,pypy,pypy38,pypy39,pypy310
- arch: arm64
toxenv: py38,py39,py311
- arch: ppc64le
toxenv: py37,py38,py311
- arch: s390x
toxenv: py36,py38,py311,pypy38
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Build
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/${{ matrix.arch }}
load: true
tags: |
fedorapython/fedora-python-tox:${{ matrix.arch }}
fedorapython/fedora-python-tox:${{ matrix.arch }}-f${{ env.FEDORA_VERSION }}
- name: Test local project
env:
TOXENV: ${{ matrix.toxenv }}
run: |
docker run --rm --platform linux/${{ matrix.arch }} -v $PWD/example_project:/src -w /src -e TOXENV fedorapython/fedora-python-tox:${{ matrix.arch }}
- name: Test remote project
env:
TOXENV: ${{ matrix.toxenv }}
run: |
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 }}
- name: Test parallel run
env:
TOXENV: ${{ matrix.toxenv }}
run: |
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 }}
- name: Test dnf install and wheel build
env:
TOXENV: ${{ matrix.toxenv }}
run: |
docker run --rm --platform linux/${{ matrix.arch }} -e DNF_INSTALL="libffi-devel pkgconfig(libgit2) /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.7.0 && cowsay DONE"
- name: Test external project with WORKDIR
run: |
docker run --rm --platform linux/${{ matrix.arch }} -e TOXENV=py310-minimal -e GIT_URL=https://github.com/trezor/trezor-firmware.git -e WORKDIR=python fedorapython/fedora-python-tox:${{ matrix.arch }}
- name: Login to DockerHub
uses: docker/login-action@v1
if: github.event_name == 'push' || github.event_name == 'schedule'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push to Dockerhub
uses: docker/build-push-action@v2
if: github.event_name == 'push' || github.event_name == 'schedule'
with:
context: .
platforms: linux/${{ matrix.arch }}
push: true
tags: |
fedorapython/fedora-python-tox:${{ matrix.arch }}
fedorapython/fedora-python-tox:${{ matrix.arch }}-f${{ env.FEDORA_VERSION }}
release:
name: 'Update and test manifests'
if: github.event_name == 'push' || github.event_name == 'schedule'
needs: build-and-push
runs-on: ubuntu-latest
steps:
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Pull all images
run: >
for arch in amd64 arm64 ppc64le s390x; do
docker pull fedorapython/fedora-python-tox:$arch;
docker pull fedorapython/fedora-python-tox:${arch}-f${{ env.FEDORA_VERSION }};
done
- name: Create and push manifest for the :latest tag
env:
DOCKER_CLI_EXPERIMENTAL: enabled
run: >
docker manifest create fedorapython/fedora-python-tox:latest
fedorapython/fedora-python-tox:amd64
fedorapython/fedora-python-tox:arm64
fedorapython/fedora-python-tox:ppc64le
fedorapython/fedora-python-tox:s390x;
docker manifest push fedorapython/fedora-python-tox:latest;
- name: Test the latest manifest
run: |
docker manifest inspect fedorapython/fedora-python-tox:latest | grep '"architecture":' | grep -Ez '(.*(amd64|arm64|ppc64le|s390x).*){4}'
- name: Create and push manifest for the versioned tag
env:
DOCKER_CLI_EXPERIMENTAL: enabled
run: >
docker manifest create fedorapython/fedora-python-tox:f${{ env.FEDORA_VERSION }}
fedorapython/fedora-python-tox:amd64-f${{ env.FEDORA_VERSION }}
fedorapython/fedora-python-tox:arm64-f${{ env.FEDORA_VERSION }}
fedorapython/fedora-python-tox:ppc64le-f${{ env.FEDORA_VERSION }}
fedorapython/fedora-python-tox:s390x-f${{ env.FEDORA_VERSION }};
docker manifest push fedorapython/fedora-python-tox:f${{ env.FEDORA_VERSION }};
- name: Test the versioned manifest
run: |
docker manifest inspect fedorapython/fedora-python-tox:f${{ env.FEDORA_VERSION }} | grep '"architecture":' | grep -Ez '(.*(amd64|arm64|ppc64le|s390x).*){4}'