-
Notifications
You must be signed in to change notification settings - Fork 94
119 lines (97 loc) · 4.38 KB
/
buildAndCoverage.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
name: Build and collect test coverage
on:
push:
branches:
- main
pull_request:
types: [assigned, opened, synchronize, reopened]
workflow_dispatch:
defaults:
run:
shell: bash
env:
DEBIAN_FRONTEND: noninteractive
jobs:
build-repo:
name: Build and Code Coverage
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Get the project repository
uses: actions/checkout@v3
with:
fetch-depth: 2
submodules: "true"
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Python and other packages
run: |
pip install cmake numpy psutil pybind11 rich
- name: Install Ninja
run: sudo apt-get install -y ninja-build
- name: Install llvm-cov
run: sudo apt-get install -y clang lld llvm
- name: Get LLVM
id: clone-llvm
run: utils/clone-llvm.sh
- name: Get LLVM commit hash
id: get-llvm-commit-hash
run: echo "hash=$(cd llvm ; git log -1 --format='%H')" >> $GITHUB_OUTPUT
- name: Ccache for C++ compilation
# https://github.com/hendrikmuhs/ccache-action/releases/tag/v1.2.9
uses: hendrikmuhs/ccache-action@ca3acd2731eef11f1572ccb126356c2f9298d35e
with:
key: ${{ runner.os }}-${{ matrix.ubuntu_version }}-${{ steps.get-llvm-commit-hash.outputs.hash }}
max-size: 1G
- name: Build and install LLVM
run: LLVM_ENABLE_RTTI=ON utils/build-llvm.sh
- name: Install our python reqs
run: pip install -r python/requirements.txt
- name: Build and generate coverage (Release)
run: |
mkdir build_release
cd build_release
cmake .. \
-GNinja \
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld" -DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" -DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PLATFORM_NO_VERSIONED_SONAME=ON \
-DCMAKE_VISIBILITY_INLINES_HIDDEN=ON \
-DCMAKE_C_VISIBILITY_PRESET=hidden \
-DCMAKE_CXX_VISIBILITY_PRESET=hidden \
-DAIE_COMPILER=NONE \
-DAIE_LINKER=NONE \
-DHOST_COMPILER=NONE \
-DBUILD_INSTRUMENTED_COVERAGE=ON \
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_ENABLE_RTTI=ON \
-DCMAKE_MODULE_PATH=`pwd`/../cmake/modulesXilinx \
-DMLIR_DIR=/home/runner/work/mlir-aie/mlir-aie/llvm/install/lib/cmake/mlir \
-DLLVM_DIR=/home/runner/work/mlir-aie/mlir-aie/llvm/install/lib/cmake/llvm \
-DLLVM_USE_LINKER=lld \
-DLLVM_EXTERNAL_LIT=`pwd`/../llvm/build/bin/llvm-lit
ninja && ninja generate-aie-coverage-report
- name: Format coverage report
id: format-report
run: |
sed -i.bak "s/class='column-entry-bold'/style='font-weight: bold; text-align: left;'/g" /home/runner/work/mlir-aie/mlir-aie/build_release/report/index.html
sed -i.bak "s/class='column-entry-yellow'/style='text-align: left; background-color: #ffffd0;'/g" /home/runner/work/mlir-aie/mlir-aie/build_release/report/index.html
sed -i.bak "s/class='column-entry-red'/style='text-align: left; background-color: #ffd0d0;'/g" /home/runner/work/mlir-aie/mlir-aie/build_release/report/index.html
sed -i.bak "s/class='column-entry-green'/style='text-align: left; background-color: #d0ffd0;'/g" /home/runner/work/mlir-aie/mlir-aie/build_release/report/index.html
sed -i.bak "s/<!doctype html>/<!--<!doctype html>-->/g" /home/runner/work/mlir-aie/mlir-aie/build_release/report/index.html
echo "report=$(cat /home/runner/work/mlir-aie/mlir-aie/build_release/report/index.html)" >> $GITHUB_OUTPUT
- name: Update PR with coverage results
uses: edumserrano/find-create-or-update-comment@v2
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: '<!--<!doctype html>-->'
comment-author: 'github-actions[bot]'
body-path: |
# Test/code coverage report
${{ steps.format-report.outputs.report }}
edit-mode: replace