Skip to content

Commit a6def98

Browse files
committed
Try using actions/download artifact
1 parent 57f3443 commit a6def98

File tree

10 files changed

+364
-219
lines changed

10 files changed

+364
-219
lines changed
+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: build-ock
2+
description: Action to build the oneapi-construction-kit
3+
4+
# Some of these are riscv or host target specific, but it does not harm at present to
5+
# overset cmake values
6+
inputs:
7+
# os:
8+
# type: string
9+
# description: 'TBD'
10+
# default: ubuntu_22.04
11+
arch:
12+
type: string
13+
description: 'TBD'
14+
default: 'x86_64'
15+
build_type:
16+
type: string
17+
description: 'build type e.g Release, ReleaseAssert (default ReleaseAssert)'
18+
default: ReleaseAssert
19+
llvm_branch_id:
20+
type: string
21+
description: "TBD"
22+
default: ""
23+
llvm_branch:
24+
type: string
25+
description: "TBD"
26+
27+
runs:
28+
using: "composite"
29+
steps:
30+
- name: Setup Windows
31+
if: startsWith(runner.os, 'Windows')
32+
uses: llvm/actions/setup-windows@main
33+
with:
34+
arch: amd64
35+
36+
- name: Checkout repo llvm
37+
uses: actions/checkout@v4
38+
with:
39+
repository: llvm/llvm-project
40+
ref: ${{inputs.llvm_branch}}
41+
42+
- name: Install Ninja
43+
uses: llvm/actions/install-ninja@main
44+
45+
- name: Setup ccache
46+
# if: inputs.arch == 'x86_64'
47+
uses: hendrikmuhs/ccache-action@53911442209d5c18de8a31615e0923161e435875 # v1.2.16
48+
with:
49+
max-size: 200M
50+
key: ccache-llvm-build-${{ inputs.arch }}-${{ runner.os }}
51+
variant: ccache
52+
# TODO: How do we handle that these are parallel?
53+
save: true
54+
55+
- name: Checkout repo ock platform
56+
uses: actions/checkout@v4
57+
with:
58+
sparse-checkout: |
59+
platform
60+
path: ock
61+
62+
- name: Install Ninja
63+
uses: llvm/actions/install-ninja@a1ea791b03c8e61f53a0e66f2f73db283aa0f01e # main branch
64+
65+
- name: install aarch64 build tools
66+
if: ${{ inputs.arch == 'aarch64' }}
67+
run: |
68+
sudo apt-get install --yes g++-aarch64-linux-gnu
69+
echo 'ARCH_FLAGS=-DCMAKE_TOOLCHAIN_FILE="$GITHUB_WORKSPACE/ock/platform/aarch64-linux/aarch64-gcc-toolchain.cmake" \
70+
-DLLVM_HOST_TRIPLE=aarch64-unknown-linux-gnu' > $GITHUB_ENV
71+
72+
- name: install riscv64 build tools
73+
if: ${{ inputs.arch == 'riscv64' }}
74+
run: |
75+
sudo apt-get install --yes g++-riscv64-linux-gnu
76+
echo 'ARCH_FLAGS=-DCMAKE_TOOLCHAIN_FILE="$GITHUB_WORKSPACE/ock/platform/arm-linux/riscv64-gcc-toolchain.cmake" \
77+
-DLLVM_HOST_TRIPLE=riscv64-unknown-linux-gnu' > $GITHUB_ENV
78+
79+
- name: install x86 build tools
80+
if: ${{ inputs.arch == 'x86' }}
81+
run: |
82+
sudo dpkg --add-architecture i386
83+
sudo apt-get update
84+
sudo apt-get install --yes gcc-multilib g++-multilib libc6-dev:i386 lib32tinfo-dev
85+
echo 'ARCH_FLAGS=-DLLVM_BUILD_32_BITS=ON -DLIBXML2_LIBRARIES=IGNORE -DLLVM_ENABLE_TERMINFO=OFF
86+
-DLLVM_HOST_TRIPLE=i686-unknown-linux-gnu' > $GITHUB_ENV
87+
88+
- name: Run cmake
89+
run:
90+
cmake llvm
91+
-DLLVM_ENABLE_DIA_SDK=OFF
92+
-DCMAKE_INSTALL_PREFIX=llvm_install
93+
-DLLVM_ENABLE_ZLIB=FALSE
94+
-DLLVM_ENABLE_ZSTD=FALSE
95+
-DLLVM_ENABLE_Z3_SOLVER=FALSE
96+
-DLLVM_ENABLE_PROJECTS="clang;lld"
97+
-DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64;RISCV"
98+
-DLLVM_CCACHE_BUILD=ON
99+
-Bbuild
100+
-GNinja
101+
${{ inputs.build_type == 'RelAssert' && '-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON' || '' }}
102+
${{ inputs.os == 'windows-2019' && '' || '-DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON' }}
103+
${{ inputs.os == 'windows-2019' && '' || $ARCH_FLAGS }}
104+
105+
- name: Run build on llvm
106+
run:
107+
cmake --build build --target install
108+
109+
- name: Copy lit tools
110+
run: |
111+
cp build/bin/FileCheck* llvm_install/bin
112+
cp build/bin/not* llvm_install/bin
113+
114+
- name: upload artefact
115+
uses: actions/upload-artifact@v4
116+
with:
117+
name: llvm-${{ input.os }}-${{ inputs.arch }}-${{ inputs.llvm_branch_id }}-${{ input.build_type }}
118+
path: llvm_install
119+
retention-days: 7

