Skip to content

CI

CI #154

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For MacOs builds, GNU GCC is installed via Homebrew, and the CC/CXX environment variables are set to use it.
# The echo "CC=..." >> $GITHUB_ENV syntax is used to set environment variables for the next steps in the workflow.
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: CI
on:
push:
branches: [ "master", "dev" ]
pull_request:
branches: [ "master", "dev" ]
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
jobs:
build:
strategy:
fail-fast: false
matrix:
python-version: ["3.9"]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: recursive
- name: (MacOs only) Install build dependencies
if: matrix.os == 'macos-latest'
run: |
# Install Homebrew LLVM toolchain with OpenMP support
brew install llvm libomp
if [[ $(uname -m) == "arm64" ]]; then BREW_PREFIX="/opt/homebrew"; else BREW_PREFIX="/usr/local"; fi
echo "PATH=$BREW_PREFIX/opt/llvm/bin:$PATH" >> $GITHUB_ENV
echo "CC=$BREW_PREFIX/opt/llvm/bin/clang" >> $GITHUB_ENV
echo "CXX=$BREW_PREFIX/opt/llvm/bin/clang++" >> $GITHUB_ENV
echo "CPPFLAGS=-I$BREW_PREFIX/opt/libomp/include" >> $GITHUB_ENV
echo "CFLAGS=-arch $(uname -m)" >> $GITHUB_ENV
echo "CXXFLAGS=-arch $(uname -m)" >> $GITHUB_ENV
echo "LDFLAGS=-arch $(uname -m) -L$BREW_PREFIX/opt/libomp/lib" >> $GITHUB_ENV
echo "ARCHFLAGS=-arch $(uname -m)" >> $GITHUB_ENV
echo "CMAKE_OSX_ARCHITECTURES=$(uname -m)" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion)" >> $GITHUB_ENV
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
- name: (Manual) Setup tmate session for interactive debugging via SSH
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install package verbosely
run: |
python -c "open('.cov','w').close()" # trigger Cython compilation with coverage support
ls
python -m pip install -v -v .
- name: Test with pytest
run: |
python -m pip install cython==3.0.2 pytest-cov
pytest --cov .
- name: Upload report to Codecov
uses: codecov/codecov-action@v3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: OS,PYTHON