Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[manylinux2014] Build on GHA #989

Merged
merged 2 commits into from
Feb 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build

on:
push:
branches-ignore:
- "dependabot/**"
paths:
- ".github/workflows/build.yml"
- "docker/**"
- "*.sh"
pull_request:
paths:
- ".github/workflows/build.yml"
- "docker/**"
- "build.sh"

jobs:
build_manylinux:
name: ${{ matrix.policy }}_${{ matrix.platform }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- policy: "manylinux2010"
platform: "i686"
- policy: "manylinux2010"
platform: "x86_64"
- policy: "manylinux2014"
platform: "i686"
- policy: "manylinux2014"
platform: "x86_64"
- policy: "manylinux2014"
platform: "aarch64"
- policy: "manylinux2014"
platform: "ppc64le"
- policy: "manylinux2014"
platform: "s390x"

env:
POLICY: ${{ matrix.policy }}
PLATFORM: ${{ matrix.platform }}
COMMIT_SHA: ${{ github.sha }}

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/[email protected]

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Create cache timestamp
id: timestamp
run: echo "::set-output name=timestamp::$(python3 -c 'from datetime import datetime,timezone; print(datetime.now(timezone.utc).isoformat())')"

- name: Setup cache
uses: actions/cache@v2
with:
path: .buildx-cache-${{ matrix.policy }}_${{ matrix.platform }}/*
key: buildx-cache-${{ matrix.policy }}-${{ matrix.platform }}-${{ steps.timestamp.outputs.timestamp }}
restore-keys: buildx-cache-${{ matrix.policy }}-${{ matrix.platform }}-

- name: Build
run: ./build.sh

- name: Deploy
if: github.event_name == 'push' && github.ref == 'refs/heads/manylinux2014' && github.repository == 'pypa/manylinux' && matrix.policy == 'manylinux2014'
run: ./deploy.sh
env:
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@ target/

# Prefetched source
docker/sources

# buildx cache
.buildx-cache-*/
45 changes: 0 additions & 45 deletions .travis.yml

This file was deleted.

12 changes: 10 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,16 @@ export DEVTOOLSET_ROOTPATH
export PREPEND_PATH
export LD_LIBRARY_PATH_ARG

docker build \
docker buildx build \
--load \
--cache-from=type=local,src=$(pwd)/.buildx-cache-${POLICY}_${PLATFORM} \
--cache-to=type=local,dest=$(pwd)/.buildx-cache-staging-${POLICY}_${PLATFORM} \
--build-arg POLICY --build-arg PLATFORM --build-arg BASEIMAGE \
--build-arg DEVTOOLSET_ROOTPATH --build-arg PREPEND_PATH --build-arg LD_LIBRARY_PATH_ARG \
--rm -t quay.io/pypa/${POLICY}_${PLATFORM}:${TRAVIS_COMMIT} \
--rm -t quay.io/pypa/${POLICY}_${PLATFORM}:${COMMIT_SHA} \
-f docker/Dockerfile docker/

if [ -d $(pwd)/.buildx-cache-${POLICY}_${PLATFORM} ]; then
rm -rf $(pwd)/.buildx-cache-${POLICY}_${PLATFORM}
fi
mv $(pwd)/.buildx-cache-staging-${POLICY}_${PLATFORM} $(pwd)/.buildx-cache-${POLICY}_${PLATFORM}
6 changes: 3 additions & 3 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
tag="quay.io/pypa/${POLICY}_${PLATFORM}"
build_id=$(git show -s --format=%cd-%h --date=short $TRAVIS_COMMIT)
build_id=$(git show -s --format=%cd-%h --date=short ${COMMIT_SHA})

docker login -u $QUAY_USERNAME -p $QUAY_PASSWORD quay.io
docker tag ${tag}:${TRAVIS_COMMIT} ${tag}:${build_id}
docker tag ${tag}:${TRAVIS_COMMIT} ${tag}:latest
docker tag ${tag}:${COMMIT_SHA} ${tag}:${build_id}
docker tag ${tag}:${COMMIT_SHA} ${tag}:latest
docker push ${tag}:${build_id}
docker push ${tag}:latest
2 changes: 1 addition & 1 deletion docker/build_scripts/install-runtime-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ else
exit 1
fi

BASETOOLS="autoconf automake bison bzip2 diffutils file hardlink make patch unzip"
BASETOOLS="autoconf automake bison bzip2 diffutils file hardlink hostname make patch unzip"
if [ "${AUDITWHEEL_POLICY}" == "manylinux2010" ]; then
PACKAGE_MANAGER=yum
BASETOOLS="${BASETOOLS} which"
Expand Down