.github/actions/do_build_ock_artefact/action.yml

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ inputs:
77
llvm_version:
88
description: 'llvm version we want to use (18-19)'
99
default: '19'
10+
llvm_source:
11+
required: false
12+
type: string
13+
default: 'cache'
1014
target:
1115
description: 'target architecture'
1216
download_ock_artefact:
@@ -40,6 +44,7 @@ runs:
4044
&& 'none' || steps.calc_vars.outputs.arch }}
4145
os: ${{ contains(inputs.target, 'windows') && 'windows' || 'ubuntu' }}
4246
ubuntu_version: ${{ contains(inputs.target, 'riscv64') && '24.04' || '22.04' }}
47+
llvm_source: ${{ inputs.llvm_source }}
4348

4449
- name: build native ock - x86_64 and aarch64
4550
if: ( steps.calc_vars.outputs.arch == 'x86_64' || steps.calc_vars.outputs.arch == 'aarch64' )

.github/actions/setup_build/action.yml

+25-1
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,42 @@ runs:
9595
9696
ln -s /usr/lib/llvm-${{ inputs.llvm_version }} llvm_install
9797
98+
- name: download llvm native
99+
if: inputs.llvm_source != 'install' && inputs.llvm_source != 'cache'
100+
uses: actions/download-artifact@v4
101+
with:
102+
name: llvm-${{ inputs.os }}-${{ steps.set_llvm_key.outputs.key_version }}-${{ steps.set_llvm_key.outputs.key_native_arch }}-${{ inputs.llvm_version }}-${{ inputs.llvm_build_type }}
103+
#llvm-ubuntu-22.04-x86_64-19-RelAssert
104+
run-id: ${{ inputs.llvm_source }}
105+
github-token: ${{ env.GH_TOKEN }}
106+
path: llvm_install
107+
98108
- shell: bash
99109
if: inputs.cross_arch != 'none'
100110
run: mv llvm_install llvm_install_native
101111

102-
- name: load llvm cross
112+
- name: load llvm cross cache
103113
if: inputs.cross_arch != 'none' && inputs.llvm_source == 'cache'
104114
uses: actions/cache/restore@v4
105115
with:
106116
path: llvm_install/**
107117
key: llvm-${{ inputs.os }}-${{ steps.set_llvm_key.outputs.key_version }}-${{ steps.set_llvm_key.outputs.key_arch }}-v${{ inputs.llvm_version }}-${{ inputs.llvm_build_type }}
108118
fail-on-cache-miss: true
109119

120+
- name: load llvm cross download
121+
if: inputs.cross_arch != 'none' && inputs.llvm_source != 'cache' && inputs.llvm_source != 'install'
122+
uses: actions/download-artifact@v4
123+
with:
124+
name: llvm-${{ inputs.os }}-${{ steps.set_llvm_key.outputs.key_version }}-${{ steps.set_llvm_key.outputs.key_arch }}-${{ inputs.llvm_version }}-${{ inputs.llvm_build_type }}
125+
#llvm-ubuntu-22.04-x86_64-19-RelAssert
126+
run-id: ${{ inputs.llvm_source }}
127+
github-token: ${{ env.GH_TOKEN }}
128+
path: llvm_install
129+
130+
- shell: bash
131+
# TODO make artifacts using tar so we don't need to do this.
132+
run: chmod +x llvm_install*/bin/*
133+
110134
# note the PR testing usage should set 'save' to false, to avoid PR testing creating new caches on a branch
111135
- name: Setup ccache
112136
uses: hendrikmuhs/ccache-action@53911442209d5c18de8a31615e0923161e435875 # v1.2.16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: test llvm download
2+
description: test llvm download
3+
4+
inputs:
5+
token:
6+
description: 'token for download'
7+
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Try downloading llvm install
12+
uses: actions/download-artifact@v4
13+
with:
14+
name: llvm-ubuntu-22.04-x86_64-19-RelAssert
15+
run-id: 13593517156
16+
# github-token: ${{ inputs.token }}
17+
github-token: ${{ env.GH_TOKEN }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
# Copyright (C) Codeplay Software Limited
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License") with LLVM
6+
# Exceptions; you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://github.com/codeplaysoftware/oneapi-construction-kit/blob/main/LICENSE.txt
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
# License for the specific language governing permissions and limitations
15+
# under the License.
16+
#
17+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
18+
19+
# rudimentary script that attempts to use the output from run_cities log to find original
20+
# csv line to help with creating an override file with ,XFail at the end
21+
if [[ $# != 3 ]];
22+
then
23+
echo "usage: find_csv_entry_from_log_out.sh <log> <orig csv> <extend>"
24+
exit 1
25+
fi
26+
27+
cat $1 | while read line
28+
do
29+
line_strip_to_slash=$(echo $line | sed -e 's/[^\/]*\///' -e 's/\\/\\\\\\\\/g')
30+
test_args=`echo $line_strip_to_slash | sed -e 's/[^\/]*\///'`
31+
test_bin=`echo $line_strip_to_slash | sed 's/\/.*//'`
32+
out=`grep "$test_bin" $2 | grep "$test_args"| head -1`
33+
if [[ ! -z "$out" ]]; then
34+
echo ${out}${3}
35+
fi
36+
done

0 commit comments

Comments
 (0)