-
Notifications
You must be signed in to change notification settings - Fork 18
105 lines (89 loc) · 3.38 KB
/
ci-cmake_tests.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
name: Tests and Codecov
on:
pull_request:
branches:
- master
- dev-master
workflow_dispatch:
jobs:
BuildAndTest:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
# Specify python version your environment will have. Remember to quote this, or
# YAML will think you want python 3.1 not 3.10
python-version: "3.11"
# This uses *miniforge*, rather than *minicond*. The primary difference is that
# the defaults channel is not enabled at all
miniforge-version: latest
# These properties enable the use of mamba, which is much faster and far less error
# prone than conda while being completely compatible with the conda CLI
use-mamba: true
mamba-version: "*"
- name: Install dependencies
shell: bash -l {0}
run: |
mamba install _openmp_mutex=*=*_llvm cmake make boost git compilers numpy mkl mkl-include mkl-service pybind11 libblas=*=*mkl beartype
python -m pip install gcovr
mamba install gtest
mamba install pytest pytest-cov
- name: CPU info
shell: bash -l {0}
run: lscpu
- name: Configure CMake
shell: bash -l {0}
run: cmake -S ${{github.workspace}} -B ${{github.workspace}}/build -DCMAKE_INSTALL_PREFIX=/home/runner/work/Cytnx_lib -DUSE_MKL=on -DUSE_HPTT=on -DHPTT_ENABLE_FINE_TUNE=on -DHPTT_ENABLE_AVX=off -DBUILD_PYTHON=on -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DRUN_TESTS=on
- name: Build
shell: bash -l {0}
working-directory: ${{github.workspace}}/build
run: |
cmake --version
cmake --build . -j `nproc`
- name: Run CTest
shell: bash -l {0}
working-directory: ${{github.workspace}}/build
run: GTEST_COLOR=1 ctest --output-on-failure --output-junit junit.xml
- name: Run gcovr
shell: bash -l {0}
working-directory: ${{github.workspace}}/build
run: |
gcovr -r .. . --xml gcovr.xml -e ".*_deps.*$"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
#directory: ${{runner.workspace}}/build
files: ${{github.workspace}}/build/gcovr.xml # optional
#working-directory: ${{runner.workspace}}/build
#root_dir: ${{runner.workspace}}
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
#version: "v0.1.15"
- name: Install for python tests
shell: bash -l {0}
working-directory: ${{github.workspace}}/build
run: |
make install
- name: Set python path
shell: bash -l {0}
run: |
echo "PYTHONPATH=/home/runner/work/Cytnx_lib" >> $GITHUB_ENV
- name: Test with pytest
shell: bash -l {0}
run: |
pytest pytests/ --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
#- name: Upload gcovr files
# uses: actions/upload-artifact@v3
# with:
# name: CMakeError.log
# path: /home/runner/work/Cytnx/Cytnx/build/CMakeFiles/CMakeError.log
#- name: Upload junit files
# uses: actions/upload-artifact@v3
# with:
# name: junit_xml
# path: ${{github.workspace}}/build/junit.xml