Skip to content

Commit

Permalink
try simplifying
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc-André Moreau committed Nov 8, 2023
1 parent adc8493 commit 19fda6b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 101 deletions.
87 changes: 40 additions & 47 deletions .github/workflows/halide-prebuilt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ jobs:
matrix:
arch: [ x86_64, aarch64 ]
os: [ windows, macos, ubuntu-20.04, ubuntu-22.04 ]
version: [ 16.0.0 ]
version: [ 14.0.0, 16.0.0 ]

include:
- os: windows
version: 16.0.0
runner: windows-2022
- os: windows
version: 14.0.0
runner: windows-2019
- os: macos
runner: macos-12
- os: ubuntu-20.04
Expand Down Expand Up @@ -61,22 +65,30 @@ jobs:
sudo apt install ninja-build
sudo apt install g++-aarch64-linux-gnu
- name: Preflight
shell: pwsh
run: |
$LlvmVersion = if ('${{matrix.version}}' -eq "14.0.0") { "14.0.6" } else { "16.0.6" }
$LlvmRunId = '${{ github.event.inputs.run_id }}'
if ($LlvmRunId -eq 'latest') {
$LlvmRunId = $(gh run list -w 'LLVM prebuilt' --json 'status,databaseId,conclusion') |
ConvertFrom-Json | Where-Object { ($_.status -eq 'completed') -and ($_.conclusion -eq 'success') } |
Select-Object -First 1 -ExpandProperty databaseId
}
echo "LLVM_VERSION=$LlvmVersion" >> $Env:GITHUB_ENV
echo "LLVM_RUN_ID=$LlvmRunId" >> $Env:GITHUB_ENV
- name: Install host clang+llvm
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
$LlvmPlatform='${{matrix.os}}'
$LlvmArch='x86_64'
$LlvmVersion = if ('${{matrix.version}}' -eq "14.0.0") { "14.0.6" } else { "16.0.6" }
$LlvmVersion = $Env:LLVM_VERSION
$LlvmRunId = $Env:LLVM_RUN_ID
$LlvmName="clang+llvm-${LlvmVersion}-${LlvmArch}-${LlvmPlatform}"
$RunId = '${{ github.event.inputs.run_id }}'
if ($RunId -eq 'latest') {
$RunId = $(gh run list -w 'LLVM prebuilt' --json 'status,databaseId,conclusion') |
ConvertFrom-Json | Where-Object { ($_.status -eq 'completed') -and ($_.conclusion -eq 'success') } |
Select-Object -First 1 -ExpandProperty databaseId
}
& gh run download $RunId --repo $Env:GITHUB_REPOSITORY -n $LlvmName
& gh run download $LlvmRunId --repo $Env:GITHUB_REPOSITORY -n $LlvmName
if ($IsWindows) {
$TempDir = "C:/temp"
$LLVM_PREFIX = "C:/llvm"
Expand All @@ -88,11 +100,9 @@ jobs:
tar -xvf "${LlvmName}.tar.xz" -C $TempDir
sudo mv "$TempDir/${LlvmName}" $LLVM_PREFIX
}
$LLVM_BIN_PATH="$LLVM_PREFIX/bin"
$LLVM_BIN_DIR="$LLVM_PREFIX/bin"
$LLVM_DIR="$LLVM_PREFIX/lib/cmake/llvm"
$CLANG_DIR="$LLVM_PREFIX/lib/cmake/clang"
echo "LLVM_X86_64_DIR=$LLVM_DIR" >> $Env:GITHUB_ENV
echo "CLANG_X86_64_DIR=$CLANG_DIR" >> $Env:GITHUB_ENV
echo "LLVM_HOST_DIR=$LLVM_DIR" >> $Env:GITHUB_ENV
echo "CLANG_HOST_DIR=$CLANG_DIR" >> $Env:GITHUB_ENV
Expand All @@ -102,8 +112,8 @@ jobs:
echo "CLANG_TARGET_DIR=$CLANG_DIR" >> $Env:GITHUB_ENV
}
echo "LLVM_HOST_BIN_DIR=$LLVM_BIN_PATH" >> $Env:GITHUB_ENV
echo "PATH=$LLVM_BIN_PATH$([IO.Path]::PathSeparator)$Env:PATH" >> $Env:GITHUB_ENV
echo "LLVM_HOST_BIN_DIR=$LLVM_BIN_DIR" >> $Env:GITHUB_ENV
echo "PATH=$LLVM_BIN_DIR$([IO.Path]::PathSeparator)$Env:PATH" >> $Env:GITHUB_ENV
- name: Install target clang+llvm
if: matrix.arch == 'aarch64'
Expand All @@ -113,15 +123,10 @@ jobs:
run: |
$LlvmPlatform='${{matrix.os}}'
$LlvmArch='${{matrix.arch}}'
$LlvmVersion = if ('${{matrix.version}}' -eq "14.0.0") { "14.0.6" } else { "16.0.6" }
$LlvmVersion = $Env:LLVM_VERSION
$LlvmRunId = $Env:LLVM_RUN_ID
$LlvmName="clang+llvm-${LlvmVersion}-${LlvmArch}-${LlvmPlatform}"
$RunId = '${{ github.event.inputs.run_id }}'
if ($RunId -eq 'latest') {
$RunId = $(gh run list -w 'LLVM prebuilt' --json 'status,databaseId,conclusion') |
ConvertFrom-Json | Where-Object { ($_.status -eq 'completed') -and ($_.conclusion -eq 'success') } |
Select-Object -First 1 -ExpandProperty databaseId
}
& gh run download $RunId --repo $Env:GITHUB_REPOSITORY -n $LlvmName
& gh run download $LlvmRunId --repo $Env:GITHUB_REPOSITORY -n $LlvmName
if ($IsWindows) {
$TempDir = "C:/temp"
$LLVM_PREFIX = "C:/llvm-$LlvmArch"
Expand All @@ -133,25 +138,18 @@ jobs:
tar -xf "${LlvmName}.tar.xz" -C $TempDir
sudo mv "$TempDir/${LlvmName}" $LLVM_PREFIX
}
$LLVM_BIN_PATH="$LLVM_PREFIX/bin"
$LLVM_BIN_DIR="$LLVM_PREFIX/bin"
$LLVM_DIR="$LLVM_PREFIX/lib/cmake/llvm"
$CLANG_DIR="$LLVM_PREFIX/lib/cmake/clang"
echo "LLVM_AARCH64_DIR=$LLVM_DIR" >> $Env:GITHUB_ENV
echo "CLANG_AARCH64_DIR=$LLVM_DIR" >> $Env:GITHUB_ENV
echo "LLVM_TARGET_DIR=$LLVM_DIR" >> $Env:GITHUB_ENV
echo "CLANG_TARGET_DIR=$CLANG_DIR" >> $Env:GITHUB_ENV
$LLVM_HOST_BIN_DIR=$Env:LLVM_HOST_BIN_DIR
$LLVM_TARGET_BIN_DIR=$LLVM_BIN_PATH
if ($IsWindows) {
@('llvm-as.exe', 'clang.exe', 'clang-format.exe') | ForEach-Object {
Copy-Item -Path "${LLVM_HOST_BIN_DIR}\$_" -Destination "${LLVM_TARGET_BIN_DIR}\$_" -Force
}
} else {
@('llvm-as', 'clang', 'clang-format') | ForEach-Object {
Copy-Item -Path "${LLVM_HOST_BIN_DIR}/$_" -Destination "${LLVM_TARGET_BIN_DIR}/$_" -Force
}
$LLVM_TARGET_BIN_DIR=$LLVM_BIN_DIR
$ExeSuffix = if ($IsWindows) { ".exe" } else { "" }
@('llvm-as', 'clang', 'clang-format') | ForEach-Object {
$ExeFileName = "$_${ExeSuffix}"
Copy-Item -Path "${LLVM_HOST_BIN_DIR}/$ExeFileName" -Destination "${LLVM_TARGET_BIN_DIR}/$ExeFileName" -Force
}
- name: Clone project
Expand All @@ -177,7 +175,6 @@ jobs:
} else {
git -C halide apply ../llvm-prebuilt/patches/halide-16-add-halide-host-tools-dir-cmake-option.patch
git -C halide apply ../llvm-prebuilt/patches/halide-16-disable-autoschedulers.patch
git -C halide apply ../llvm-prebuilt/patches/halide-16-add-llvm-host-bin-dir-cmake-option.patch
git -C halide apply ../llvm-prebuilt/patches/halide-16-disable-clang-verbose-build-warnings.patch
}
Expand Down Expand Up @@ -247,19 +244,15 @@ jobs:
run: cmake --install halide-build

