forked from ukaea/parallel-preprocessor
-
Notifications
You must be signed in to change notification settings - Fork 2
244 lines (222 loc) · 11.4 KB
/
github-ci.yml
File metadata and controls
244 lines (222 loc) · 11.4 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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
name: ubuntu-macos
# adapted from: https://github.com/ScottishCovidResponse/Covid19_EERAModel/blob/dev/.github/workflows/eera.yml
# Supported runners and hardware resources
# https://docs.github.com/en/free-pro-team@latest/actions/reference/specifications-for-github-hosted-runners#supported-runners-and-hardware-resources
on: [push, pull_request]
env:
PROJECT_NAME: "parallel-preprocessor"
PROJECT_VERSION: "0.3-dev"
MODULE_FOLDERS: "./src/"
jobs:
build:
name: "${{ matrix.os }} workflow"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: 'ubuntu-20.04'
compiler: gcc
compilerpp: g++
package_suffix: 'deb'
- os: 'ubuntu-18.04'
compiler: gcc
compilerpp: g++
package_suffix: 'deb'
# - os: 'macos-latest'
# compiler: gcc
# compilerpp: g++
# package_suffix: 'dmg'
steps:
- uses: actions/checkout@v2
- name: Install Dependencies ( Ubuntu 20.04 with OCCT from freecad-stable PPA)
run: |
sudo add-apt-repository ppa:freecad-maintainers/freecad-stable
sudo apt-get update
sudo apt-get install -y g++ cmake clang cppcheck similarity-tester flawfinder p7zip-full openssl
sudo apt-get install -y lcov htmldoc poppler-utils graphviz doxygen
sudo apt-get install -y libtbb*-dev libocct-*-dev occt-misc python3-dev python3-pybind11 libboost-dev freecad
sudo apt-get install -y libx11-dev libxmu-dev libxi-dev
if: matrix.os == 'ubuntu-20.04'
# ubuntu-20.04 has opencascade v 7.3 in official repo, PPA not needed, python3-pybind11 is also latest enough
# ppa:freecad-maintainers/freecad-stable has freecad 0.19 and occt 7.5
- name: Install Dependencies ( Ubuntu 18.04)
run: |
sudo add-apt-repository ppa:freecad-maintainers/freecad-stable
sudo apt-get update
#sudo apt-get upgrade
sudo apt-get install -y libtbb*-dev libocct-*-dev occt-misc python3-dev freecad libboost-dev
sudo apt-get install -y g++ cmake clang lcov cppcheck similarity-tester flawfinder clang-format clang-tidy
sudo apt-get install -y libx11-dev libxmu-dev libxi-dev
if: matrix.os == 'ubuntu-18.04'
- name: zip source code for release
run: |
cd ..
ls
7z a -r ${{ env.PROJECT_NAME }}.zip ${{ env.PROJECT_NAME }}
mv ${{ env.PROJECT_NAME }}.zip ${{ github.workspace }}/
cd ${{ github.workspace }}
sha256sum ${{ env.PROJECT_NAME }}.zip | awk '{ print $1; }' > ${{ github.workspace }}/${{ env.PROJECT_NAME }}.zip.sha256.txt
if: matrix.os == 'ubuntu-20.04'
- name: Compile on Linux (release)
env:
CC: ${{ matrix.compiler }}
CXX: ${{ matrix.compilerpp }}
run: |
git submodule update --init --recursive
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DPython_EXECUTABLE=$(which python3) -DPPP_VERSION_NAME=${{ env.PROJECT_VERSION }} .. -Wno-dev
make 2>&1 | tee clang_tidy_build_results.log
if: matrix.os == 'ubuntu-18.04' || matrix.os == 'ubuntu-20.04'
- name: package and installation on Ubuntu
working-directory: ${{ github.workspace }}/build
run: |
echo "start packaging in the folder $(pwd)"
make package
sudo dpkg -i ${{ env.PROJECT_NAME }}*
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-18.04'
################################### macos workflow #######################################
- name: Install Brew and Dependencies ( Mac OS X )
run : |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew update
#brew install cppcheck lcov poppler htmldoc graphviz doxygen
brew install boost tbb opencascade
if: matrix.os == 'macos-latest'
# occt 7.4, tbb , it will also install header file, will install dependencies automatically? yes
# it seems xwindows dev files are NOT needed on macos
# git cmake are available, gcc has been installed, see all installed software
# https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md
# then how to select the default Xcode version?
- name: Compile on MacOS
# env:
# DEVELOPER_DIR: /Applications/Xcode_11.2.app/Contents/Developer
run: |
git submodule update --init --recursive
mkdir build
cd build
cmake -DCMAKE_BUILD_NAME=Release .. -Wno-dev
make 2>&1 | tee clang_tidy_build_results.log
if: matrix.os == 'macos-latest'
- name: package on MacOS
working-directory: ${{ github.workspace }}/build
run: |
echo "make package in the folder $(pwd)"
make package
mv *.${{ matrix.package_suffix }} ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}_${{ matrix.os }}.${{ matrix.package_suffix }}
if: matrix.os == 'macos-latest'
################### testing ##########################
- name: Run unit tests
working-directory: ${{ github.workspace }}/build
run: |
echo "start unit test in the folder:$(pwd)"
if [ ! -f "run_all_tests.sh" ]; then cp ../scripts/run_all_tests.sh ./ ; fi
sh run_all_tests.sh
if: always() # tmp skip this step if failed
################### upload package ##########################
# those release asset filename endpoint (not necessarily created before this upload)
- name: Upload binary package to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ github.workspace }}/build/${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}_${{ matrix.os }}.${{ matrix.package_suffix }}
asset_name: ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}_${{ matrix.os }}.${{ matrix.package_suffix }}
tag: dev
overwrite: true
prerelease: true
if: github.ref == 'refs/heads/main' # only upload package on main branch, not PR, forks, which has no write access
################### zip and upload source code zip ##########################
# those release asset filename endpoint (not necessarily created before this upload)
- name: Upload source code to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ github.workspace }}/${{ env.PROJECT_NAME }}.zip
asset_name: ${{ env.PROJECT_NAME }}.zip
tag: dev
overwrite: true
prerelease: true
if: github.ref == 'refs/heads/main' && matrix.os == 'ubuntu-20.04'
- name: Upload source code checksum
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ github.workspace }}/${{ env.PROJECT_NAME }}.zip.sha256.txt
asset_name: ${{ env.PROJECT_NAME }}.zip.sha256.txt
tag: dev
overwrite: true
prerelease: true
if: github.ref == 'refs/heads/main' && matrix.os == 'ubuntu-20.04'
# only upload package on main branch, not PR, forks, which has no write access
# https://github.com/ukaea/parallel-preprocessor/releases/download/dev/parallel-preprocessor.zip
########################################## only for Ubuntu debug release ############################################
- name: Re-compile on Linux (debug + coverage)
working-directory: ${{ github.workspace }}
# env:
# CC: ${{ matrix.compiler }}
# CXX: ${{ matrix.compilerpp }}
run: |
rm -rf build
mkdir build
cd build
cmake -DCODE_COVERAGE=ON -DPython_EXECUTABLE=$(which python3) -DPPP_VERSION_NAME=${{ env.PROJECT_VERSION }} .. -Wno-dev
make 2>&1 | tee clang_tidy_build_results.log
if: matrix.os == 'ubuntu-20.04' && ( github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main' )
- name: Run Cpp Check Flawfinder Sim C++ ( Ubuntu GCC Dev/Master )
working-directory: ${{ github.workspace }}
run: |
echo "start code analysis in the folder:$(pwd)"
cppcheck --language=c++ --std=c++17 --enable=all -DROOT_DIR=$PWD -v --xml --xml-version=2 ${{ env.MODULE_FOLDERS }} 2>&1 | tee build/cpp-check.xml
flawfinder ${{ env.MODULE_FOLDERS }} | tee build/flawfinder.log
sim_c++ -a -o "build/sim_cpp.log" src/PPP/*.h src/Geom/*.h
if: matrix.os == 'ubuntu-20.04' && ( github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main' )
- name: Build Doxygen Documentation ( Ubuntu GCC Dev/Master )
working-directory: ${{ github.workspace }}
run : |
cd build
make doc
mv public ../doxygen
if: matrix.os == 'ubuntu-20.04' && ( github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main' )
- name: Commit Doxygen files ( Ubuntu GCC Dev/Master )
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -f doxygen/*
git commit -m "Updated Doxygen Documentation `date`"
if: matrix.os == 'ubuntu-20.04' && ( github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main' )
- name: Run GCov and LCov Code Coverage ( Ubuntu GCC Dev/Master )
working-directory: ${{ github.workspace }}
run : |
cd build
make coverage
if: matrix.os == 'ubuntu-20.04' && ( github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main' )
- name: Commit LCOV files ( Ubuntu GCC Dev/Master )
working-directory: ${{ github.workspace }}
run: |
git add -f build/${{ env.PROJECT_NAME }}_coverage*
git commit -m "Updated LCOV report `date`"
if: matrix.os == 'ubuntu-20.04' && ( github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main' )
- name: Convert CPPCheck to HTML and push ( Ubuntu GCC Dev/Master )
working-directory: ${{ github.workspace }}
run: |
mkdir -p site/cppcheck
cppcheck-htmlreport --title="${{ env.PROJECT_NAME }}" --file=build/cpp-check.xml --report-dir=site/cppcheck --source-dir=./src
git add -f site/cppcheck/*
git commit -m "Added CPPCheck Output `date`"
if: matrix.os == 'ubuntu-20.04' && ( github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main' )
- name: Build Website Files ( Ubuntu GCC Dev/Master )
working-directory: ${{ github.workspace }}
run: |
python scripts/site_generation.py build/clang_tidy_build_results.log build/flawfinder.log build/sim_cpp.log
git add -f site/*.html
git add -f index.html
git commit -m "Updated Website Output `date`"
if: matrix.os == 'ubuntu-20.04' && ( github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main' )
- name: Push site changes to gh-pages ( Ubuntu GCC Dev/Master )
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
force: true
if: matrix.os == 'ubuntu-20.04' && ( github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main' )