Skip to content

Commit 38b7452

Browse files
committed
Modify GA workflow to use Docker actions
1 parent e828911 commit 38b7452

File tree

1 file changed

+58
-32
lines changed

1 file changed

+58
-32
lines changed

.github/workflows/build.yml

Lines changed: 58 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ name: Build
22

33
on:
44
workflow_dispatch:
5-
inputs:
6-
useCache:
7-
description: Use GHA cache
8-
type: boolean
9-
required: false
10-
default: true
115
push:
126
branches-ignore:
137
- "update-dependencies-pr"
@@ -27,52 +21,84 @@ concurrency:
2721

2822
jobs:
2923
build_manylinux:
30-
name: ${{ matrix.policy }}_${{ matrix.platform }}
31-
runs-on: ubuntu-22.04
24+
name: ${{ matrix.policy[0] }}
25+
runs-on: ${{ matrix.policy[6] }}
3226
strategy:
3327
fail-fast: false
3428
matrix:
35-
policy: ["manylinux2014", "musllinux_1_1", "musllinux_1_2"]
36-
platform: ["i686", "x86_64"]
37-
include:
38-
- policy: "manylinux_2_28"
39-
platform: "x86_64"
29+
# 0. policy
30+
# 1. base image
31+
# 2. DEVTOOLSET_ROOTPATH
32+
# 3. PREPEND_PATH
33+
# 4. LD_LIBRARY_PATH_ARG
34+
# 5. Docker platforms
35+
# 6. Github Action runner
36+
policy: [
37+
["manylinux2014", "centos:7",
38+
"/opt/rh/devtoolset-10/root", "/opt/rh/devtoolset-10/root/usr/bin:",
39+
"/opt/rh/devtoolset-10/root/usr/lib64:/opt/rh/devtoolset-10/root/usr/lib:/opt/rh/devtoolset-10/root/usr/lib64/dyninst:/opt/rh/devtoolset-10/root/usr/lib/dyninst:/usr/local/lib64",
40+
"linux/amd64,linux/arm64,linux/ppc64le", self-hosted
41+
],
42+
["manylinux_2_28", "almalinux:8",
43+
"/opt/rh/gcc-toolset-12/root",
44+
"/opt/rh/gcc-toolset-12/root/usr/bin:",
45+
"/opt/rh/gcc-toolset-12/root/usr/lib64:/opt/rh/gcc-toolset-12/root/usr/lib:/opt/rh/gcc-toolset-12/root/usr/lib64/dyninst:/opt/rh/gcc-toolset-12/root/usr/lib/dyninst",
46+
'linux/amd64,linux/arm64', ubuntu-latest],
47+
["musllinux_1_1", "alpine:3.12", "", "", "", 'linux/amd64', ubuntu-latest],
48+
["musllinux_1_2", "alpine:3.18", "", "", "", 'linux/amd64', ubuntu-latest]
49+
]
4050

4151
env:
42-
POLICY: ${{ matrix.policy }}
43-
PLATFORM: ${{ matrix.platform }}
52+
POLICY: ${{ matrix.policy[0] }}
53+
BASEIMAGE: ${{ matrix.policy[1] }}
54+
DEVTOOLSET_ROOTPATH: ${{ matrix.policy[2] }}
55+
PREPEND_PATH: ${{ matrix.policy[3] }}
56+
LD_LIBRARY_PATH_ARG: ${{ matrix.policy[4] }}
4457
COMMIT_SHA: ${{ github.sha }}
4558

4659
steps:
4760
- name: Checkout
4861
uses: actions/checkout@v4
4962

63+
# Setup tags to be used for docker images
64+
- uses: docker/metadata-action@v5
65+
id: docker_meta
66+
with:
67+
images: ghcr.io/${{ github.repository_owner }}/${{ matrix.policy[0] }}
68+
5069
- name: Set up emulation
51-
if: matrix.platform != 'i686' && matrix.platform != 'x86_64'
5270
uses: docker/setup-qemu-action@v3
5371
with:
54-
platforms: ${{ matrix.platform }}
72+
platforms: ${{ matrix.policy[5] }}
5573

5674
- name: Set up Docker Buildx
5775
uses: docker/setup-buildx-action@v3
5876

59-
- name: Setup cache
60-
if: github.event_name != 'workflow_dispatch' || fromJSON(github.event.inputs.useCache)
61-
uses: actions/cache@v3
77+
- name: Login to GitHub Container Registry
78+
uses: docker/login-action@v3
6279
with:
63-
path: .buildx-cache-${{ matrix.policy }}_${{ matrix.platform }}/*
64-
key: buildx-cache-${{ matrix.policy }}-${{ matrix.platform }}-${{ hashFiles('docker/**') }}
65-
restore-keys: buildx-cache-${{ matrix.policy }}-${{ matrix.platform }}-
80+
registry: ghcr.io
81+
username: ${{ github.repository_owner }}
82+
password: ${{ secrets.GITHUB_TOKEN }}
6683

67-
- name: Build
68-
run: ./build.sh
69-
70-
- name: Deploy
71-
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'pypa/manylinux'
72-
run: ./deploy.sh
73-
env:
74-
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
75-
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
84+
- name: Build and Deploy
85+
uses: docker/build-push-action@v5
86+
with:
87+
context: docker
88+
push: ${{ github.event_name == 'push' }}
89+
build-args: |
90+
POLICY
91+
BASEIMAGE
92+
DEVTOOLSET_ROOTPATH
93+
PREPEND_PATH
94+
LD_LIBRARY_PATH_ARG
95+
platforms: ${{ matrix.policy[5] }}
96+
tags: ${{ steps.docker_meta.outputs.tags }}
97+
labels: ${{ steps.docker_meta.outputs.labels }}
98+
# See: https://github.com/moby/buildkit#github-actions-cache-experimental
99+
cache-from: |
100+
${{ steps.meta.outputs.tags }}
101+
cache-to: type=inline
76102

77103
all_passed:
78104
needs: [build_manylinux]

0 commit comments

Comments
 (0)