forked from flang-compiler/classic-flang-llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (70 loc) · 3.13 KB
/
pre-compile_llvm.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
name: Pre-compile llvm
on:
workflow_dispatch:
push:
branches: [ release_100, release_11x, release_12x, release_13x]
jobs:
build:
runs-on: ubuntu-20.04
strategy:
matrix:
target: [X86]
cc: [clang, gcc]
version: [10, 11]
steps:
- if: matrix.cc == 'clang'
run: |
echo "cpp=clang++" >> $GITHUB_ENV
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
sudo touch /etc/apt/sources.list.d/llvm.list
echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main' | sudo tee -a /etc/apt/sources.list.d/llvm.list
echo 'deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main' | sudo tee -a /etc/apt/sources.list.d/llvm.list
wget -q -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo apt update
sudo apt install -f -y llvm-${{ matrix.version }} clang-${{ matrix.version}}
- if: matrix.cc == 'gcc' && matrix.version == '10'
run: |
echo "cpp=g++" >> $GITHUB_ENV
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
sudo apt install gcc-10 g++-10
- if: matrix.cc == 'gcc' && matrix.version == '11'
run: |
echo "cpp=g++" >> $GITHUB_ENV
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
sudo apt install gcc-11 g++-11
- name: Check tools
run: |
git --version
cmake --version
make --version
${{ matrix.cc }}-${{ matrix.version }} --version
${{env.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/${{env.cpp}}-${{ matrix.version }} \
-n $(nproc)
# 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@v2
with:
name: llvm_build_${{ matrix.target }}_${{ matrix.cc }}_${{ matrix.version }}_${{ steps.extract_branch.outputs.branch }}
path: llvm_build.tar.gz