Skip to content

Commit a1dcbb4

Browse files
committed
Add first GitHub Actions workflow
This resembles what we had in Travis, albeit simpler. We can add more cases if we want to in the future though. Signed-off-by: Rodrigo Tobar <[email protected]>
1 parent b8ff5c0 commit a1dcbb4

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

.github/workflows/build-and-test.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Build and run tests
2+
on: [push, pull_request]
3+
4+
env:
5+
CI_BUILD_DIR: build
6+
CXX: g++
7+
CMAKE_PREFIX_PATH: 3rdparty/cxxtest
8+
9+
jobs:
10+
build_and_test:
11+
name: Build and test. OS=${{ matrix.os }}, math=${{ matrix.use_r && 'RMath' || 'GSL' }}, build=${{ matrix.poor_build && 'poor' || 'rich' }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
include:
16+
- os: ubuntu-latest
17+
- os: ubuntu-latest
18+
poor_build: true
19+
- os: ubuntu-latest
20+
use_r: true
21+
- os: ubuntu-latest
22+
cxx: clang++
23+
- os: macos-latest
24+
omp: false
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
submodules: true
30+
31+
- name: Establish C++ compiler
32+
env:
33+
CXX: ${{ matrix.cxx || env.CXX }}
34+
run:
35+
echo CXX=$CXX >> "$GITHUB_ENV"
36+
37+
- name: Install system dependencies (Linux)
38+
env:
39+
REQUIRED_DEPS: ninja-build
40+
OPTIONAL_DEPS: ${{ ! matrix.poor_build && 'libfftw3-dev opencl-headers' || '' }}
41+
MATH_DEPS: ${{ matrix.use_r && 'r-mathlib' || 'libgsl-dev' }}
42+
if: ${{ matrix.os == 'ubuntu-latest' }}
43+
run: |
44+
sudo apt install $CXX $REQUIRED_DEPS $MATH_DEPS $OPTIONAL_DEPS
45+
46+
- name: Install system dependencies (MacOS)
47+
if: ${{ matrix.os == 'macos-latest' }}
48+
run: |
49+
brew install ninja gsl fftw
50+
51+
- name: Configure
52+
env:
53+
LIBPROFIT_NO_OPENMP: ${{ matrix.omp && 'OFF' || 'ON' }}
54+
LIBPROFIT_USE_R: ${{ matrix.use_r && 'ON' || 'OFF' }}
55+
CMAKE_EXTRA_FLAGS: ${{ matrix.poor_build && '-DLIBPROFIT_NO_OPENCL=ON -DLIBPROFIT_NO_OPENMP=ON -DLIBPROFIT_NO_FFTW=ON -DLIBPROFIT_NO_SIMD=ON' || '' }}
56+
run: |
57+
cmake -B ${CI_BUILD_DIR} -G Ninja \
58+
-DLIBPROFIT_NO_OPENMP=$LIBPROFIT_NO_OPENMP \
59+
-DLIBPROFIT_TEST=ON \
60+
-DLIBPROFIT_USE_R=$LIBPROFIT_USE_R \
61+
-DCMAKE_CXX_COMPILER=$CXX \
62+
$CMAKE_EXTRA_FLAGS
63+
64+
- name: Build
65+
run: cmake --build ${CI_BUILD_DIR}
66+
67+
# Let MacOS tests fail until OpenCL issues are identified
68+
- name: Run unit tests
69+
run: |
70+
cd ${CI_BUILD_DIR}
71+
ctest --output-on-failure || ${{ matrix.os == 'macos-latest' && 'true' || 'false' }}

0 commit comments

Comments
 (0)