-
-
Notifications
You must be signed in to change notification settings - Fork 3
132 lines (113 loc) · 4.29 KB
/
ci-cpp.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
121
122
123
124
125
126
127
128
129
130
131
132
# C++ CI
name: C++ CI
on:
push:
paths-ignore:
- 'docs/**'
- 'media/**'
- '**.md'
pull_request:
branches:
- main
- dev
- feature/**
paths:
- 'docs/**'
- 'media/**'
- '**.md'
jobs:
build-linux:
name: C++ CI
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 11
- name: Setup latest GCC and build dependencies
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
sudo apt update
sudo apt install gcc-13 g++-13 gdb
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 110 --slave /usr/bin/g++ g++ /usr/bin/g++-13 --slave /usr/bin/gcov gcov /usr/bin/gcov-13 --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-13 --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-13
- name: Setup Ninja
run: sudo apt-get install ninja-build
- name: Setup Valgrind
if: github.event_name == 'pull_request'
run: sudo apt-get install valgrind
- name: Setup Mold
uses: rui314/setup-mold@v1
- name: Setup CCache
uses: hendrikmuhs/ccache-action@v1
- name: Setup Gcovr
run: sudo pip install gcovr
- name: Cache LLVM
id: cache-llvm
uses: actions/cache@v3
with:
path: /home/runner/work/spice/llvm
key: llvm-17.0.5
- name: Setup LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: |
cd ..
rm -rf llvm
git clone --depth 1 --branch llvmorg-17.0.5 https://github.com/llvm/llvm-project llvm
mkdir ./llvm/build
cd ./llvm/build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_CXX_FLAGS_RELEASE="-O2" -DLLVM_ENABLE_RTTI=ON -GNinja ../llvm
cmake --build . -j$(nproc)
- name: Download Libs
run: |
chmod +x setup-libs.sh
./setup-libs.sh
- name: Build Test target
# if: github.event_name != 'pull_request'
env:
LLVM_DIR: /home/runner/work/spice/llvm/build/lib/cmake/llvm
run: |
echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH
mkdir ./bin
cd ./bin
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DSPICE_BUILT_BY="ghactions" -DSPICE_LINK_STATIC=OFF -DSPICE_LTO=ON -DSPICE_RUN_COVERAGE=ON -GNinja -Wattributes ..
cmake --build . --target spicetest -j$(nproc)
# - name: Build Test target
# if: github.event_name == 'pull_request'
# env:
# LLVM_DIR: /home/runner/work/spice/llvm/build/lib/cmake/llvm
# run: |
# echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH
# mkdir ./bin
# cd ./bin
# cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DSPICE_BUILT_BY="ghactions" -DSPICE_LINK_STATIC=OFF -DSPICE_RUN_COVERAGE=ON -GNinja -Wattributes ..
# cmake --build . --target spicetest -j$(nproc)
- name: Run Test target
# if: github.event_name != 'pull_request'
env:
SPICE_STD_DIR: /home/runner/work/spice/spice/std
run: |
cd ./bin/test
./spicetest --skip-github-tests
# - name: Run Test target with Valgrind
# if: github.event_name == 'pull_request'
# env:
# SPICE_STD_DIR: /home/runner/work/spice/spice/std
# run: |
# cd ./bin/test
# valgrind -q --leak-check=full ./spicetest --skip-github-tests --leak-detection
- name: Generate coverage report
run: |
cd ./bin
sudo chmod +x coverage.sh
sudo ./coverage.sh
- name: Upload coverage report - coverage.spicelang.com
uses: sebastianpopp/ftp-action@releases/v2
with:
host: ${{ secrets.FTP_SERVER }}
user: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
localDir: ./bin/coverage
remoteDir: chillibits.com/spice/coverage