Skip to content

Add C++ unit tests run after build in CI #25

Add C++ unit tests run after build in CI

Add C++ unit tests run after build in CI #25

---
name: Multiplatform Build
on:
push:
branches:
- "*"
schedule:
- cron: 0 12 * * 6
workflow_dispatch:
concurrency:
group: ${{ github.action_path }}-${{ github.ref }}-multiplatform-build
cancel-in-progress: false
jobs:
multiplatform-build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, windows-2019, windows-2022]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/[email protected]
- if: startsWith(matrix.os, 'windows')
name: Install LLVM and Clang
uses: KyleMayes/[email protected]
with:
version: "18"
arch: "x64"
env: true
- if: startsWith(matrix.os, 'ubuntu')
name: Install ubuntu specific dependencies
run: |
sudo add-apt-repository universe
sudo add-apt-repository restricted
sudo add-apt-repository multiverse
sudo apt-get update
sudo apt-get install -y build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm \
libncurses5-dev libncursesw5-dev xz-utils tk-dev \
libffi-dev liblzma-dev python3-openssl git
gcc --version
clang --version
- if: endsWith(matrix.os, '20.04')
name: Install ubuntu-20.04 specific dependencies
run: |
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y libtinfo5
gcc --version
- if: endsWith(matrix.os, '22.04')
name: Install ubuntu-22.04 specific dependencies
run: |
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y libtinfo5
gcc --version
- if: endsWith(matrix.os, '24.04')
name: Install ubuntu-24.04 specific dependencies
run: |
sudo add-apt-repository "deb http://mirrors.kernel.org/ubuntu/ jammy main"
sudo add-apt-repository "deb http://mirrors.kernel.org/ubuntu/ jammy universe"
sudo add-apt-repository "deb http://mirrors.kernel.org/ubuntu/ jammy multiverse"
sudo apt-get update
sudo apt-get install -y libtinfo5
gcc --version
- if: startsWith(matrix.os, 'windows')
name: Install Python dependencies
run: |
chcp 65001 #set code page to utf-8
- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
architecture: "x64"
- name: Install Poetry
run: pip install poetry==1.8.3
- name: Install project dependencies
run: poetry install --no-cache --sync --no-root
- name: Build distribution package
run: poetry build --format wheel
- uses: actions/upload-artifact@v4
with:
name: build-${{ github.sha }}-${{ matrix.os }}-${{ matrix.python-version }}
path: ./dist/*
- if: startsWith(matrix.os, 'ubuntu')
name: Add virtual environment binaries to PATH
run: echo "$(poetry env info --path)/bin" >> "$GITHUB_PATH
- if: startsWith(matrix.os, 'windows')
name: Add virtual environment binaries to PATH
run: echo "$(poetry env info --path)/Scripts" >> "$GITHUB_PATH
- name: Run unit tests
run: poetry run poe ctest