Dev api doc 2 #240
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
pull_request: | |
env: | |
# A fixed version used for testing, so that the builds don't | |
# spontaneously break after a few years. | |
# Make sure to update this from time to time. | |
RUST_VERSION: "1.74.0" | |
# This is the version currently used by `z3-sys`. | |
# If this ever changes, you might also need to increase | |
# the minimum macOS version below. | |
Z3_VERSION: "4.8.12" | |
MACOS_TARGET: "11.0" | |
PYTHON_VERSION: "3.12" | |
jobs: | |
tests-and-coverage: | |
# For reasons unbeknownst to mankind, llvm-cov segfaults on ubuntu runners | |
# when combined with pytest. The solution for now is to use macOS. | |
runs-on: macos-12 | |
env: | |
# These are the env variables set by llvm-cov, but modified such that they actually work in GH actions. | |
RUSTFLAGS: '-C instrument-coverage --cfg=coverage --cfg=trybuild_no_target' | |
LLVM_PROFILE_FILE: './target/biodivine-aeon-py-%p-%4m.profraw' | |
CARGO_LLVM_COV: 1 | |
CARGO_LLVM_COV_SHOW_ENV: 1 | |
CARGO_LLVM_COV_TARGET_DIR: './target' | |
steps: | |
# Here, we don't need to bother with the `manylinux` container, | |
# since we are only testing, not building multiplatform `wheel` files. | |
- name: Checkout. | |
uses: actions/checkout@v4 | |
- name: Setup Z3. | |
id: z3 | |
uses: cda-tum/setup-z3@v1 | |
with: | |
version: ${{ env.Z3_VERSION }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Explicitly add z3 to the include paths, because that's not what the installer is trained to do. | |
- run: echo "CPATH=$CPATH:$Z3_ROOT/include" >> $GITHUB_ENV | |
- run: echo "LIBRARY_PATH=$LIBRARY_PATH:$Z3_ROOT/bin" >> $GITHUB_ENV | |
- run: echo "DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$Z3_ROOT/bin" >> $GITHUB_ENV | |
- run: | | |
echo $CPATH | |
echo $LIBRARY_PATH | |
echo $DYLD_LIBRARY_PATH | |
ls -la $Z3_ROOT | |
ls -la $Z3_ROOT/include | |
ls -la $Z3_ROOT/bin | |
- name: Setup Python. | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
architecture: x64 | |
- name: Setup Rust toolchain. | |
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${{ env.RUST_VERSION }} | |
- name: Setup Rust/Python environment. | |
run: | | |
rustup component add llvm-tools-preview | |
cargo install cargo-llvm-cov | |
python3 -m venv venv | |
./venv/bin/pip3 install -r dev-requirements.txt | |
- run: | | |
source ./venv/bin/activate | |
cargo llvm-cov clean --workspace | |
cargo test | |
maturin develop | |
pytest ./tests --cov=biodivine_aeon --cov-report xml | |
cargo llvm-cov report --lcov --output-path coverage.lcov | |
- uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
files: coverage.lcov,coverage.xml | |
build-linux: | |
runs-on: ubuntu-latest | |
needs: [ tests-and-coverage ] | |
steps: | |
- name: Checkout. | |
uses: actions/checkout@v4 | |
# On linux, everything is installed in the container, | |
# so we don't really need any dependencies here. | |
- name: Maturin build. | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: x86_64 | |
container: daemontus/manylinux-aeon:latest | |
args: "--release --features static-z3 --compatibility manylinux_2_28 --out=target/dist" | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: target/dist | |
build-macos: | |
runs-on: macos-latest | |
needs: [ tests-and-coverage ] | |
steps: | |
- name: Checkout. | |
uses: actions/checkout@v4 | |
- name: Setup Z3. | |
id: z3 | |
uses: cda-tum/setup-z3@v1 | |
with: | |
version: ${{ env.Z3_VERSION }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Python. | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
architecture: x64 | |
- name: Setup Rust toolchain. | |
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${{ env.RUST_VERSION }} | |
# Explicitly add z3 to include path (probably some bug in either | |
# `setup-z3` or `z3-sys` crate, because this should not be necessary). | |
- run: echo "CPATH=$Z3_ROOT/include" >> $GITHUB_ENV | |
# The considered version of z3 needs at least this version of macOS. | |
- run: echo "MACOSX_DEPLOYMENT_TARGET=${{ env.MACOS_TARGET }}" >> $GITHUB_ENV | |
- run: echo "CMAKE_OSX_DEPLOYMENT_TARGET=${{ env.MACOS_TARGET }}" >> $GITHUB_ENV | |
- name: Maturin build. | |
uses: PyO3/maturin-action@v1 | |
with: | |
command: build | |
args: "--release --target universal2-apple-darwin --features static-z3 --out=target/dist" | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: target/dist | |
build-windows: | |
runs-on: windows-latest | |
needs: [ tests-and-coverage ] | |
steps: | |
- name: Checkout. | |
uses: actions/checkout@v4 | |
- name: Setup Python. | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
architecture: x64 | |
- name: Setup Rust toolchain. | |
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${{ env.RUST_VERSION }} | |
# Surprisingly, windows is the easiest. Just build the thing. | |
- name: Maturin build. | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: x64 | |
args: "--release --features static-z3 --out=target/dist" | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: target/dist | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
if: "startsWith(github.ref, 'refs/tags/')" | |
needs: [ build-macos, build-windows, build-linux ] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
- name: Publish to PyPI | |
uses: PyO3/maturin-action@v1 | |
env: | |
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
with: | |
command: upload | |
args: --skip-existing * | |
conda_deployment_with_new_tag: | |
name: Conda deployment (${{ matrix.os }}) | |
if: "startsWith(github.ref, 'refs/tags/')" | |
needs: [ tests-and-coverage ] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
# For now, windows builds are broken... | |
os: [macos-latest, ubuntu-latest] | |
python: ["3.9", "3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Conda environment creation and activation | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: ${{ matrix.python }} | |
environment-file: conda_env.yaml | |
auto-update-conda: false | |
auto-activate-base: false | |
show-channel-urls: true | |
- name: Build and upload the conda packages | |
uses: uibcdf/[email protected] | |
with: | |
python-version: ${{ matrix.python }} | |
meta_yaml_dir: "conda" | |
user: daemontus | |
label: main | |
overwrite: false | |
token: ${{ secrets.ANACONDA_TOKEN }} |