Skip to content

build_and_test

build_and_test #66

name: build_and_test
on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
# 3 am Tuesdays and Fridays
- cron: "0 3 * * 2,5"
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
defaults:
run:
shell: bash
concurrency:
group: "${{ github.ref }}-${{ github.head_ref }}-${{ github.worfklow }}"
cancel-in-progress: true
jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 12
fail-fast: false
matrix:
#specific instruction sets and the fallthrough case (" ").
instruction_set_flag: ["-DDISTOPIA_DISPATCH=ON",
"-DDISTOPIA_MANUAL_SELECT_SIMD=ON -DDISTOPIA_USE_SSE4_1=ON -DDISTOPIA_BUILD_TEST=ON",
"-DDISTOPIA_MANUAL_SELECT_SIMD=ON -DDISTOPIA_USE_AVX=ON -DDISTOPIA_BUILD_TEST=ON",
"-DDISTOPIA_MANUAL_SELECT_SIMD=ON -DDISTOPIA_USE_AVX2=ON -DDISTOPIA_BUILD_TEST=ON",
"-DDISTOPIA_DISPATCH=ON -DDISTOPIA_DISPATCH_MANUAL=ON -DDISTOPIA_USE_SSE3=ON -DDISTOPIA_USE_SSE4_1=ON -DDISTOPIA_USE_AVX=ON -DDISTOPIA_BUILD_TEST=ON"]
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: macos-latest
cxx_compiler: "clang++"
c_compiler: "clang"
- os: ubuntu-latest
cxx_compiler: "g++"
c_compiler: "gcc"
- os: windows-latest
cxx_compiler: "cl"
c_compiler: "cl"
exclude:
# excludes AVX2 on macOS as the VM doesn't seem to support some AVX2 instructions.
- os: macos-latest
instruction_set_flag: "-DDISTOPIA_MANUAL_SELECT_SIMD=ON -DDISTOPIA_USE_AVX2=ON -DDISTOPIA_BUILD_TEST=ON"
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: BSFishy/pip-action@v1
with:
requirements: requirements.txt
- name: check_env
run: |
which python
python -m pip list
- name: Build
# Execute the build. You can specify a specific target with "--target <NAME>"
run: python setup.py build -- ${{ matrix.instruction_set_flag }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }}
- name: Test
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --test-dir _skbuild/*/cmake-build/libdistopia
pip-install:
# A pure Python install, which relies purely on pyproject.toml contents
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# for now windows pip install builds seem to fail for some reason
os: [ubuntu-latest, macos-latest,]
python: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: check_env
run: |
which python
python -m pip list
- name: build
run: python -m pip install .
- name: test
run: ctest --test-dir _skbuild/*/cmake-build/libdistopia
- name: install_pytest
run: pip install pytest
- name: python_test
# run python API tests
run: pytest distopia/tests