-
Notifications
You must be signed in to change notification settings - Fork 3
150 lines (146 loc) · 5.61 KB
/
ci.yaml
File metadata and controls
150 lines (146 loc) · 5.61 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
name: Main
on:
pull_request:
branches: [main]
push:
branches: [main]
release:
types: [published]
schedule:
- cron: '30 20 * * *' # Warning: Timezone dep - 20:00 is 1:00
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# - name: ubu22-gcc9-clang-repl-16
# os: ubuntu-22.04
# compiler: gcc-9
# clang-runtime: '16'
- name: ubu22-gcc12-clang-repl-17-fb7f50a
os: ubuntu-latest
compiler: gcc-12
clang-runtime: 'fb7f50a'
- name: osx-clang-clang-repl-17-fb7f50a
os: macos-latest
compiler: clang
clang-runtime: 'fb7f50a'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Save PR Info
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR
echo ${{ github.repository }} > ./pr/REPO
export LLVM_HASH=$(git ls-remote https://github.com/root-project/llvm-project.git release/${{ matrix.clang-runtime }}.x | tr '\t' '-')
echo "CLING_HASH=$CLING_HASH" >> $GITHUB_ENV
echo "LLVM_HASH=$LLVM_HASH" >> $GITHUB_ENV
- uses: nelonoel/branch-name@v1.0.1
- name: Setup compiler on Linux
if: runner.os == 'Linux'
run: |
# https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
vers="${compiler#*-}"
os_codename="`cat /etc/os-release | grep UBUNTU_CODENAME | cut -d = -f 2`"
##sudo apt update
if [[ "${{ matrix.compiler }}" == *"gcc"* ]]; then
sudo apt install -y gcc-${vers} g++-${vers} lld
echo "CC=gcc-${vers}" >> $GITHUB_ENV
echo "CXX=g++-${vers}" >> $GITHUB_ENV
else
if ! sudo apt install -y clang-${vers}; then
curl https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
echo "deb https://apt.llvm.org/${os_codename}/ llvm-toolchain-${os_codename}-${vers} main" | sudo tee -a /etc/apt/sources.list
sudo apt update
sudo apt install -y clang-${vers}
fi
echo "CC=clang-${vers}" >> $GITHUB_ENV
echo "CXX=clang++-${vers}" >> $GITHUB_ENV
fi
env:
compiler: ${{ matrix.compiler }}
- name: Install deps on Linux
if: runner.os == 'Linux'
run: |
# Install deps
##sudo apt update
sudo apt install git g++ debhelper devscripts gnupg python3 valgrind
conda install -y -q -c conda-forge \
distro \
pytest
- name: Restore Cache LLVM/Clang runtime build directory
uses: actions/cache/restore@v3
id: cache
with:
key: ${{ env.LLVM_HASH }}-${{ runner.os }}-${{ matrix.os }}-${{ matrix.compiler }}-clang-${{ matrix.clang-runtime }}
path: |
llvm-project
- name: Build LLVM on Linux if the cache is invalid
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: |
# :digit: does not work on osx
# if [[ ${{ matrix.clang-runtime }} == ?(-)+([[:digit:]]) ]]; then
# git clone --depth=1 -b release/${{ matrix.clang-runtime }}.x https://github.com/llvm/llvm-project.git
# cd llvm-project
#else
git clone https://github.com/llvm/llvm-project.git
cd llvm-project
git checkout ${{ matrix.clang-runtime }}
#fi
# Build
mkdir build
cd build
cmake -DLLVM_ENABLE_PROJECTS=clang \
-DLLVM_TARGETS_TO_BUILD="host;NVPTX" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DCLANG_ENABLE_STATIC_ANALYZER=OFF \
-DCLANG_ENABLE_ARCMT=OFF \
-DCLANG_ENABLE_FORMAT=OFF \
-DCLANG_ENABLE_BOOTSTRAP=OFF \
../llvm
cmake --build . --target clang clang-repl clangTooling --parallel $(nproc --all)
cd ../../
- name: Save Cache LLVM/Clang runtime build directory
uses: actions/cache/save@v3
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
with:
path: |
llvm-project
key: ${{ steps.cache.outputs.cache-primary-key }}
- name: Build and run tutorials
run: |
LLVM_DIR="$(python -c 'import os, sys; print(os.path.realpath(sys.argv[1]))' llvm-project)"
LLVM_BUILD_DIR="$(python -c 'import os, sys; print(os.path.realpath(sys.argv[1]))' llvm-project/build)"
#CPLUS_INCLUDE_PATH="${LLVM_DIR}/llvm/include:${LLVM_DIR}/clang/include:${LLVM_BUILD_DIR}/include:${LLVM_BUILD_DIR}/tools/clang/include:$PWD/include"
# Build the tutorials next to the llvm-project.
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release \
-DLLVM_DIR=$LLVM_BUILD_DIR \
-DLLVM_USE_LINKER=lld \
-DBUILD_SHARED_LIBS=ON \
../
cmake --build . --target check-tutorials --parallel $(nproc --all)
cd ..
- name: Show debug info
if: ${{ failure() }}
run: |
export
echo $GITHUB_ENV
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
# When debugging increase to a suitable value!
timeout-minutes: ${{ github.event.pull_request && 40 || 40 }}