|
| 1 | +environment: |
| 2 | + CIRRUS_CLONE_DEPTH: 50 |
| 3 | + CLANG_VERSION: '15.0.3' # 15.0.6 requires a more recent libstdc++.so.6 than shipped with Ubuntu 20 |
| 4 | + LLVM_PROJECTS_TO_ENABLE: compiler-rt;lld;bolt |
| 5 | + # keep these in sync with .github/workflows/ldc-release.yml for Linux x64: |
| 6 | + LLVM_TARGETS_TO_BUILD: all |
| 7 | + LLVM_EXPERIMENTAL_TARGETS_TO_BUILD: SPIRV |
| 8 | + 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 |
| 9 | + EXTRA_CMAKE_FLAGS: -DLLVM_BINUTILS_INCDIR=/usr/include -DLLVM_STATIC_LINK_CXX_STDLIB=ON |
| 10 | + |
| 11 | +task: |
| 12 | + name: Ubuntu 20.04 $TASK_NAME_SUFFIX |
| 13 | + compute_engine_instance: |
| 14 | + image_project: ubuntu-os-cloud |
| 15 | + image: family/ubuntu-2004-lts-arm64 |
| 16 | + platform: linux |
| 17 | + architecture: arm64 |
| 18 | + cpu: 4 |
| 19 | + memory: 8G |
| 20 | + disk: 20 |
| 21 | + timeout_in: 120m |
| 22 | + environment: |
| 23 | + PARALLELISM: 4 |
| 24 | + GITHUB_TOKEN: ENCRYPTED[79b00f4f535df0fdfe3ceea87f9d4ec2ba7628e0c60730b99bcd91c7888af275409f02b2f1bc90015c2cb9cc4fb2dd12] |
| 25 | + matrix: |
| 26 | + - TASK_NAME_SUFFIX: aarch64 |
| 27 | + LLVM_ENABLE_ASSERTIONS: 'OFF' |
| 28 | + - TASK_NAME_SUFFIX: aarch64 withAsserts |
| 29 | + LLVM_ENABLE_ASSERTIONS: 'ON' |
| 30 | + install_prerequisites_script: | |
| 31 | + export DEBIAN_FRONTEND=noninteractive |
| 32 | + apt-get -q update |
| 33 | + 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 |
| 34 | + # install a more recent version of CMake |
| 35 | + 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 |
| 36 | + mkdir cmake_bin |
| 37 | + tar -xf cmake.tar.gz --strip 1 -C cmake_bin |
| 38 | + rm cmake.tar.gz |
| 39 | + # download & extract clang |
| 40 | + 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 |
| 41 | + mkdir clang_bin |
| 42 | + tar -xf clang.tar.xz --strip 1 -C clang_bin |
| 43 | + rm clang.tar.xz |
| 44 | + # make lld the default linker |
| 45 | + ln -sf "$PWD/clang_bin/bin/ld.lld" /usr/bin/ld |
| 46 | + ld --version |
| 47 | + clone_submodules_script: | |
| 48 | + git submodule update --init --depth $CIRRUS_CLONE_DEPTH |
| 49 | + build_script: | |
| 50 | + export PATH="$PWD/cmake_bin/bin:$PATH" |
| 51 | + export CC="$PWD/clang_bin/bin/clang" |
| 52 | + export CXX="$PWD/clang_bin/bin/clang++" |
| 53 | + nproc |
| 54 | + free |
| 55 | + cmake --version |
| 56 | + ninja --version |
| 57 | + mkdir build |
| 58 | + cd build |
| 59 | + cmake -G Ninja ../llvm \ |
| 60 | + -DCMAKE_BUILD_TYPE=Release \ |
| 61 | + -DCMAKE_INSTALL_PREFIX=$PWD/../install \ |
| 62 | + -DLLVM_ENABLE_PROJECTS="$LLVM_PROJECTS_TO_ENABLE" \ |
| 63 | + -DLLVM_TARGETS_TO_BUILD="$LLVM_TARGETS_TO_BUILD" \ |
| 64 | + -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="$LLVM_EXPERIMENTAL_TARGETS_TO_BUILD" \ |
| 65 | + -DLLVM_ENABLE_ASSERTIONS=$LLVM_ENABLE_ASSERTIONS \ |
| 66 | + $BASE_CMAKE_FLAGS $EXTRA_CMAKE_FLAGS |
| 67 | + ninja -j$PARALLELISM install |
| 68 | + cd .. |
| 69 | + pack_artifact_script: | |
| 70 | + if [[ "${CIRRUS_TAG:-}" == ldc-v* ]]; then |
| 71 | + artifactID=${CIRRUS_TAG:5} |
| 72 | + else |
| 73 | + artifactID=${CIRRUS_CHANGE_IN_REPO:0:8} |
| 74 | + fi |
| 75 | + assertsSuffix="" |
| 76 | + if [[ "$LLVM_ENABLE_ASSERTIONS" == "ON" ]]; then |
| 77 | + assertsSuffix="-withAsserts" |
| 78 | + fi |
| 79 | + artifactName=llvm-$artifactID-linux-aarch64$assertsSuffix |
| 80 | + mv install $artifactName |
| 81 | + chmod -R go=rX $artifactName |
| 82 | + artifact=$artifactName.tar.xz |
| 83 | + tar -cf - --owner=0 --group=0 $artifactName | 7za a $artifact -si -txz -mx9 -mmt$PARALLELISM |
| 84 | + ls -lh $artifact |
| 85 | + # Upload to GitHub release (only for branches and tags, no PRs) |
| 86 | + upload_to_github_script: | |
| 87 | + if [[ "${CIRRUS_TAG:-}" == ldc-v* ]]; then |
| 88 | + releaseTag=$CIRRUS_TAG |
| 89 | + elif [[ "${CIRRUS_TAG:-}" == "" && "${CIRRUS_PR:-}" == "" ]]; then |
| 90 | + releaseTag=CI |
| 91 | + else |
| 92 | + echo 'Skipping upload' |
| 93 | + exit 0 |
| 94 | + fi |
| 95 | + releaseID="$(set -eo pipefail; curl -fsS https://api.github.com/repos/ldc-developers/llvm-project/releases/tags/"$releaseTag" | grep '^ "id":' | head -n1 || echo "<error>")" |
| 96 | + if [[ "$releaseID" == "<error>" ]]; then |
| 97 | + echo "Error: no GitHub release found for tag '$releaseTag'" >&2 |
| 98 | + exit 1 |
| 99 | + fi |
| 100 | + releaseID=${releaseID:8:-1} |
| 101 | + artifact=$(ls llvm-*.tar.xz) |
| 102 | + echo "Uploading $artifact to GitHub release $releaseTag ($releaseID)..." |
| 103 | + curl -fsS \ |
| 104 | + -H "Authorization: token $GITHUB_TOKEN" \ |
| 105 | + -H "Content-Type: application/octet-stream" \ |
| 106 | + --data-binary @$artifact \ |
| 107 | + https://uploads.github.com/repos/ldc-developers/llvm-project/releases/$releaseID/assets?name=$artifact |
0 commit comments