-
Notifications
You must be signed in to change notification settings - Fork 86
169 lines (144 loc) · 6.14 KB
/
buildAndTest.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
name: Build and Test
on:
push:
branches:
- main
pull_request:
types: [assigned, opened, synchronize, reopened]
workflow_dispatch:
merge_group:
env:
# Run apt package manager in the CI in non-interactive mode.
# Otherwise, on Ubuntu 20.04 the installation of tzdata asking question
DEBIAN_FRONTEND: noninteractive
concurrency:
# A PR number if a pull request and otherwise the commit hash. This cancels
# queued and in-progress runs for the same PR (presubmit) or commit
# (postsubmit).
group: ci-build-test-cpp-linux-${{ github.event.number || github.sha }}
cancel-in-progress: true
jobs:
build-repo:
name: Build and Test
runs-on: ubuntu-${{ matrix.ubuntu_version }}
strategy:
# Run all the test even if there are some which fail
fail-fast: false
# Run the tests on the Cartesian product of the following
matrix:
build_type: [ Assert, Release ]
ubuntu_version: [ 20.04, 22.04 ]
steps:
# Clone the repo and its submodules. Do shallow clone to save clone
# time.
- name: Get the project repository
uses: actions/checkout@v3
with:
fetch-depth: 2
submodules: "true"
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install Python packages
run: |
pip install -r python/requirements.txt
- name: Install packages
run: |
sudo apt-get install -y ninja-build clang lld libelf-dev
- name: Upgrade gcc
if: matrix.ubuntu_version == '20.04'
run: |
sudo apt-get install -y ninja-build clang lld
sudo apt install build-essential manpages-dev software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
GCC_VERSION=11
sudo apt update && sudo apt install gcc-$GCC_VERSION g++-$GCC_VERSION
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 \
--slave /usr/bin/g++ g++ /usr/bin/g++-9 \
--slave /usr/bin/gcov gcov /usr/bin/gcov-9 \
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-9 \
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-$GCC_VERSION 110 \
--slave /usr/bin/g++ g++ /usr/bin/g++-$GCC_VERSION \
--slave /usr/bin/gcov gcov /usr/bin/gcov-$GCC_VERSION \
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-$GCC_VERSION \
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-$GCC_VERSION
- name: Get MLIR
id: mlir-wheels
run: |
VERSION=$(utils/clone-llvm.sh --get-wheel-version)
pip -q download mlir==$VERSION \
-f https://github.com/Xilinx/mlir-aie/releases/expanded_assets/mlir-distro
unzip -q mlir-*.whl
- name: Ccache for C++ compilation
uses: hendrikmuhs/ccache-action@ca3acd2731eef11f1572ccb126356c2f9298d35e
with:
# Since there are now several compilation jobs running in parallel,
# use a different key per job to avoid a ccache writing race condition
key: ${{ matrix.build_type }}-${{ runner.os }}-${{ matrix.ubuntu_version }}
max-size: 1G
# Build the repo test target in debug mode to build and test.
- name: Build and test (Assert)
if: matrix.build_type == 'Assert'
run: |
mkdir build_assert
cd build_assert
cmake .. \
-GNinja \
-DCMAKE_BUILD_TYPE=Debug \
-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_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 \
-DAIE_ENABLE_PYTHON_PASSES=OFF \
-DAIE_ENABLE_AIRBIN=OFF \
-DHOST_COMPILER=NONE \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_RTTI=ON \
-DCMAKE_MODULE_PATH=$PWD/../cmake/modulesXilinx \
-DMLIR_DIR=$PWD/../mlir/lib/cmake/mlir \
-DLLVM_DIR=$PWD/../mlir/lib/cmake/llvm \
-DLLVM_USE_LINKER=lld \
-DLLVM_EXTERNAL_LIT=$(which lit) \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
ninja
ninja check-aie
ninja check-tutorials
ninja check-reference-designs
ninja check-programming-guide
# Build the repo test target in release mode to build and test.
- name: Build and test (Release)
if: matrix.build_type == 'Release'
run: |
mkdir build_release
cd build_release
cmake .. \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-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_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 \
-DAIE_ENABLE_PYTHON_PASSES=OFF \
-DAIE_ENABLE_AIRBIN=OFF \
-DHOST_COMPILER=NONE \
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_ENABLE_RTTI=ON \
-DCMAKE_MODULE_PATH=$PWD/../cmake/modulesXilinx \
-DMLIR_DIR=$PWD/../mlir/lib/cmake/mlir \
-DLLVM_DIR=$PWD/../mlir/lib/cmake/llvm \
-DLLVM_USE_LINKER=lld \
-DLLVM_EXTERNAL_LIT=$(which lit)
ninja
ninja check-aie
ninja check-tutorials
ninja check-reference-designs
ninja check-programming-guide