-
Notifications
You must be signed in to change notification settings - Fork 2
120 lines (103 loc) · 4.28 KB
/
test-all.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Workflow settings
# See https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
name: Test DemoApps # GUI display name
on: # Triggers, see https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
concurrency: # Concurrency group: which jobs run together and which cancel each other
group: CI-${{ github.head_ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false # true -> cancel all jobs if any fails
max-parallel: 8
# Build matrix for your jobs: you can define different variations to run each job in
# matrix configurations - reachable with ${{ matrix.config.<key> }}.
# Extra options:
# - cxx: path to C++ compiler
# - mode: build mode inside Pressio (Debug / Release)
matrix:
config:
- { cxx: clang++, mode: Release }
- { cxx: clang++, mode: Debug }
- { cxx: g++, mode: Release }
- { cxx: g++, mode: Debug }
env: # environment variables available to all steps
CXX: ${{ matrix.config.cxx }}
APT_PACKAGES: python3 pip python-is-python3 g++ clang gpg wget
PIP_PACKAGES: pytest build numpy scipy matplotlib
DEMOAPPS_HOME: /home/runner/work/pressio-demoapps/pressio-demoapps
BUILD_DIR: /home/runner/work/build/pressio-demoapps
steps:
- uses: actions/checkout@v2 # check out the repository with submodules
with: { submodules: recursive }
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install -y --install-suggests $APT_PACKAGES
- name: Install CMake
run: |
export CMAKE_KEYRING=/usr/share/keyrings/kitware-archive-keyring.gpg
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null \
| gpg --dearmor - \
| sudo tee $CMAKE_KEYRING >/dev/null
echo "deb [signed-by=$CMAKE_KEYRING] https://apt.kitware.com/ubuntu/ focal main" \
| sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null
sudo apt-get update
rm $CMAKE_KEYRING
sudo apt-get install -y kitware-archive-keyring cmake
- name: Check environment
run: |
echo ======================================================
echo CPU Threads: $(grep -c processor /proc/cpuinfo)
echo ======================================================
echo $(which $CXX) --version
$CXX --version
echo ======================================================
echo $(which python) --version
python --version
echo ======================================================
echo Source directory: $DEMOAPPS_HOME
echo Build directory: $BUILD_DIR
echo ======================================================
git --version
cd $DEMOAPPS_HOME
git status
- name: Install required Python modules
run: |
sudo pip install $PIP_PACKAGES
echo ======================================================
pip list
echo ======================================================
- name: Configure C++ tests
run: |
cmake \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DCMAKE_BUILD_TYPE:STRING=${{ matrix.config.mode }} \
-DPRESSIODEMOAPPS_ENABLE_TESTS:BOOL=ON \
-DPRESSIODEMOAPPS_ENABLE_BINDINGS:BOOL=OFF \
-DCMAKE_CXX_FLAGS="-Wall -Werror" \
-B $BUILD_DIR -S $DEMOAPPS_HOME
# NOTE: -j2 caused g++ crash (out of memory)
- name: Build C++ tests
run: |
export NUM_CPU=$(grep -c processor /proc/cpuinfo)
cmake --build $BUILD_DIR -j $NUM_CPU
- name: Run C++ tests
run: |
export NUM_CPU=$(grep -c processor /proc/cpuinfo)
cd $BUILD_DIR
ctest -j $NUM_CPU --output-on-failure
- name: Install Python package
run: |
cd $DEMOAPPS_HOME
python cmake_build.py --build_mode=${{ matrix.config.mode }}
pip install .
- name: Run Python tests
run: |
cd $DEMOAPPS_HOME
pytest -s