Skip to content

CI

CI #155

Workflow file for this run

name: CI
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
branches:
- master
env:
BUILD_TYPE: Release
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
python-version:
- "3.8"
- "3.11"
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
# this will set the system compiler;
# This must be done *before* setting up miniconda, see:
# https://github.com/ilammy/msvc-dev-cmd/issues/34
- name: Set Windows env
if: matrix.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1
- name: Cache conda
uses: actions/cache@v3
env:
# Increase this value to reset cache if .github/environment.yml has not changed
CACHE_NUMBER: 1
with:
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('.github/environment.yml') }}
- uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: "*"
auto-update-conda: true
auto-activate-base: false
activate-environment: cppe-gha
environment-file: .github/environment.yml
channel-priority: strict
python-version: ${{ matrix.python-version }}
- name: Select CMake CLI options
run: |
echo "We are running on ${{ matrix.os }}"
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
echo "CXX=g++" >> $GITHUB_ENV
elif [ "${{ matrix.os }}" == "macos-latest" ]; then
echo "CXX=clang++" >> $GITHUB_ENV
else
echo "CXX=clang-cl" >> $GITHUB_ENV
fi
- name: Configure
run: |
cmake -S. \
-Bbuild \
-GNinja \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_CXX_COMPILER=${CXX} \
-DCMAKE_INSTALL_PREFIX=~/Software
- name: Build and install
run: |
cmake --build build --config ${{ env.BUILD_TYPE }} --target install -- -v -d stats
- name: Test
run: |
python -m pip install git+https://gitlab.com/robertodr/polarizationsolver.git@master
cd
if [ "${{ matrix.os }}" == "windows-latest" ]; then
export KMP_DUPLICATE_LIB_OK=TRUE
export PYTHONPATH=Software/Lib/site-packages
python -m pytest --capture=no --log-cli-level=INFO --color=yes --pyargs cppe
else
export PYTHONPATH=$PYTHONPATH:Software/lib/python${{ matrix.python-version }}/site-packages
python -m pytest --capture=no --log-cli-level=INFO --color=yes --pyargs cppe
fi
# TODO move to separate workflow
#- name: Build and Test Setuptools
# run: |
# rm -rf build
# python setup.py install
# py.test