Skip to content

Partially revert fcdf134c: restore learnings using neither OR-Tool no… #49

Partially revert fcdf134c: restore learnings using neither OR-Tool no…

Partially revert fcdf134c: restore learnings using neither OR-Tool no… #49

# 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-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 Boost
run: |
cd /home/runner/work
wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz
tar xf boost_*.tar.gz
rm boost_*.tar.gz
cd boost_*
sudo cp -r boost /usr/local/include
- 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
- run: lincs generate classification-problem 3 2 | tee problem.yml
- run: lincs generate classification-model problem.yml | tee model.yml
- run: lincs generate classified-alternatives problem.yml model.yml 100
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 (only for '.github/workflows/linux-arm64/build.Dockerfile')
uses: actions/checkout@v4
- name: Download the source distribution from GitHub Actions artifacts
uses: actions/download-artifact@v4
with:
name: source-dist
path: wd
- name: Build the wheel, make it machine-independent and check it (during a Docker build in Qemu)
run: |
cp .github/workflows/linux-arm64/build.Dockerfile wd/Dockerfile
cd wd
find -type f
docker buildx build --platform linux/arm64 --build-arg PYTHON_VERSION=${{ matrix.python_version }} --load .
image=$(docker buildx build --platform linux/arm64 --build-arg PYTHON_VERSION=${{ matrix.python_version }} --load . --quiet)
container=$(docker create --platform linux/arm64 $image)
docker cp $container:/wd/dist .
find -type f
- name: Upload the wheel to GitHub Actions artifacts
uses: actions/upload-artifact@v4
with:
name: wheel-dist-${{ matrix.python_version }}-linux-arm64
path: wd/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 (only for '.github/workflows/linux-arm64/check.Dockerfile')
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
merge-multiple: true
path: wd
- name: Install the wheel and run it (during a Docker build in Qemu)
run: |
cp .github/workflows/linux-arm64/check.Dockerfile wd/Dockerfile
cd wd
find . -type f
docker buildx build --platform linux/arm64 --build-arg PYTHON_VERSION=${{ matrix.python_version }} --load .
image=$(docker buildx build --platform linux/arm64 --build-arg PYTHON_VERSION=${{ matrix.python_version }} --load . --quiet)
container=$(docker create --platform linux/arm64 $image)
docker cp $container:/output.txt - | tar --extract --to-stdout
find . -type f