Skip to content

Commit

Permalink
Check ARM64 build
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquev6 committed Dec 4, 2024
1 parent 0ef8177 commit c97eb3a
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 87 deletions.
213 changes: 126 additions & 87 deletions .github/workflows/build-test-gha-branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,93 +27,93 @@ jobs:
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-x86_64:
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-x86_64
path: dist

check:
runs-on: ${{ matrix.os }}
needs:
- build-for-linux-x86_64
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

- run: lincs --version
- run: lincs --help

build-for-linux-arm64:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -144,3 +144,42 @@ jobs:
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 .
- name: Upload the wheel to GitHub Actions artifacts
uses: actions/upload-artifact@v4
with:
name: wheel-dist-${{ matrix.python_version }}-linux-arm64
path: dist

check-on-linux-arm64:
runs-on: ubuntu-24.04
needs:
- build-for-linux-arm64
strategy:
fail-fast: false
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
# DO NOT install any other dependencies, to test that the wheels are self-contained

- name: Get the code (for the Dockerfiles, not in the distributions)
uses: actions/checkout@v4

- name: Download the wheels from GitHub Actions artifacts
uses: actions/download-artifact@v4
with:
pattern: wheel-dist-${{ matrix.python_version }}-linux-arm64
path: dist

- name: Install the wheel and run 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/check.Dockerfile
image=$(docker buildx build --platform linux/arm64 --build-arg PYTHON_VERSION=${{ matrix.python_version }} --load . --file .github/workflows/linux-arm64/check.Dockerfile --quiet)
container=$(docker create --platform linux/arm64 $image)
docker cp $container:/output.txt - | tar --extract --to-stdout
11 changes: 11 additions & 0 deletions .github/workflows/linux-arm64/check.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ARG PYTHON_VERSION=3.8


FROM python:$PYTHON_VERSION AS build

ADD dist/*.whl .

RUN pip3 install --find-links . --pre lincs

RUN lincs --version >/output.txt
RUN lincs --help >>/output.txt

0 comments on commit c97eb3a

Please sign in to comment.