Skip to content

Commit

Permalink
Rework multi-stage build to allow multiple archs
Browse files Browse the repository at this point in the history
  • Loading branch information
jlaine committed Feb 24, 2022
1 parent 41c651a commit 440640e
Showing 1 changed file with 30 additions and 41 deletions.
71 changes: 30 additions & 41 deletions .github/workflows/build-ffmpeg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@ jobs:
name: output
path: output/

build-aarch64-stage-1:
name: build (ubuntu-latest, aarch64) stage-1
build-qemu-stage-1:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [aarch64]
env:
pybin: /opt/python/cp38-cp38/bin
vendor: /tmp/vendor
img: quay.io/pypa/manylinux2014_aarch64
stage: 1
steps:
- uses: actions/checkout@v2
Expand All @@ -66,33 +65,27 @@ jobs:
python-version: 3.8
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- uses: actions/cache@v2
id: libs-cache
with:
path: vendor
key: ${{ runner.os }}-aarch64-libs-cache-${{ env.stage }}-${{ hashFiles('**/build-ffmpeg.py') }}
- name: Build FFmpeg dependencies
if: ${{ steps.libs-cache.outputs.cache-hit != 'true' }}
run: |
docker run -v $PWD:/project:rw --workdir=/project ${{ env.img }} bash -exc '
export PATH=${{ env.pybin }}:$PATH;
docker run -v $PWD:/project:rw --workdir=/project quay.io/pypa/manylinux2014_${{ matrix.arch }} bash -exc '
export PATH=/opt/python/cp38-cp38/bin:$PATH;
export CIBUILDWHEEL=1;
python scripts/build-ffmpeg.py ${{ env.vendor }} ${{ env.stage }};
cp -ar ${{ env.vendor }} /project;
python scripts/build-ffmpeg.py /tmp/vendor ${{ env.stage }};
cp -ar /tmp/vendor /project;
'
shell: bash
- uses: actions/upload-artifact@v2
with:
name: artifacts
name: artifacts-${{ matrix.arch }}
path: vendor
build-aarch64-stage-2:
name: build (ubuntu-latest, aarch64) stage-2
needs: build-aarch64-stage-1

build-qemu-stage-2:
needs: build-qemu-stage-1
runs-on: ubuntu-latest
strategy:
matrix:
arch: [aarch64]
env:
pybin: /opt/python/cp38-cp38/bin
vendor: /tmp/vendor
img: quay.io/pypa/manylinux2014_aarch64
stage: 2
steps:
- uses: actions/checkout@v2
Expand All @@ -103,34 +96,30 @@ jobs:
uses: docker/setup-qemu-action@v1
- uses: actions/download-artifact@v2
with:
name: artifacts
name: artifacts-${{ matrix.arch }}
path: vendor
- uses: actions/cache@v2
id: libs-cache
with:
path: vendor
key: ${{ runner.os }}-aarch64-libs-cache-${{ env.stage }}-${{ hashFiles('**/build-ffmpeg.py') }}
- name: Build FFmpeg dependencies
if: ${{ steps.libs-cache.outputs.cache-hit != 'true' }}
run: |
docker run -v $PWD:/project:rw --workdir=/project ${{ env.img }} bash -exc '
export PATH=${{ env.pybin }}:$PATH;
docker run -v $PWD:/project:rw --workdir=/project quay.io/pypa/manylinux2014_${{ matrix.arch }} bash -exc '
export PATH=/opt/python/cp38-cp38/bin:$PATH;
export CIBUILDWHEEL=1;
cp -ar vendor /tmp;
python scripts/build-ffmpeg.py ${{ env.vendor }} ${{ env.stage }};
cp -ar ${{ env.vendor }} /project;
python scripts/build-ffmpeg.py /tmp/vendor ${{ env.stage }};
cp -ar /tmp/vendor /project;
'
shell: bash
- uses: actions/upload-artifact@v2
with:
name: artifacts
name: artifacts-${{ matrix.arch }}
path: vendor
build-aarch64-stage-final:
name: build (ubuntu-latest, aarch64) stage-final
needs: build-aarch64-stage-2

build-qemu-stage-3:
needs: build-qemu-stage-2
runs-on: ubuntu-latest
strategy:
matrix:
arch: [aarch64]
env:
vendor: /tmp/vendor
stage: 3
steps:
- uses: actions/checkout@v2
Expand All @@ -141,13 +130,13 @@ jobs:
uses: docker/setup-qemu-action@v1
- uses: actions/download-artifact@v2
with:
name: artifacts
name: artifacts-${{ matrix.arch }}
path: vendor
- name: Build FFmpeg
env:
CIBW_ARCHS: aarch64
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_BEFORE_ALL_LINUX: cp -ar vendor /tmp
CIBW_BEFORE_BUILD: python scripts/build-ffmpeg.py ${{ env.vendor }} ${{ env.stage }}
CIBW_BEFORE_BUILD: python scripts/build-ffmpeg.py /tmp/vendor ${{ env.stage }}
CIBW_BUILD: cp38-*
CIBW_REPAIR_WHEEL_COMMAND_LINUX: LD_LIBRARY_PATH=/tmp/vendor/lib:$LD_LIBRARY_PATH auditwheel repair -w {dest_dir} {wheel}
CIBW_SKIP: "*musllinux*"
Expand Down

0 comments on commit 440640e

Please sign in to comment.