ci: Use Python virtual environment. #1247
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
on: [push, pull_request] | |
name: CI | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, macos-14] | |
name: [ | |
release, | |
debug, | |
] | |
include: | |
- name: release | |
config: --testing --no-unit-testing --python | |
- name: debug | |
config: debug --python | |
- name: release-clang | |
os: ubuntu-latest | |
config: --testing --no-unit-testing --python | |
env: CC=clang CXX=clang++ | |
- name: debug-clang | |
os: ubuntu-latest | |
config: debug --shared --python | |
env: CC=clang CXX=clang++ | |
- name: release-win64 | |
os: ubuntu-latest | |
config: --win64 | |
- name: release-aarch64 | |
os: ubuntu-latest | |
config: --arm64 | |
name: ${{ matrix.os }}:${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Install Packages (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgmp-dev ninja-build | |
if [[ "${{matrix.name}}" == "release-win64" ]]; then | |
sudo apt-get install -y mingw-w64 | |
sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix | |
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix | |
fi | |
if [[ "${{matrix.name}}" == "release-aarch64" ]]; then | |
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
fi | |
- name: Install Packages (macOS) | |
if: runner.os == 'macOS' | |
run: brew install gmp pkgconfig ninja | |
- name: Setup Python Environment | |
run: | | |
python3 -m venv ~/.venv | |
source ~/.venv/bin/activate | |
python3 -m pip install meson pytest cython>=3.* | |
echo "$HOME/.venv/bin/" >> $GITHUB_PATH | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ssh-key: ${{ secrets.BZLA_LIBS_KEY }} | |
submodules: 'recursive' | |
- name: Wrap | |
run: meson wrap install gtest | |
- name: Configure | |
run: ${{ matrix.env }} ./configure.py --prefix=${{ github.workspace }}/build/install ${{ matrix.config }} | |
- name: Build | |
run: ninja install | |
working-directory: build | |
- name: Test | |
if: matrix.name != 'release-win64' && matrix.name != 'release-aarch64' | |
run: meson test --print-errorlogs | |
working-directory: build | |
- name: Examples | |
if: matrix.name != 'release-win64' && matrix.name != 'release-aarch64' | |
working-directory: examples | |
run: | | |
pkgconfigdir=$(find ${{ github.workspace }}/build/install/lib -name pkgconfig) | |
pythonlibdir=$(find ${{ github.workspace }}/build/install/lib -name site-packages) | |
meson setup build --pkg-config-path=$pkgconfigdir -Dpython_path=$pythonlibdir | |
cd build | |
meson test |