Skip to content

Try to actually build in Qemu #41

Try to actually build in Qemu

Try to actually build in Qemu #41

# WARNING: There is a lot of duplication between .yml workflows because I don't know (yet) how
# to factorize these workflows. Keep things in sync.
name: Test building on GitHub Actions
on:
push:
branches:
- test-gha/*
jobs:
make-source-dist:
runs-on: ubuntu-20.04
steps:
- name: Install dependencies
run: pip3 install build twine
- name: Get the code
uses: actions/checkout@v4
- name: Build the source distribution
run: python3 -m build --sdist
- name: Check the source distribution
run: twine check dist/*
- name: Upload the source distribution to GitHub Actions artifacts
uses: actions/upload-artifact@v4
with:
name: source-dist
path: dist
# build-for-linux:
# runs-on: ubuntu-20.04
# needs:
# - make-source-dist
# strategy:
# matrix:
# python_version: ['3.8']
# steps:
# - name: Install Python
# uses: actions/setup-python@v5
# with:
# python-version: ${{ matrix.python_version }}
# - name: Install Python packages
# run: pip${{ matrix.python_version }} install build auditwheel twine Chrones
# - name: Install patchelf
# run: |
# cd /home/runner/work
# mkdir patchelf
# cd patchelf
# wget https://github.com/NixOS/patchelf/releases/download/0.18.0/patchelf-0.18.0-x86_64.tar.gz
# tar xf *.tar.gz
# sudo cp bin/patchelf /usr/local/bin
# - name: Download the source distribution from GitHub Actions artifacts
# uses: actions/download-artifact@v4
# with:
# name: source-dist
# - name: Unzip the source distribution
# run: |
# tar xf *.tar.gz
# rm *.tar.gz
# - name: Build the wheel
# run: python${{ matrix.python_version }} -m build --wheel --outdir local-dist lincs-*
# - name: Make the wheel machine-independent
# run: auditwheel repair --plat manylinux_2_31_x86_64 --strip local-dist/*.whl --wheel-dir dist
# - name: Check the wheel
# run: twine check dist/*.whl
# - name: Upload the wheel to GitHub Actions artifacts
# uses: actions/upload-artifact@v4
# with:
# name: wheel-dist-${{ matrix.python_version }}-linux
# path: dist
# check:
# runs-on: ${{ matrix.os }}
# needs:
# - build-for-linux
# strategy:
# fail-fast: false
# matrix:
# os:
# - ubuntu-20.04
# python_version: ['3.8']
# exclude:
# # Older Python versions don't build 'universal2' wheels, so they can't run on the M1 runner that run macOS 14 and 15
# - os: macos-14
# python_version: '3.8'
# - os: macos-15
# python_version: '3.8'
# - os: macos-14
# python_version: '3.9'
# - os: macos-15
# python_version: '3.9'
# - os: macos-14
# python_version: '3.10'
# - os: macos-15
# python_version: '3.10'
# steps:
# - name: Install Python
# uses: actions/setup-python@v5
# with:
# python-version: ${{ matrix.python_version }}
# # DO NOT install any other dependencies, to test that the wheels are self-contained
# - name: Download the wheels from GitHub Actions artifacts
# uses: actions/download-artifact@v4
# with:
# pattern: wheel-dist-${{ matrix.python_version }}-*
# merge-multiple: true
# - name: Install the wheel
# run: pip${{ matrix.python_version }} install --find-links . --pre lincs
# - name: Run lincs
# run: lincs --help
build-for-linux-arm64:
runs-on: ubuntu-20.04
needs:
- make-source-dist
strategy:
matrix:
python_version: ['3.8']
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Get the code (for the Dockerfiles, not in the source distribution)
uses: actions/checkout@v4
- name: Download the source distribution from GitHub Actions artifacts
uses: actions/download-artifact@v4
with:
name: source-dist
- name: Build the wheel, make it machine-independent and check it (during a Docker build in Qemu)
run: |
docker buildx build --platform linux/arm64 --build-arg PYTHON_VERSION=${{ matrix.python_version }} --load . --file .github/workflows/linux-arm64/build.Dockerfile
image=$(docker buildx build --platform linux/arm64 --build-arg PYTHON_VERSION=${{ matrix.python_version }} --load . --file .github/workflows/linux-arm64/build.Dockerfile --quiet)
container=$(docker create --platform linux/arm64 $image)
docker cp $container:/wd/dist .