Skip to content

Commit 4d9d4ea

Browse files
committed
[manylinux2014] Build on GHA
Use docker buildx to allow for simple layer caching by actions/cache Caching will be mostly beneficial for aarch64/ppc64le/s390x where build times are extremely long with qem
1 parent 0d1abb7 commit 4d9d4ea

File tree

5 files changed

+90
-50
lines changed

5 files changed

+90
-50
lines changed

.github/workflows/build.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- "dependabot/**"
7+
paths:
8+
- ".github/workflows/build.yml"
9+
- "docker/**"
10+
- "*.sh"
11+
pull_request:
12+
paths:
13+
- ".github/workflows/build.yml"
14+
- "docker/**"
15+
- "build.sh"
16+
17+
jobs:
18+
build_manylinux:
19+
name: ${{ matrix.policy }}_${{ matrix.platform }}
20+
runs-on: ubuntu-20.04
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
include:
25+
- policy: "manylinux2010"
26+
platform: "i686"
27+
- policy: "manylinux2010"
28+
platform: "x86_64"
29+
- policy: "manylinux2014"
30+
platform: "i686"
31+
- policy: "manylinux2014"
32+
platform: "x86_64"
33+
- policy: "manylinux2014"
34+
platform: "aarch64"
35+
- policy: "manylinux2014"
36+
platform: "ppc64le"
37+
- policy: "manylinux2014"
38+
platform: "s390x"
39+
40+
env:
41+
POLICY: ${{ matrix.policy }}
42+
PLATFORM: ${{ matrix.platform }}
43+
COMMIT_SHA: ${{ github.sha }}
44+
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v2
48+
49+
- name: Set up QEMU
50+
uses: docker/[email protected]
51+
52+
- name: Set up Docker Buildx
53+
uses: docker/setup-buildx-action@v1
54+
55+
- name: Create cache timestamp
56+
id: timestamp
57+
run: echo "::set-output name=timestamp::$(python3 -c 'from datetime import datetime,timezone; print(datetime.now(timezone.utc).isoformat())')"
58+
59+
- name: Setup cache
60+
uses: actions/cache@v2
61+
with:
62+
path: .buildx-cache-${{ matrix.policy }}_${{ matrix.platform }}/*
63+
key: buildx-cache-${{ matrix.policy }}-${{ matrix.platform }}-${{ steps.timestamp.outputs.timestamp }}
64+
restore-keys: buildx-cache-${{ matrix.policy }}-${{ matrix.platform }}-
65+
66+
- name: Build
67+
run: ./build.sh
68+
69+
- name: Deploy
70+
if: github.event_name == 'push' && github.ref == 'refs/heads/manylinux2014' && github.repository == 'pypa/manylinux' && matrix.policy == 'manylinux2014'
71+
run: ./deploy.sh
72+
env:
73+
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
74+
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,6 @@ target/
5858

5959
# Prefetched source
6060
docker/sources
61+
62+
# buildx cache
63+
.buildx-cache-*/

.travis.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

build.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,16 @@ export DEVTOOLSET_ROOTPATH
6262
export PREPEND_PATH
6363
export LD_LIBRARY_PATH_ARG
6464

65-
docker build \
65+
docker buildx build \
66+
--load \
67+
--cache-from=type=local,src=$(pwd)/.buildx-cache-${POLICY}_${PLATFORM} \
68+
--cache-to=type=local,dest=$(pwd)/.buildx-cache-staging-${POLICY}_${PLATFORM} \
6669
--build-arg POLICY --build-arg PLATFORM --build-arg BASEIMAGE \
6770
--build-arg DEVTOOLSET_ROOTPATH --build-arg PREPEND_PATH --build-arg LD_LIBRARY_PATH_ARG \
68-
--rm -t quay.io/pypa/${POLICY}_${PLATFORM}:${TRAVIS_COMMIT} \
71+
--rm -t quay.io/pypa/${POLICY}_${PLATFORM}:${COMMIT_SHA} \
6972
-f docker/Dockerfile docker/
73+
74+
if [ -d $(pwd)/.buildx-cache-${POLICY}_${PLATFORM} ]; then
75+
rm -rf $(pwd)/.buildx-cache-${POLICY}_${PLATFORM}
76+
fi
77+
mv $(pwd)/.buildx-cache-staging-${POLICY}_${PLATFORM} $(pwd)/.buildx-cache-${POLICY}_${PLATFORM}

deploy.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/bin/bash
22
tag="quay.io/pypa/${POLICY}_${PLATFORM}"
3-
build_id=$(git show -s --format=%cd-%h --date=short $TRAVIS_COMMIT)
3+
build_id=$(git show -s --format=%cd-%h --date=short ${COMMIT_SHA})
44

55
docker login -u $QUAY_USERNAME -p $QUAY_PASSWORD quay.io
6-
docker tag ${tag}:${TRAVIS_COMMIT} ${tag}:${build_id}
7-
docker tag ${tag}:${TRAVIS_COMMIT} ${tag}:latest
6+
docker tag ${tag}:${COMMIT_SHA} ${tag}:${build_id}
7+
docker tag ${tag}:${COMMIT_SHA} ${tag}:latest
88
docker push ${tag}:${build_id}
99
docker push ${tag}:latest

0 commit comments

Comments
 (0)