Skip to content

Commit

Permalink
Merge pull request #45 from JohanMabille/ci
Browse files Browse the repository at this point in the history
Added environment-dev file and updated CI
  • Loading branch information
JohanMabille authored Jun 4, 2024
2 parents 67e74a1 + eb14f6c commit 1dfb441
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 41 deletions.
111 changes: 70 additions & 41 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,91 @@
name: CMake Build
name: CI

on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main

env:
BUILD_TYPE: Release
defaults:
run:
shell: bash -l {0}

jobs:
build:
unix:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
os: [ubuntu-latest, macOS-latest]

steps:
- uses: actions/checkout@v2

- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2.0.0

- name: Install Dependencies
shell: bash -l {0}
run: conda install cmake xtl xproperty nlohmann_json -c conda-forge
- uses: actions/checkout@v4

- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build

- name: Check Environment
shell: bash -l {0}
run: conda info
- name: Install mamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment-dev.yml
environment-name: xvega

- name: Make build directory
run: mkdir build

- name: Configure CMake
working-directory: ${{runner.workspace}}/build
shell: bash -l {0}
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DDOWNLOAD_GTEST=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
run: |
cmake .. \
-DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DCMAKE_BUILD_TYPE=Release \
-DDOWNLOAD_GTEST=ON
working-directory: build

- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash -l {0}
run: cmake --build . --config $BUILD_TYPE --target install

- name: Run Tests Windows
if: matrix.os == 'windows-latest'
working-directory: ${{runner.workspace}}/build/test/Release
shell: bash -l {0}
run: ./test_xvega_lib.exe

- name: Run Tests Unix
if: matrix.os != 'window-latest'
working-directory: ${{runner.workspace}}/build/test
shell: bash -l {0}
run: make -j8
working-directory: build

- name: Tests
run: ./test_xvega_lib
working-directory: build/test

windows:
runs-on: windows-latest
defaults:
run:
shell: cmd /C call {0}

steps:
- uses: actions/checkout@v4

- name: Install mamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment-dev.yml
environment-name: xvega
init-shell: cmd.exe

- name: Make build directory
run: mkdir build

- name: Configure CMake
run: |
cmake .. ^
-GNinja ^
-DCMAKE_PREFIX_PATH="%CONDA_PREFIX%\Library" ^
-DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX% ^
-DCMAKE_BUILD_TYPE=Release ^
-DDOWNLOAD_GTEST=ON
working-directory: build

- name: Build
run: |
set CL=/MP
ninja
working-directory: build

# TODO: enable this when the migration to doctest is done
# - name: Tests
# run: |
# test_xvega_lib
# working-directory: build\test
13 changes: 13 additions & 0 deletions environment-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: xvega
channels:
- conda-forge
dependencies:
# build dependencies
- cmake
- cxx-compiler
- ninja
# host Dependencies
- xtl=0.7.0
- xproperty=0.11.0
- nlohmann_json=3.11.2

0 comments on commit 1dfb441

Please sign in to comment.