forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.cirrus.yml
107 lines (106 loc) · 4.38 KB
/
.cirrus.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
environment:
CIRRUS_CLONE_DEPTH: 50
CLANG_VERSION: '15.0.3' # 15.0.6 requires a more recent libstdc++.so.6 than shipped with Ubuntu 20
LLVM_PROJECTS_TO_ENABLE: compiler-rt;lld;bolt
# keep these in sync with .github/workflows/ldc-release.yml for Linux x64:
LLVM_TARGETS_TO_BUILD: all
LLVM_EXPERIMENTAL_TARGETS_TO_BUILD: SPIRV;Xtensa
BASE_CMAKE_FLAGS: -DLLVM_ENABLE_TERMINFO=OFF -DLLVM_ENABLE_LIBEDIT=OFF -DLLVM_USE_STATIC_ZSTD=TRUE -DCOMPILER_RT_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_TESTS=OFF -DCOMPILER_RT_USE_LIBCXX=OFF
EXTRA_CMAKE_FLAGS: -DLLVM_BINUTILS_INCDIR=/usr/include -DLLVM_STATIC_LINK_CXX_STDLIB=ON
task:
name: Ubuntu 20.04 $TASK_NAME_SUFFIX
compute_engine_instance:
image_project: ubuntu-os-cloud
image: family/ubuntu-2004-lts-arm64
platform: linux
architecture: arm64
cpu: 4
memory: 8G
disk: 20
timeout_in: 120m
environment:
PARALLELISM: 4
GITHUB_TOKEN: ENCRYPTED[79b00f4f535df0fdfe3ceea87f9d4ec2ba7628e0c60730b99bcd91c7888af275409f02b2f1bc90015c2cb9cc4fb2dd12]
matrix:
- TASK_NAME_SUFFIX: aarch64
LLVM_ENABLE_ASSERTIONS: 'OFF'
- TASK_NAME_SUFFIX: aarch64 withAsserts
LLVM_ENABLE_ASSERTIONS: 'ON'
install_prerequisites_script: |
export DEBIAN_FRONTEND=noninteractive
apt-get -q update
apt-get -yq install git-core curl xz-utils ninja-build g++ python3 pkg-config binutils-dev libxml2-dev libzstd-dev zlib1g-dev p7zip-full
# install a more recent version of CMake
curl -fL --retry 3 --max-time 300 -o cmake.tar.gz https://github.com/Kitware/CMake/releases/download/v3.28.4/cmake-3.28.4-linux-aarch64.tar.gz
mkdir cmake_bin
tar -xf cmake.tar.gz --strip 1 -C cmake_bin
rm cmake.tar.gz
# download & extract clang
curl -fL --retry 3 --max-time 300 -o clang.tar.xz https://github.com/llvm/llvm-project/releases/download/llvmorg-$CLANG_VERSION/clang+llvm-$CLANG_VERSION-aarch64-linux-gnu.tar.xz
mkdir clang_bin
tar -xf clang.tar.xz --strip 1 -C clang_bin
rm clang.tar.xz
# make lld the default linker
ln -sf "$PWD/clang_bin/bin/ld.lld" /usr/bin/ld
ld --version
clone_submodules_script: |
git submodule update --init --depth $CIRRUS_CLONE_DEPTH
build_script: |
export PATH="$PWD/cmake_bin/bin:$PATH"
export CC="$PWD/clang_bin/bin/clang"
export CXX="$PWD/clang_bin/bin/clang++"
nproc
free
cmake --version
ninja --version
mkdir build
cd build
cmake -G Ninja ../llvm \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$PWD/../install \
-DLLVM_ENABLE_PROJECTS="$LLVM_PROJECTS_TO_ENABLE" \
-DLLVM_TARGETS_TO_BUILD="$LLVM_TARGETS_TO_BUILD" \
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="$LLVM_EXPERIMENTAL_TARGETS_TO_BUILD" \
-DLLVM_ENABLE_ASSERTIONS=$LLVM_ENABLE_ASSERTIONS \
$BASE_CMAKE_FLAGS $EXTRA_CMAKE_FLAGS
ninja -j$PARALLELISM install
cd ..
pack_artifact_script: |
if [[ "${CIRRUS_TAG:-}" == ldc-v* ]]; then
artifactID=${CIRRUS_TAG:5}
else
artifactID=${CIRRUS_CHANGE_IN_REPO:0:8}
fi
assertsSuffix=""
if [[ "$LLVM_ENABLE_ASSERTIONS" == "ON" ]]; then
assertsSuffix="-withAsserts"
fi
artifactName=llvm-$artifactID-linux-aarch64$assertsSuffix
mv install $artifactName
chmod -R go=rX $artifactName
artifact=$artifactName.tar.xz
tar -cf - --owner=0 --group=0 $artifactName | 7za a $artifact -si -txz -mx9 -mmt$PARALLELISM
ls -lh $artifact
# Upload to GitHub release (only for branches and tags, no PRs)
upload_to_github_script: |
if [[ "${CIRRUS_TAG:-}" == ldc-v* ]]; then
releaseTag=$CIRRUS_TAG
elif [[ "${CIRRUS_TAG:-}" == "" && "${CIRRUS_PR:-}" == "" ]]; then
releaseTag=CI
else
echo 'Skipping upload'
exit 0
fi
releaseID="$(set -eo pipefail; curl -fsS https://api.github.com/repos/ldc-developers/llvm-project/releases/tags/"$releaseTag" | grep '^ "id":' | head -n1 || echo "<error>")"
if [[ "$releaseID" == "<error>" ]]; then
echo "Error: no GitHub release found for tag '$releaseTag'" >&2
exit 1
fi
releaseID=${releaseID:8:-1}
artifact=$(ls llvm-*.tar.xz)
echo "Uploading $artifact to GitHub release $releaseTag ($releaseID)..."
curl -fsS \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary @$artifact \
https://uploads.github.com/repos/ldc-developers/llvm-project/releases/$releaseID/assets?name=$artifact