testing workflow #6
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 and Test | |
on: | |
push: | |
branches: [main, workflow] | |
pull_request: | |
branches: [main, workflow] | |
jobs: | |
build-and-test: | |
name: Build and Test on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" # For Google Test | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install system dependencies (Ubuntu) | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
python3-dev \ | |
pybind11-dev \ | |
ninja-build \ | |
cmake \ | |
build-essential | |
pip install "pybind11[global]" | |
- name: Install build dependencies (macOS) | |
if: runner.os == 'macOS' | |
run: | | |
brew install ninja pybind11 cmake | |
pip install --upgrade pip | |
pip install pytest meson meson-python numpy | |
# Verify ninja is installed and in PATH | |
which ninja | |
ninja --version | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest meson meson-python ninja numpy | |
- name: Configure Meson | |
run: meson setup build | |
- name: Build | |
run: meson compile -C build | |
- name: Run C++ Tests | |
run: meson test -C build -v | |
- name: Install Python Package | |
run: pip install -e . | |
- name: Run Python Tests | |
run: pytest python/tests -v | |
- name: Upload Test Results | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-results-${{ matrix.os }}-py${{ matrix.python-version }} | |
path: | | |
build/meson-logs/testlog.txt | |
build/meson-logs/meson-log.txt |