Skip to content

Commit

Permalink
[LDC] CI: Simplify clang installation via apt.llvm.org repo, and ninj…
Browse files Browse the repository at this point in the history
…a install
  • Loading branch information
kinke committed Jan 18, 2025
1 parent ea4e84c commit dd5c3a4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 41 deletions.
52 changes: 21 additions & 31 deletions .github/actions/1-setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: Install prerequisites
inputs:
clang_version:
required: true
arch:
required: true
runs:
Expand All @@ -17,50 +15,43 @@ runs:
export DEBIAN_FRONTEND=noninteractive
sudo apt-get -q update
sudo -E apt-get -yq install \
git-core curl xz-utils ninja-build g++ python3 pkgconf binutils-dev libxml2-dev libzstd-dev zlib1g-dev p7zip-full unzip
git-core curl xz-utils g++ python3 pkgconf binutils-dev libxml2-dev libzstd-dev zlib1g-dev p7zip-full unzip
# install a recent CMake version (Ubuntu 20's too old)
curl -fL --retry 3 --max-time 300 -o cmake.tar.gz \
https://github.com/Kitware/CMake/releases/download/v3.31.4/cmake-3.31.4-linux-${{ inputs.arch }}.tar.gz
mkdir cmake
tar -xf cmake.tar.gz --strip 1 -C cmake
rm cmake.tar.gz
sudo ln -sf $PWD/cmake/bin/cmake /usr/bin/cmake
# install a more recent CMake version in the AArch64 container (Ubuntu 20's too old)
if [[ $arch == aarch64 ]]; then
curl -fL --retry 3 --max-time 300 -o cmake.tar.gz \
https://github.com/Kitware/CMake/releases/download/v3.31.4/cmake-3.31.4-linux-${{ inputs.arch }}.tar.gz
mkdir cmake
tar -xf cmake.tar.gz --strip 1 -C cmake
rm cmake.tar.gz
sudo ln -sf $PWD/cmake/bin/cmake /usr/bin/cmake
fi
- name: 'Linux: Download & extract clang' # into ../clang
- name: 'Linux: Install clang 19 from apt.llvm.org'
if: runner.os == 'Linux'
shell: bash
run: |
set -eux
cd ..
version='${{ inputs.clang_version }}'
arch='${{ inputs.arch }}'
extraSuffix=''
if [[ $arch == x86_64 ]]; then
extraSuffix='-ubuntu-18.04'
fi
curl -fL --retry 3 --max-time 300 -o clang.tar.xz \
https://github.com/llvm/llvm-project/releases/download/llvmorg-$version/clang+llvm-$version-$arch-linux-gnu$extraSuffix.tar.xz
mkdir clang
tar -xf clang.tar.xz --strip 1 -C clang
rm clang.tar.xz
clang/bin/clang --version
curl -fL --retry 3 --max-time 30 -O https://apt.llvm.org/llvm.sh
sudo bash llvm.sh 19
# use it as C(++) compiler for future steps
echo "CC=$PWD/clang/bin/clang" >> $GITHUB_ENV
echo "CXX=$PWD/clang/bin/clang++" >> $GITHUB_ENV
echo "CC=clang-19" >> $GITHUB_ENV
echo "CXX=clang++-19" >> $GITHUB_ENV
# make bundled lld the default linker
sudo ln -sf "$PWD/clang/bin/ld.lld" /usr/bin/ld
sudo ln -sf ld.lld-19 /usr/bin/ld
ld --version
- name: 'Windows: Install clang'
- name: 'Windows: Install clang v19.1.3 from GitHub'
if: runner.os == 'Windows'
shell: bash
run: |
set -eux
cd ..
curl -fL --retry 3 --max-time 300 -o clang.exe \
https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ inputs.clang_version }}/LLVM-${{ inputs.clang_version }}-win64.exe
https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.3/LLVM-19.1.3-win64.exe
./clang.exe //S # double-slash for bash
rm clang.exe
Expand All @@ -78,9 +69,8 @@ runs:
echo "ASMFLAGS=-m32" >> $GITHUB_ENV
fi
- name: 'Non-Linux: Install ninja'
if: runner.os != 'Linux'
uses: seanmiddleditch/gha-setup-ninja@v4
- name: Install ninja v1.12.1
uses: Ahajha/gha-setup-ninja@69595b0cf872acdad8ce599142fbdc88724b9a2b

- name: 'Windows: Set LDC_VSDIR env variable'
if: runner.os == 'Windows'
Expand Down
10 changes: 0 additions & 10 deletions .github/workflows/ldc-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ concurrency:
cancel-in-progress: true

env:
# no recent official clang packages for Ubuntu 20
CLANG_VERSION: 15.0.6
# Prevent dependencies on some purely optional libraries, and a dependency on clang
# for compiler-rt tests.
BASE_CMAKE_FLAGS: >-
Expand All @@ -33,22 +31,18 @@ jobs:
os: windows-2022
arch: x64
with_asserts: false
clang_version: 19.1.3 # the MSVC headers require clang 16+
- job_name: Windows x64 withAsserts
os: windows-2022
arch: x64
with_asserts: true
clang_version: 19.1.3 # the MSVC headers require clang 16+
- job_name: Windows x86
os: windows-2022
arch: x86
with_asserts: false
clang_version: 19.1.3 # the MSVC headers require clang 16+
- job_name: Windows x86 withAsserts
os: windows-2022
arch: x86
with_asserts: true
clang_version: 19.1.3 # the MSVC headers require clang 16+
- job_name: Linux x86_64
os: ubuntu-20.04
arch: x86_64
Expand All @@ -62,13 +56,11 @@ jobs:
container_image: ubuntu:20.04
arch: aarch64
with_asserts: false
clang_version: 15.0.3 # 15.0.6 requires a more recent libstdc++.so.6 than shipped with Ubuntu 20
- job_name: Linux aarch64 withAsserts
os: ubuntu-22.04-arm # Ubuntu 20 not natively supported
container_image: ubuntu:20.04
arch: aarch64
with_asserts: true
clang_version: 15.0.3 # 15.0.6 requires a more recent libstdc++.so.6 than shipped with Ubuntu 20
- job_name: macOS arm64
os: macos-15
arch: arm64
Expand Down Expand Up @@ -103,7 +95,6 @@ jobs:
- name: Install prerequisites
uses: ./.github/actions/1-setup
with:
clang_version: ${{ matrix.clang_version || env.CLANG_VERSION }}
arch: ${{ matrix.arch }}
# BOLT supports ELF binaries only, so include it for Linux packages only
- name: Build & install LLVM incl. LLD, compiler-rt${{ runner.os == 'Linux' && ', BOLT' || '' }}
Expand Down Expand Up @@ -156,7 +147,6 @@ jobs:
- name: Install prerequisites
uses: ./.github/actions/1-setup
with:
clang_version: ${{ env.CLANG_VERSION }}
arch: x86_64
- name: Build native llvm-tblgen
shell: bash
Expand Down

0 comments on commit dd5c3a4

Please sign in to comment.