forked from google/clspv
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add github actions to generate artifacts
- Loading branch information
Showing
3 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name: 'setup-ninja' | ||
description: 'Setup Ninja' | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup Ninja | ||
uses: seanmiddleditch/gha-setup-ninja@master | ||
- name: Setup MSVC with Ninja | ||
uses: ilammy/msvc-dev-cmd@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
name: Generate artifacts | ||
on: | ||
push: | ||
|
||
jobs: | ||
build: | ||
name: Build ${{ matrix.os }} ${{ matrix.android }} ${{ matrix.abi }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
android: [false] | ||
abi: [''] | ||
include: | ||
- os: windows-latest | ||
- os: ubuntu-latest | ||
- os: ubuntu-latest | ||
android: true | ||
abi: x86_64 | ||
- os: ubuntu-latest | ||
android: true | ||
abi: arm64-v8a | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Free space on runner | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
run: | | ||
set +x | ||
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 100 | ||
df -h | ||
sudo apt-get update | ||
sudo apt-get remove -y '^dotnet-.*' | ||
sudo apt-get remove -y '^temurin-.*' | ||
sudo apt-get remove -y azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox | ||
sudo apt-get autoremove -y | ||
sudo apt-get clean | ||
sudo rm -rf /usr/share/dotnet/ | ||
sudo rm -rf /usr/local/share/powershell | ||
sudo rm -rf /usr/local/share/chromium | ||
sudo rm -rf /usr/local/lib/node_modules | ||
df -h | ||
- name: Setup Ninja | ||
uses: ./.github/actions/setup-ninja | ||
- name: Download and extract Android NDK | ||
if: ${{ matrix.android }} | ||
run: | | ||
set -x | ||
wget https://dl.google.com/android/repository/android-ndk-r27c-linux.zip | ||
unzip android-ndk-r27c-linux.zip | ||
rm -rf android-ndk-r27c-linux.zip | ||
- name: Select build directory | ||
shell: bash | ||
run: | | ||
if [ $RUNNER_OS == "Windows" ]; then | ||
echo "builddir=C:/build" >> $GITHUB_ENV | ||
else | ||
echo "builddir=${{ github.workspace }}/build" >> $GITHUB_ENV | ||
fi | ||
- name: Fetch dependencies | ||
run: python3 ./utils/fetch_sources.py --shallow | ||
- name: Download LLVM Windows | ||
if: ${{ matrix.os == 'windows-latest' }} | ||
shell: bash | ||
env: | ||
LLVM_ARCHIVE_PREFIX: LLVM-19.1.3-Windows-X64 | ||
run: | | ||
set -x | ||
curl -L https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.3/${LLVM_ARCHIVE_PREFIX}.tar.xz --output ${LLVM_ARCHIVE_PREFIX}.tar.xz | ||
tar -xf ${LLVM_ARCHIVE_PREFIX}.tar.xz | ||
rm -rf ${LLVM_ARCHIVE_PREFIX}.tar.xz | ||
echo "llvmnative=$(pwd)/${LLVM_ARCHIVE_PREFIX}" >> $GITHUB_ENV | ||
echo "clangxxbinary=clang++.exe" >> $GITHUB_ENV | ||
echo "clangbinary=clang.exe" >> $GITHUB_ENV | ||
- name: Download LLVM Linux | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
env: | ||
LLVM_ARCHIVE_PREFIX: LLVM-19.1.3-Linux-X64 | ||
run: | | ||
set -x | ||
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.3/${LLVM_ARCHIVE_PREFIX}.tar.xz | ||
tar -xf ${LLVM_ARCHIVE_PREFIX}.tar.xz | ||
rm -rf ${LLVM_ARCHIVE_PREFIX}.tar.xz | ||
echo "llvmnative=${{ github.workspace }}/${LLVM_ARCHIVE_PREFIX}" >> $GITHUB_ENV | ||
echo "clangxxbinary=clang++" >> $GITHUB_ENV | ||
echo "clangbinary=clang" >> $GITHUB_ENV | ||
- name: Build libclc | ||
if: ${{ matrix.android }} | ||
env: | ||
LIBCLC_DIR: ${{ github.workspace }}/build_libclc | ||
run: | | ||
set -x | ||
cmake -S '${{ github.workspace }}/third_party/llvm/libclc' -B ${LIBCLC_DIR} -G Ninja \ | ||
-DLLVM_CMAKE_DIR=${{ env.llvmnative }}/lib/cmake \ | ||
-DCMAKE_C_COMPILER=${{ env.llvmnative }}/bin/${{ env.clangbinary }} \ | ||
-DCMAKE_CXX_COMPILER=${{ env.llvmnative }}/bin/${{ env.clangxxbinary }} \ | ||
-DCMAKE_CXX_FLAGS="-fuse-ld=lld" \ | ||
-DLIBCLC_TARGETS_TO_BUILD="clspv--;clspv64--" | ||
cmake --build ${LIBCLC_DIR} | ||
ls -l ${LIBCLC_DIR} | ||
echo "android-cmake-args=-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/android-ndk-r27c/build/cmake/android.toolchain.cmake -DANDROID_ABI=${{ matrix.abi }} -DCLSPV_EXTERNAL_LIBCLC_DIR=${LIBCLC_DIR}" >> $GITHUB_ENV | ||
- name: Configure & Build | ||
shell: bash | ||
run: | | ||
set -x | ||
cmake -B '${{ env.builddir }}' -S '${{ github.workspace }}' -G Ninja \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
${{ env.android-cmake-args }} \ | ||
-DCMAKE_C_COMPILER=${{ env.llvmnative }}/bin/${{ env.clangbinary }} \ | ||
-DCMAKE_CXX_COMPILER=${{ env.llvmnative }}/bin/${{ env.clangxxbinary }} \ | ||
-DCMAKE_CXX_FLAGS="-fuse-ld=lld -Wno-unused-command-line-argument -Wno-unknown-warning-option" | ||
ls -l '${{ env.builddir }}' | ||
cmake --build '${{ env.builddir }}' --config Release | ||
ls -l '${{ env.builddir }}' | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: clspv-${{ matrix.os }}-${{ matrix.abi }}-${{ matrix.android }} | ||
path: '${{ env.builddir }}' |