-
Notifications
You must be signed in to change notification settings - Fork 0
executable file
·167 lines (149 loc) · 6.21 KB
/
build.yml
File metadata and controls
executable file
·167 lines (149 loc) · 6.21 KB
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: Build-Linux
on:
push:
paths-ignore:
- 'doc/**'
- '**.md'
- '**.rst'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install system prerequisites
run: |
sudo apt-get update
sudo apt-get install -y \
libgraphviz-dev \
libboost-all-dev \
nlohmann-json3-dev \
pybind11-dev \
lcov \
gcovr \
python3-breathe \
python3-sphinx \
python3-sphinx-rtd-theme \
python3-sphinx-copybutton \
python3-sphinx-tabs \
doxygen
- name: Cache SimGrid
uses: actions/cache@v4
id: cache-simgrid
with:
path: /opt/simgrid
key: ${{ runner.os }}-simgrid-python-v2
- name: Install SimGrid
if: steps.cache-simgrid.outputs.cache-hit != 'true'
run: |
git clone --depth 1 https://framagit.org/simgrid/simgrid.git
cd simgrid
cmake -B build -Denable_smpi=OFF -Denable_model-checking=OFF -Denable_python=ON -DCMAKE_INSTALL_PREFIX=/opt/simgrid
cmake --build build -j$(nproc)
sudo cmake --install build
- name: Cache FSMod
uses: actions/cache@v4
id: cache-fsmod
with:
path: /opt/fsmod
key: ${{ runner.os }}-fsmod-python-v2
- name: Install FSMod
if: steps.cache-fsmod.outputs.cache-hit != 'true'
run: |
git clone --depth 1 https://github.com/simgrid/file-system-module.git
cd file-system-module
cmake -B build -Denable_lib_in_jar=OFF -Denable_sthread=OFF -Denable_python=ON -DCMAKE_INSTALL_PREFIX=/opt/fsmod -DCMAKE_PREFIX_PATH=/opt/simgrid
cmake --build build -j$(nproc)
sudo cmake --install build
- name: Cache Google Test
uses: actions/cache@v4
id: cache-gtest
with:
path: /opt/gtest
key: ${{ runner.os }}-gtest-v1
- name: Install Google Test
if: steps.cache-gtest.outputs.cache-hit != 'true'
run: |
wget -q https://github.com/google/googletest/archive/refs/tags/release-1.11.0.tar.gz
tar xf release-1.11.0.tar.gz
cd googletest-release-1.11.0
cmake -B build -DCMAKE_INSTALL_PREFIX=/opt/gtest
cmake --build build -j$(nproc)
sudo cmake --install build
- name: Build and test with coverage
run: |
# Dynamically find SimGrid Python path
SIMGRID_PYTHON_PATH=$(find /opt/simgrid/lib -type d -path "*/python*/site-packages" 2>/dev/null | head -1)
if [ -z "$SIMGRID_PYTHON_PATH" ]; then
SIMGRID_PYTHON_PATH=$(find /opt/simgrid/lib -type d -path "*/python*/dist-packages" 2>/dev/null | head -1)
fi
echo "Using SimGrid Python path: $SIMGRID_PYTHON_PATH"
# Dynamically find FSMod Python path
FSMOD_PYTHON_PATH=$(find /opt/fsmod/lib -type d -path "*/python*/site-packages" 2>/dev/null | head -1)
if [ -z "$FSMOD_PYTHON_PATH" ]; then
FSMOD_PYTHON_PATH=$(find /opt/fsmod/lib -type d -path "*/python*/dist-packages" 2>/dev/null | head -1)
fi
echo "Using FSMod Python path: $FSMOD_PYTHON_PATH"
export LD_LIBRARY_PATH=/opt/simgrid/lib:/opt/fsmod/lib:/usr/local/lib
export PYTHONPATH="$SIMGRID_PYTHON_PATH:$FSMOD_PYTHON_PATH:/usr/local/lib/python3.12/dist-packages"
export CMAKE_PREFIX_PATH=/opt/simgrid:/opt/fsmod:/opt/gtest
cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug
cmake --build build -j$(nproc)
sudo cmake --install build
cmake --build build --target unit_tests -j$(nproc)
cd build
./unit_tests
cd test/python
python3 ./unit_tests_python.py
cd ../..
- name: Generate coverage report
run: |
cd build
lcov --keep-going --ignore-errors mismatch --directory . --capture --output-file coverage.info
lcov --ignore-errors mismatch --remove coverage.info '*/test/*' '*/bindings/*' -o coverage.info
gcovr --root .. -e '../test' -e '../src/bindings' --sonarqube -o coverage.xml --exclude-throw-branches \
--gcov-ignore-parse-errors --exclude-unreachable-branches
# Strip branch attributes so SonarQube uses line coverage only
# (gcovr's sonarqube format includes branch data that penalizes macro-generated conditionals like XBT_DEBUG)
sed -i 's/ branchesToCover="[^"]*" coveredBranches="[^"]*"//g' coverage.xml
- name: Upload coverage to Codecov
if: env.CODECOV_TOKEN != ''
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
bash <(curl -s https://codecov.io/bash) -f build/coverage.info -t ${CODECOV_TOKEN}
- name: SonarQube Scan
if: env.SONAR_TOKEN != ''
uses: SonarSource/sonarqube-scan-action@v7
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.projectKey=simgrid_dtlmod
-Dsonar.organization=simgrid
-Dsonar.cfamily.compile-commands=build/compile_commands.json
-Dsonar.coverageReportPaths=build/coverage.xml
- name: Build and deploy documentation
if: github.ref == 'refs/heads/main' && env.TOKEN_GITHUB != ''
env:
TOKEN_GITHUB: ${{ secrets.TOKEN_GITHUB }}
run: |
cd doc
LC_ALL=C.UTF-8 ./Build.sh
mkdir -p $HOME/gh-pages-to-deploy
cp -r build/html/* $HOME/gh-pages-to-deploy/
cd ..
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
git clone -b gh-pages https://${TOKEN_GITHUB}@github.com/simgrid/DTLMod.git gh-pages
cd gh-pages
cp -Rf $HOME/gh-pages-to-deploy/* .
touch .nojekyll
git add -f .
git diff-index --quiet HEAD || git commit -m "GitHub build $GITHUB_RUN_NUMBER"
git push -fq origin gh-pages
echo "Done updating gh-pages!"