Skip to content

Commit 79dde51

Browse files
authored
isolate performance_test github action (#29)
make sure the performance_test and comment only happen on pull requests.
1 parent 639cad9 commit 79dde51

File tree

2 files changed

+53
-46
lines changed

2 files changed

+53
-46
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Unit Tests
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
7+
env:
8+
BUILD_TYPE: Debug
9+
10+
jobs:
11+
performance_test:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
with:
19+
submodules: recursive
20+
21+
- name: install compiler
22+
run: sudo apt update && sudo apt-get install -y clang-12
23+
24+
- name: Configure CMake
25+
env:
26+
CC: clang-12
27+
CXX: clang++-12
28+
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
29+
30+
- name: Build
31+
id: build_step
32+
run: |
33+
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -t compilation_benchmark |& tee ${{github.workspace}}/build/compilation_output.log
34+
echo "::set-output name=compile_benchmark_time::"`grep "Clang front-end timer" ${{github.workspace}}/build/compilation_output.log | grep -o "^\s\+\S\+\s" | grep -o "\S\+"`
35+
36+
- name: Post compilation performance to pull rquest
37+
uses: actions/github-script@v5
38+
with:
39+
github-token: ${{secrets.GITHUB_TOKEN}}
40+
script: |
41+
github.rest.issues.createComment({
42+
issue_number: context.issue.number,
43+
owner: context.repo.owner,
44+
repo: context.repo.repo,
45+
body: '### ⏱ 🏁 big_nexus.cpp compilation benchmark took **${{ steps.build_step.outputs.compile_benchmark_time }}** seconds'
46+
})
47+
48+
- name: 'Upload Compilation Trace'
49+
uses: actions/upload-artifact@v3
50+
with:
51+
name: compilation_trace.json
52+
path: ${{github.workspace}}/build/benchmark/CMakeFiles/compilation_benchmark.dir/big_nexus.cpp.json
53+

.github/workflows/unit_tests.yml

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -155,49 +155,3 @@ jobs:
155155
with:
156156
name: cib.hpp
157157
path: ${{github.workspace}}/build/include/cib/cib.hpp
158-
159-
160-
161-
performance_test:
162-
runs-on: ubuntu-latest
163-
strategy:
164-
fail-fast: false
165-
166-
steps:
167-
- uses: actions/checkout@v3
168-
with:
169-
submodules: recursive
170-
171-
- name: install compiler
172-
run: sudo apt update && sudo apt-get install -y clang-12
173-
174-
- name: Configure CMake
175-
env:
176-
CC: clang-12
177-
CXX: clang++-12
178-
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
179-
180-
- name: Build
181-
id: build_step
182-
run: |
183-
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -t compilation_benchmark |& tee ${{github.workspace}}/build/compilation_output.log
184-
echo "::set-output name=compile_benchmark_time::"`grep "Clang front-end timer" ${{github.workspace}}/build/compilation_output.log | grep -o "^\s\+\S\+\s" | grep -o "\S\+"`
185-
186-
- name: Post compilation performance to pull rquest
187-
uses: actions/github-script@v5
188-
with:
189-
github-token: ${{secrets.GITHUB_TOKEN}}
190-
script: |
191-
github.rest.issues.createComment({
192-
issue_number: context.issue.number,
193-
owner: context.repo.owner,
194-
repo: context.repo.repo,
195-
body: '### ⏱ 🏁 big_nexus.cpp compilation benchmark took **${{ steps.build_step.outputs.compile_benchmark_time }}** seconds'
196-
})
197-
198-
- name: 'Upload Compilation Trace'
199-
uses: actions/upload-artifact@v3
200-
with:
201-
name: compilation_trace.json
202-
path: ${{github.workspace}}/build/benchmark/CMakeFiles/compilation_benchmark.dir/big_nexus.cpp.json
203-

0 commit comments

Comments
 (0)