forked from powsybl/powsybl-metrix
-
Notifications
You must be signed in to change notification settings - Fork 1
212 lines (183 loc) · 7.79 KB
/
qa_pr_cpp_centos7.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
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
name: QA-PR-CPP-CENTOS7
on:
pull_request:
types: [opened, synchronize, edited]
release:
types: [created, published, released]
jobs:
clang-tidy:
name: clang-tidy
runs-on: ubuntu-latest
container: 'centos:centos7'
steps:
- name: Install Dependancies
run: |
yum update -y
yum install -y epel-release
yum install -y git redhat-lsb-core make wget centos-release-scl scl-utils
yum install -y devtoolset-9
- name: Install Boost
run: |
source /opt/rh/devtoolset-9/enable
wget https://boostorg.jfrog.io/artifactory/main/release/1.73.0/source/boost_1_73_0.tar.gz
tar -xzvf ./boost_1_73_0.tar.gz
cd boost_1_73_0
./bootstrap.sh --prefix=/usr/local
./b2 install --without-python -j 5
cd ..
- name: Install clang-tidy
run: |
yum install -y clang-tidy-14
yum update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-14 100
- name: Checkout sources
uses: actions/checkout@v1
- name: Configure 3rd parties
run: |
source /opt/rh/devtoolset-9/enable
cmake -S $GITHUB_WORKSPACE/metrix-simulator/external -B $GITHUB_WORKSPACE/metrix-simulator/build-linux/external
- name: Build 3rd parties
run: >
cmake --build $GITHUB_WORKSPACE/metrix-simulator/build/external --parallel 2
- name: Configure CMake
run: |
source /opt/rh/devtoolset-9/enable
cmake -S $GITHUB_WORKSPACE/metrix-simulator -B $GITHUB_WORKSPACE/metrix-simulator/build
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Clang Tidy
run: |
export MODIFIED_FILES=$(git diff --name-only --diff-filter=d origin/${{ github.base_ref }} origin/${{ github.head_ref }} | grep -E ".*(metrix-simulator/src|metrix-simulator/log).*\.(cpp|hpp)$")
if [ -n "$MODIFIED_FILES" ]; then
clang-tidy $MODIFIED_FILES -p $GITHUB_WORKSPACE/metrix-simulator/build
fi
qa:
name: QA - full
runs-on: ubuntu-latest
container: 'centos:centos7'
steps:
- name: Install Dependancies
run: |
yum update -y
yum install -y epel-release
yum install -y git redhat-lsb-core make wget centos-release-scl scl-utils
yum install -y devtoolset-9
yum install -y python-pip
- name: Install Java 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Install gcovr
run: pip install gcovr
- name: Install Sonar wrapper
working-directory: ${{ runner.workspace }}
run: |
wget https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
unzip build-wrapper-linux-x86.zip
- name: Install Sonar scanner
working-directory: ${{ runner.workspace }}
run: |
wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}.zip
unzip sonar-scanner-cli-${SONAR_SCANNER_VERSION}.zip
ln -s sonar-scanner-${SONAR_SCANNER_VERSION} sonar
rm sonar-scanner-cli-${SONAR_SCANNER_VERSION}.zip
env:
SONAR_SCANNER_VERSION: 3.3.0.1492
- name: Download Boost-release
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: 'ARnDOSrte/Boost'
file: 'boost_1_73_0.zip'
target: 'boost_1_73_0.zip'
token: ${{ secrets.TEST_TOKEN_RELEASE }}
- name: Unzip Boost
run: unzip boost_1_73_0.zip
- name: Checkout sources
uses: actions/checkout@v1
- name: Configure 3rd parties
run: |
source /opt/rh/devtoolset-9/enable
source /opt/rh/devtoolset-9/enable
cmake -S $GITHUB_WORKSPACE/metrix-simulator/external -B $GITHUB_WORKSPACE/metrix-simulator/build/external
- name: Build 3rd parties
run: |
cmake --build $GITHUB_WORKSPACE/metrix-simulator/build/external --parallel 2
- name: Configure CMake (For Release)
if: github.event_name == 'release'
run: |
source /opt/rh/devtoolset-9/enable
cmake -Wno-dev -S $GITHUB_WORKSPACE/metrix-simulator -B $GITHUB_WORKSPACE/metrix-simulator/build
-DCMAKE_BUILD_TYPE=Debug
-DBoost_ROOT=$GITHUB_WORKSPACE/__w/Boost/Boost/boost_1_73_0/installBoost
-DCODE_COVERAGE=TRUE
-DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/metrix-simulator/build/install
- name: Configure CMake (For Pull Request)
if: github.event_name != 'release'
run: >
cmake -Wno-dev -S $GITHUB_WORKSPACE/metrix-simulator -B $GITHUB_WORKSPACE/metrix-simulator/build
-DCMAKE_BUILD_TYPE=Debug
-DBoost_ROOT=$GITHUB_WORKSPACE/__w/Boost/Boost/boost_1_73_0/installBoost
-DCODE_COVERAGE=FALSE
-DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/metrix-simulator/build/install
- name: Build
run: >
${{ runner.workspace }}/build-wrapper-linux-x86/build-wrapper-linux-x86-64
--out-dir $GITHUB_WORKSPACE/metrix-simulator/build/output
cmake --build $GITHUB_WORKSPACE/metrix-simulator/build --parallel 2 --target install
- name: Tests
run: cd $GITHUB_WORKSPACE/metrix-simulator/build && ctest -j8 -R "bug_pne" --output-on-failure
- name: Code coverage
run: cmake --build $GITHUB_WORKSPACE/metrix-simulator/build --target code-coverage
# - name: Sonarcloud
# working-directory: ${{ runner.workspace }}/powsybl-metrix/metrix-simulator
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# run: >
# ${{ runner.workspace }}/sonar/bin/sonar-scanner
# -Dsonar.host.url=https://sonarcloud.io
- name: Prepare Metrix install
if: github.event_name == 'release'
id: metrix-install
run: |
ARCHIVE_NAME="metrix-simulator.zip"
ARCHIVE_PATH="$PWD/${ARCHIVE_NAME}"
zip $ARCHIVE_PATH /__w/powsybl-metrix/powsybl-metrix/metrix-simulator/build-linux/install/bin/metrix-simulator
echo "::set-output name=archive_name::$ARCHIVE_NAME"
echo "::set-output name=archive_path::$ARCHIVE_PATH"
- name: Upload OR-Tools install artifact
if: github.event_name == 'release'
uses: actions/upload-artifact@v3
with:
name: ${{ steps.metrix-install.outputs.archive_name }}
path: ${{ steps.metrix-install.outputs.archive_path }}
publish_asset:
name: Publish release assets
needs: qa
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: metrix-simulator.zip
path: ./
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.TEST_TOKEN_RELEASE }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.TEST_TOKEN_RELEASE }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: metrix-simulator.zip
asset_name: metrix-simulator.zip
asset_content_type: application/zip