Combine workflows into one github workflow file #4
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: | |
pull_request: | |
branches: [ main ] | |
schedule: | |
- cron: '0 12 * * FRI' | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
defaults: | |
run: | |
shell: bash -l {0} | |
env: | |
QT_QPA_PLATFORM: offscreen | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Setup Miniconda | |
uses: conda-incubator/[email protected] | |
with: | |
miniforge-variant: Mambaforge | |
environment-file: conda/testing.yml | |
activate-environment: test-env | |
- name: Build & Install Project - Ubuntu | |
if: matrix.os == 'ubuntu-latest' | |
env: | |
ENV_DIR: /usr/share/miniconda3/envs/test-env/ | |
run: | | |
cmake --preset=ninja -DPYTHON_EXECUTABLE=$ENV_DIR/bin/python -Dpybind11_DIR=$ENV_DIR/share/cmake/pybind11 -DCMAKE_INSTALL_PREFIX=$ENV_DIR -DCMAKE_INSTALL_LIBDIR=$ENV_DIR/lib/python3.8/site-packages . | |
cd ../build | |
ninja | |
ninja install | |
$ENV_DIR/bin/python -m pip install --ignore-installed ../N-Body-Simulations | |
- name: Build & Install Project - Windows | |
if: matrix.os == 'windows-latest' | |
env: | |
ENV_DIR: C:/Miniconda3/envs/test-env/ | |
run: | | |
cmake --preset=vs-release-ci -DPYTHON_EXECUTABLE=$ENV_DIR/python.exe -Dpybind11_DIR=$ENV_DIR/Library/share/cmake/pybind11 -DCMAKE_INSTALL_PREFIX=$ENV_DIR/Library -DCMAKE_INSTALL_LIBDIR=$ENV_DIR/Lib/site-packages . | |
cmake --build ../build --config Release | |
cmake --build ../build --config Release --target install | |
$ENV_DIR/python.exe -m pip install --ignore-installed . | |
- name: Cpp Unit Tests | |
env: | |
TESTPATH: ${{ github.workspace }}/../build/tests/unit_tests/cpp | |
run: | | |
$TESTPATH/NBodySimulationsUnitTests | |
- name: Cpp System Tests | |
env: | |
TESTPATH: ${{ github.workspace }}/../build/tests/system_tests/cpp | |
run: | | |
$TESTPATH/NBodySimulationsSystemTests | |
- name: Python Unit Tests | |
run: | | |
xvfb-run --server-args="-core -noreset -screen 0 640x480x24" --server-num=101 coverage run -m pytest tests/unit_tests/python/ | |
- name: Report Unit Test Coverage | |
if: matrix.os == 'ubuntu-latest' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
coveralls --service=github | |
coverage report | |
- name: Python System Tests | |
run: | | |
xvfb-run --server-args="-core -noreset -screen 0 640x480x24" --server-num=101 pytest tests/system_tests/python/ |