-
-
Notifications
You must be signed in to change notification settings - Fork 3
135 lines (117 loc) · 4.6 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
133
134
135
# C++ CI
name: C++ CI
on:
push:
paths-ignore:
- 'docs/**'
- 'media/**'
- '**.md'
pull_request:
branches:
- main
- feature/**
paths:
- 'docs/**'
- 'media/**'
- '**.md'
jobs:
build-linux:
name: C++ CI
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 11
- name: Setup Mold
uses: rui314/setup-mold@v1
- name: Setup CCache
uses: hendrikmuhs/ccache-action@v1
- name: Setup Dependencies
run: sudo apt-get install ninja-build graphviz pipx uuid-dev
# - name: Setup Valgrind
# if: github.event_name == 'pull_request'
# run: sudo apt-get install valgrind
- name: Setup Gcovr
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: sudo pipx install gcovr
- name: Cache LLVM
id: cache-llvm
uses: actions/cache@v4
with:
path: /home/runner/work/spice/llvm
key: llvm-19.1.2
- name: Setup LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: |
cd ..
rm -rf llvm
git clone --depth 1 --branch llvmorg-19.1.2 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 .
- 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
# - 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_PROF_COMPILE=ON -DSPICE_LINK_STATIC=OFF -DSPICE_RUN_COVERAGE=ON -GNinja -Wattributes ..
# cmake --build . --target spicetest
- name: Run Test target
# if: github.event_name != 'pull_request'
env:
LLVM_LIB_DIR: /home/runner/work/spice/llvm/build/lib
LLVM_INCLUDE_DIR: /home/runner/work/spice/llvm/llvm/include
LLVM_BUILD_INCLUDE_DIR: /home/runner/work/spice/llvm/build/include
SPICE_STD_DIR: /home/runner/work/spice/spice/std
SPICE_BOOTSTRAP_DIR: /home/runner/work/spice/spice/src-bootstrap
run: |
cd ./bin/test
./spicetest --skip-github-tests
# - name: Run Test target with Valgrind
# if: github.event_name == 'pull_request'
# env:
# LLVM_LIB_DIR: /home/runner/work/spice/llvm/build/lib
# LLVM_INCLUDE_DIR: /home/runner/work/spice/llvm/llvm/include
# LLVM_BUILD_INCLUDE_DIR: /home/runner/work/spice/llvm/build/include
# SPICE_STD_DIR: /home/runner/work/spice/spice/std
# SPICE_BOOTSTRAP_DIR: /home/runner/work/spice/spice/src-bootstrap
# run: |
# cd ./bin/test
# valgrind -q --leak-check=full ./spicetest --skip-github-tests --leak-detection
- name: Generate coverage report
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
cd ./bin
sudo chmod +x coverage.sh
./coverage.sh
- name: Upload coverage report - coverage.spicelang.com
uses: sebastianpopp/ftp-action@releases/v2
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
with:
host: ${{ secrets.FTP_SERVER }}
user: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
localDir: ./bin/coverage
remoteDir: chillibits.com/spice/coverage