Skip to content

Commit ae860d4

Browse files
author
Colin Davidson
committed
Add a workflow to create llvm artefacts for a branch
1 parent 60dc1c2 commit ae860d4

File tree

2 files changed

+261
-0
lines changed

2 files changed

+261
-0
lines changed
Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
# Simple workflow for running non-documentation PR testing
2+
name: cache llvm artefacts
3+
on:
4+
workflow_call:
5+
inputs:
6+
llvm_branch:
7+
required: false
8+
type: string
9+
default: 'release/19.x'
10+
llvm_branch_id:
11+
required: false
12+
type: string
13+
default: '19'
14+
outputs:
15+
workflow_id:
16+
value: ${{ github.run_id}}
17+
18+
permissions: {}
19+
20+
jobs:
21+
create_llvm_artifacts:
22+
strategy:
23+
matrix:
24+
# os: [ubuntu-22.04, ubuntu-24.04, windows-2019]
25+
# build_type: [RelAssert]
26+
# arch : [x86, x86_64, aarch64, riscv64]
27+
# exclude:
28+
# Reduce the versions of llvm for aarch64, riscv64 & x86 architectures and windows, as
29+
# well as any windows os variants
30+
# - os: windows-2019
31+
# arch: aarch64
32+
# - os: windows-2019
33+
# arch: riscv64
34+
# - os: windows-2019
35+
# arch: x86
36+
37+
# - os: ubuntu-22.04
38+
# arch: riscv64
39+
# - os: ubuntu-24.04
40+
# arch: aarch64
41+
# - os: ubuntu-24.04
42+
# arch: x86
43+
# include:
44+
# # We want to set flags related to particular matrix dimensions. To do this
45+
# # we need to create default values first, and then against particular matrix
46+
# # dimensions.
47+
# # Note that we need to use RelAssert as the cache key matching can match Release against ReleaseAssert
48+
# - os_flags:
49+
# - arch_flags:
50+
# - build_type_flags:
51+
# - build_type_flags: -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON
52+
# build_type: RelAssert
53+
# - arch_flags: -DCMAKE_TOOLCHAIN_FILE="$GITHUB_WORKSPACE/ock/platform/arm-linux/aarch64-toolchain.cmake"
54+
# -DLLVM_HOST_TRIPLE=aarch64-unknown-linux-gnu
55+
# arch: aarch64
56+
# - arch_flags: -DCMAKE_TOOLCHAIN_FILE="$GITHUB_WORKSPACE/ock/platform/riscv64-linux/riscv64-gcc-toolchain.cmake"
57+
# -DLLVM_HOST_TRIPLE=riscv64-unknown-linux-gnu
58+
# arch: riscv64
59+
# - arch_flags: -DLLVM_BUILD_32_BITS=ON -DLIBXML2_LIBRARIES=IGNORE -DLLVM_ENABLE_TERMINFO=OFF
60+
# -DLLVM_HOST_TRIPLE=i686-unknown-linux-gnu
61+
# arch: x86
62+
# - os: ubuntu-22.04
63+
# os_flags: -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON
64+
# - os: ubuntu-24.04
65+
# os_flags: -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON
66+
os: [ubuntu-22.04]
67+
build_type: [RelAssert]
68+
arch : [x86_64]
69+
# exclude:
70+
# Reduce the versions of llvm for aarch64, riscv64 & x86 architectures and windows, as
71+
# well as any windows os variants
72+
# - os: windows-2019
73+
# arch: aarch64
74+
# - os: windows-2019
75+
# arch: riscv64
76+
# - os: windows-2019
77+
# arch: x86
78+
79+
# - os: ubuntu-22.04
80+
# arch: riscv64
81+
# - os: ubuntu-24.04
82+
# arch: aarch64
83+
# - os: ubuntu-24.04
84+
# arch: x86
85+
include:
86+
# We want to set flags related to particular matrix dimensions. To do this
87+
# we need to create default values first, and then against particular matrix
88+
# dimensions.
89+
# Note that we need to use RelAssert as the cache key matching can match Release against ReleaseAssert
90+
- os_flags:
91+
- arch_flags:
92+
- build_type_flags:
93+
- build_type_flags: -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON
94+
build_type: RelAssert
95+
# - arch_flags: -DCMAKE_TOOLCHAIN_FILE="$GITHUB_WORKSPACE/ock/platform/arm-linux/aarch64-toolchain.cmake"
96+
# -DLLVM_HOST_TRIPLE=aarch64-unknown-linux-gnu
97+
# arch: aarch64
98+
# - arch_flags: -DCMAKE_TOOLCHAIN_FILE="$GITHUB_WORKSPACE/ock/platform/riscv64-linux/riscv64-gcc-toolchain.cmake"
99+
# -DLLVM_HOST_TRIPLE=riscv64-unknown-linux-gnu
100+
# arch: riscv64
101+
# - arch_flags: -DLLVM_BUILD_32_BITS=ON -DLIBXML2_LIBRARIES=IGNORE -DLLVM_ENABLE_TERMINFO=OFF
102+
# -DLLVM_HOST_TRIPLE=i686-unknown-linux-gnu
103+
# arch: x86
104+
- os: ubuntu-22.04
105+
os_flags: -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON
106+
# - os: ubuntu-24.04
107+
# os_flags: -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON
108+
runs-on: ${{ matrix.os }}
109+
steps:
110+
111+
- name: Setup Windows
112+
if: startsWith(runner.os, 'Windows') && steps.cache.outputs.cache-hit != 'true'
113+
uses: llvm/actions/setup-windows@main
114+
with:
115+
arch: amd64
116+
117+
- name: Checkout repo llvm
118+
if: steps.cache.outputs.cache-hit != 'true'
119+
uses: actions/checkout@v4
120+
with:
121+
repository: llvm/llvm-project
122+
ref: ${{inputs.llvm_branch}}
123+
124+
- name: Install Ninja
125+
uses: llvm/actions/install-ninja@main
126+
127+
- name: Setup ccache
128+
if: matrix.arch == 'x86_64'
129+
uses: hendrikmuhs/ccache-action@53911442209d5c18de8a31615e0923161e435875 # v1.2.16
130+
with:
131+
max-size: 200M
132+
key: ccache-llvm-build-${{ inputs.os }}
133+
variant: ccache
134+
# TODO: How do we handle that these are parallel?
135+
save: true
136+
137+
- name: Checkout repo ock platform
138+
if: ${{ steps.cache.outputs.cache-hit != 'true' && matrix.arch != 'x86_64' }}
139+
uses: actions/checkout@v4
140+
with:
141+
sparse-checkout: |
142+
platform
143+
path: ock
144+
145+
- name: Install Ninja
146+
if: steps.cache.outputs.cache-hit != 'true'
147+
uses: llvm/actions/install-ninja@a1ea791b03c8e61f53a0e66f2f73db283aa0f01e # main branch
148+
149+
- name: install aarch64 build tools
150+
if: ${{ steps.cache.outputs.cache-hit != 'true' && matrix.arch == 'aarch64' }}
151+
run:
152+
sudo apt-get install --yes g++-aarch64-linux-gnu
153+
154+
- name: install riscv64 build tools
155+
if: ${{ steps.cache.outputs.cache-hit != 'true' && matrix.arch == 'riscv64' }}
156+
run:
157+
sudo apt-get install --yes g++-riscv64-linux-gnu
158+
159+
- name: install x86 build tools
160+
if: ${{ steps.cache.outputs.cache-hit != 'true' && matrix.arch == 'x86' }}
161+
run: |
162+
sudo dpkg --add-architecture i386
163+
sudo apt-get update
164+
sudo apt-get install --yes gcc-multilib g++-multilib libc6-dev:i386 lib32tinfo-dev
165+
166+
- name: Flags checker
167+
if: steps.cache.outputs.cache-hit != 'true'
168+
run:
169+
echo Building on "${{ matrix.os }}" with os_flags "${{ matrix.os_flags}}" arch "${{ matrix.arch }}" extra flags "${{ matrix.build_type_flags}}" and build_type "${{matrix.build_type}}"
170+
171+
- name: Run cmake
172+
if: steps.cache.outputs.cache-hit != 'true'
173+
run:
174+
cmake llvm
175+
-DLLVM_ENABLE_DIA_SDK=OFF
176+
-DCMAKE_INSTALL_PREFIX=llvm_install
177+
-DLLVM_ENABLE_ZLIB=FALSE
178+
-DLLVM_ENABLE_ZSTD=FALSE
179+
-DLLVM_ENABLE_Z3_SOLVER=FALSE
180+
-DLLVM_ENABLE_PROJECTS="clang;lld"
181+
-DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64;RISCV"
182+
-Bbuild
183+
-GNinja
184+
${{ matrix.build_type_flags }}
185+
${{ matrix.os_flags}}
186+
${{ matrix.arch_flags}}
187+
188+
- name: Run build on llvm
189+
run:
190+
cmake --build build --target install
191+
192+
- name: Copy lit tools
193+
run: |
194+
cp build/bin/FileCheck* llvm_install/bin
195+
cp build/bin/not* llvm_install/bin
196+
197+
- name: upload artefact
198+
uses: actions/upload-artifact@v4
199+
with:
200+
name: llvm-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.llvm_branch_id }}-${{ matrix.build_type }}
201+
path: llvm_install
202+
retention-days: 7
203+
204+
205+
delete_llvm_build_cache:
206+
needs: [ create_llvm_artifacts ]
207+
runs-on: ubuntu-latest
208+
steps:
209+
- name: Checkout repo
210+
uses: actions/checkout@v4
211+
with:
212+
sparse-checkout: .github
213+
- name: Cache clean
214+
uses: ./.github/actions/clean_cache
215+
with:
216+
token: ${{ secrets.GITHUB_TOKEN }}
217+
cache_prefixes: "ccache-llvm-build-ubuntu-22.04 ccache-llvm-build-ubuntu-24.04 ccache-llvm-build-windows-2019"
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Temporary for testing - move to planned_testing_caller.yml
2+
name: Run ock tests for PR style testing
3+
on:
4+
pull_request:
5+
paths:
6+
- '.github/workflows/create_llvm_artefacts.yml'
7+
- '.github/workflows/create_llvm_artefacts_caller.yml'
8+
schedule:
9+
# Run Mon-Fri at 7pm
10+
- cron: '00 19 * * 1-5'
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build_llvm_artefacts:
18+
name: Call PR testing on schedule
19+
if: ${{ (github.event_name == 'schedule' && github.repository == 'uxlfoundation/oneapi-construction-kit') || github.event_name == 'pull_request' }}
20+
permissions:
21+
actions: write
22+
uses: ./.github/workflows/create_llvm_artefacts.yml
23+
secrets: inherit
24+
with:
25+
llvm_branch: 'release/19.x'
26+
llvm_branch_id: '19'
27+
28+
use_llvm_artefacts:
29+
needs: [build_llvm_artefacts]
30+
runs-on: ubuntu-22.04
31+
steps:
32+
- name: Checkout repo
33+
uses: actions/checkout@v4
34+
- name: set up gh
35+
uses: ./.github/actions/setup_gh
36+
with:
37+
os: ${{ contains( matrix.target, 'windows') && 'windows' || 'ubuntu' }}
38+
token: ${{ secrets.GITHUB_TOKEN }}
39+
- name: Try downloading llvm install
40+
run: |
41+
echo workflow id is ${{needs.build_llvm_artefacts.outputs.workflow_id}}
42+
# TODO: We need to add tarring there and here
43+
gh run download ${{needs.build_llvm_artefacts.outputs.workflow_id}} -n llvm-ubuntu-22.04-x86_64-19_RelAss -D llvm_install
44+
ls -l llvm_install/bin

0 commit comments

Comments
 (0)