[workflows] Upgrade CMake in Ubuntu AArch64 container image #151
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pre-compile llvm | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'release_*x' | |
jobs: | |
build: | |
name: Ubuntu Linux | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
target: [X86] | |
cc: [clang] | |
cpp: [clang++] | |
version: [14, 15] | |
include: | |
- target: X86 | |
cc: gcc | |
cpp: g++ | |
version: 12 | |
steps: | |
- if: matrix.cc == 'clang' | |
run: | | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa | |
sudo apt update | |
sudo apt install -f -y llvm-${{ matrix.version }} clang-${{ matrix.version }} | |
- if: matrix.cc == 'gcc' | |
run: | | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa | |
sudo apt install gcc-${{ matrix.version }} g++-${{ matrix.version }} | |
- name: Check tools | |
run: | | |
git --version | |
cmake --version | |
make --version | |
${{ matrix.cc }}-${{ matrix.version }} --version | |
${{ matrix.cpp }}-${{ matrix.version }} --version | |
- name: Extract branch name | |
run: echo "::set-output name=branch::${GITHUB_REF#refs/heads/}" | |
id: extract_branch | |
- name: Build llvm | |
run: | | |
# exit the llvm dir, so the path is the same on subsequent projects | |
cd ../.. | |
rm -rf classic-flang-llvm-project | |
# clone manually, because checkout does not allow exiting llvm dir | |
git clone --depth 1 --single-branch --branch ${{ steps.extract_branch.outputs.branch }} https://github.com/flang-compiler/classic-flang-llvm-project.git | |
cd classic-flang-llvm-project | |
# After build place the artifacts in classic-flang-llvm-project/classic-flang-llvm-project, so Upload can find them. | |
mkdir classic-flang-llvm-project | |
./build-llvm-project.sh \ | |
-t ${{ matrix.target }} \ | |
-p /usr/local \ | |
-a /usr/bin/${{ matrix.cc }}-${{ matrix.version }} \ | |
-b /usr/bin/${{ matrix.cpp }}-${{ matrix.version }} \ | |
-n $(nproc) \ | |
-x "-DLLVM_ENABLE_ASSERTIONS=ON" \ | |
-v | |
# Archive the source + build directories for future installation | |
cd .. | |
tar -zcf llvm_build.tar.gz classic-flang-llvm-project | |
# Upload will only look in $GITHUB_WORKSPACE or its subdirs. | |
mv llvm_build.tar.gz classic-flang-llvm-project/classic-flang-llvm-project/. | |
- name: Upload llvm | |
uses: actions/upload-artifact@v4 | |
with: | |
name: llvm_build_${{ matrix.target }}_${{ matrix.cc }}_${{ matrix.version }}_${{ steps.extract_branch.outputs.branch }} | |
path: llvm_build.tar.gz | |
build-win: | |
name: Windows build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
arch: amd64 | |
target: X86 | |
# Enable Windows on ARM build, when an official | |
# self-hosted machine is available. | |
# - os: self-hosted | |
# arch: arm64 | |
# target: AArch64 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Windows | |
uses: llvm/actions/setup-windows@main | |
with: | |
arch: ${{ matrix.arch }} | |
- name: Setup Ninja | |
uses: llvm/actions/install-ninja@main | |
- name: Check tools | |
run: | | |
git --version | |
cmake --version | |
clang --version | |
ninja --version | |
python --version | |
- name: Extract branch name | |
id: extract_branch | |
run: echo "branch=$(("${{ github.ref }}" -split "/")[-1])" >> $env:GITHUB_OUTPUT | |
- name: Build llvm | |
shell: powershell | |
run: | | |
$pcount = $($(Get-WmiObject -class Win32_ComputerSystem).numberoflogicalprocessors) | |
python .\scripts\build_llvm_project.py -d build -t ${{ matrix.target }} --cmake-param=-DLLVM_ENABLE_ASSERTIONS=ON -j $pcount -v | |
cd .. | |
7z a llvm_build.7z $pwd/classic-flang-llvm-project/ | |
Copy-Item llvm_build.7z -Destination $pwd/classic-flang-llvm-project/ | |
- name: Upload llvm | |
uses: actions/upload-artifact@v4 | |
with: | |
name: llvm_build_win_${{ matrix.arch }}_clangcl_${{ steps.extract_branch.outputs.branch }} | |
path: ${{ github.workspace }}\llvm_build.7z |