-
Notifications
You must be signed in to change notification settings - Fork 18
121 lines (96 loc) · 3.32 KB
/
build.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
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Build
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, 'macos-13', 'macos-13-arm64']
dist: [local, centos-7, ubuntu-18.04]
config: [release, assert]
exclude:
- os: macos-13
dist: centos-7
- os: macos-13
dist: ubuntu-18.04
- os: ubuntu-latest
dist: local
- os: macos-13-arm64
dist: centos-7
- os: macos-13-arm64
dist: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Checkout submodules
run: |
git submodule update --init --recursive
- name: Compile
run: |
LLVM_VER="$(python3 scripts/get_llvm_version.py llvm-project/llvm/CMakeLists.txt)"
if [ x"${{ matrix.os }}" == x"ubuntu-latest" ]; then
# internally it uses a docker to run the desired platform
PLATFORM_NAME="linux-gnu-${{ matrix.dist }}"
BUILD_PLATFORM="docker_${{ matrix.dist }}"
CPU_ARCH="x86_64"
elif [ x"${{ matrix.os }}" == x"macos-13" ]; then
PLATFORM_NAME="apple-darwin"
BUILD_PLATFORM="local"
CPU_ARCH="x86_64"
else
PLATFORM_NAME="apple-darwin"
BUILD_PLATFORM="local"
CPU_ARCH="arm64"
fi
CONFIG_SUFFIX="${{ matrix.config }}"
OUTPUT="llvm+mlir+clang-${LLVM_VER}-${CPU_ARCH}-${PLATFORM_NAME}-${CONFIG_SUFFIX}"
bash build_llvm.bash -o "$OUTPUT" -p "$BUILD_PLATFORM" -c "$CONFIG_SUFFIX" -j 4
mkdir -p ${{ github.sha }}
mv *.tar.xz ${{ github.sha }}/
- name: Upload an artifact
uses: actions/upload-artifact@v3
if: github.event_name == 'push'
with:
if-no-files-found: error
name: build_artifact
path: ${{ github.sha }}
upload-tarballs:
runs-on: ubuntu-latest
needs: [build]
if: ${{ github.event_name == 'push' }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Checkout submodules
run: |
git submodule update --init --recursive
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: build_artifact
path: ${{ github.sha }}
- name: Set up a release page
id: setup_release
run: |
LLVM_VER="$(python3 scripts/get_llvm_version.py llvm-project/llvm/CMakeLists.txt)"
LLVM_COMMIT_ID="$(cd llvm-project && git log -n 1 --pretty=format:"%h" )"
tag_name="llvm-${LLVM_VER}-${LLVM_COMMIT_ID}"
release_title="LLVM ${LLVM_VER} (${LLVM_COMMIT_ID})"
echo "LLVM ${LLVM_VER} created at $(date)" > body.md
echo "::set-output name=tag_name::${tag_name}"
echo "::set-output name=release_title::${release_title}"
- name: Upload tarballs
uses: ncipollo/release-action@v1
with:
artifacts: "${{ github.sha }}/*.tar.xz"
bodyFile: body.md
token: "${{ secrets.GITHUB_TOKEN }}"
tag: "${{ steps.setup_release.outputs.tag_name }}"
name: "${{ steps.setup_release.outputs.release_title }}"
removeArtifacts: true