-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (76 loc) · 4 KB
/
build.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
name: ZenUnitAndMetalMock
on: [push]
jobs:
build:
strategy:
matrix:
cmake_build_type: [Debug, Release]
cxx: [clang++, g++-10]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v1
with:
python-version: '3.10'
- uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('dev-requirements.txt') }}
- name: Install lld and ninja-build
run: sudo apt-get install lld ninja-build
- name: Install lcov if g++-10 Release
run: sudo apt-get install lcov
if: ${{ matrix.cxx == 'g++-10' && matrix.cmake_build_type == 'Release' }}
- name: Install pip packages
run: pip install --upgrade --upgrade-strategy eager -r dev-requirements.txt
- name: Mypy, Flake8, Pylint, then run unit tests with coverage and pytest if g++-10 Release
run: python ZenUnitDevOpsPython/MypyFlake8PylintThenRunTestsWithCoverage.py --run-tests-with-coverage-python-file=ZenUnitDevOpsPythonTests/RunAllWithCoverage.py
env:
PYTHONPATH: "."
if: ${{ matrix.cxx == 'g++-10' && matrix.cmake_build_type == 'Release' }}
- name: Upload Python code coverage if g++-10 Release
uses: codecov/codecov-action@v1
with:
files: ZenUnitDevOpsPythonTests/CoberturaCodeCoverageResults_ZenUnitDevOpsPythonTests.xml
fail_ci_if_error: true
if: ${{ matrix.cxx == 'g++-10' && matrix.cmake_build_type == 'Release' }}
- name: Run BuildAndTestZenUnitAndMetalMock.py in non code coverage mode if clang++ Debug/Release or g++-10 Debug
run: |
python ZenUnitDevOpsPython/BuildAndTestZenUnitAndMetalMock.py \
--cmake-generator=Ninja \
--cmake-build-type="${{ matrix.cmake_build_type }}" \
--cmake-definitions=""
env:
CXX: "/usr/bin/${{ matrix.cxx }}"
PYTHONPATH: .
if: ${{ matrix.cxx == 'clang++' || (matrix.cxx == 'g++-10' && matrix.cmake_build_type == 'Debug') }}
- name: Run BuildAndTestZenUnitAndMetalMock.py in code coverage mode if g++-10 Release
run: |
python ZenUnitDevOpsPython/BuildAndTestZenUnitAndMetalMock.py \
--cmake-generator=Ninja \
--cmake-build-type="${{ matrix.cmake_build_type }}" \
--cmake-definitions="-DLCovCodeCoverageMode=ON"
env:
CXX: "/usr/bin/${{ matrix.cxx }}"
PYTHONPATH: .
if: ${{ matrix.cxx == 'g++-10' && matrix.cmake_build_type == 'Release' }}
- name: Print .comment section of binary ZenUnitLibraryTests to confirm it was linked with LLD
run: readelf --string-dump .comment "${{matrix.cmake_build_type}}/ZenUnitLibraryTests/ZenUnitLibraryTests"
- name: Install and run lcov 1.15 then upload to Codecov.io if g++-10 Release
run: |
mkdir -p lcov_1_15
wget https://github.com/linux-test-project/lcov/releases/download/v1.15/lcov-1.15.tar.gz --output-document="lcov_1_15/lcov-1.15.tar.gz"
tar xf "lcov_1_15/lcov-1.15.tar.gz" --strip-components=1 --directory lcov_1_15
lcov_1_15/bin/lcov --version
lcov_1_15/bin/lcov --directory . --capture --output-file coverage.info
lcov_1_15/bin/lcov --list coverage.info
bash <(curl -s https://codecov.io/bash) -f coverage.info || echo "Codecov did not collect coverage reports"
if: ${{ matrix.cxx == 'g++-10' && matrix.cmake_build_type == 'Release' }}
- name: SonarCloud scan if g++-10 Release
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
if: ${{ matrix.cxx == 'g++-10' && matrix.cmake_build_type == 'Release' }}