- name: Package Halide
if: runner.os != 'Windows'
run: |
PACKAGE_NAME="halide-${{matrix.version}}-${{matrix.arch}}-${{matrix.os}}"
mv halide-install ./${PACKAGE_NAME}
tar -cJf ${PACKAGE_NAME}.tar.xz ${PACKAGE_NAME}
- name: Package Halide
if: runner.os == 'Windows'
shell: pwsh
run: |
$PACKAGE_NAME="halide-${{matrix.version}}-${{matrix.arch}}-${{matrix.os}}"
mv halide-install $PACKAGE_NAME
cmd.exe /c "7z a -ttar -snl -so $PACKAGE_NAME.tar $PACKAGE_NAME | 7z a -si $PACKAGE_NAME.tar.xz"
$PackageName="halide-${{matrix.version}}-${{matrix.arch}}-${{matrix.os}}"
Move-Item halide-install $PackageName
if ($IsWindows) {
cmd.exe /c "7z a -ttar -snl -so $PackageName.tar $PackageName | 7z a -si $PackageName.tar.xz"
} else {
tar -cJf "${PackageName}.tar.xz" "${PackageName}"
}
- name: Upload Halide package
uses: actions/upload-artifact@v3
Expand Down
54 changes: 0 additions & 54 deletions patches/halide-16-add-llvm-host-bin-dir-cmake-option.patch

This file was deleted.

0 comments on commit 19fda6b

Please sign in to comment.