diff --git a/.github/actions/setup-ninja/action.yml b/.github/actions/setup-ninja/action.yml new file mode 100644 index 000000000..fc6de06a6 --- /dev/null +++ b/.github/actions/setup-ninja/action.yml @@ -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 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..5ace4600a --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/generate_artifacts.yml b/.github/workflows/generate_artifacts.yml new file mode 100644 index 000000000..2df4abdba --- /dev/null +++ b/.github/workflows/generate_artifacts.yml @@ -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.clangbinary }} \ + -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 }}'