From 1d2f12eca06ac05efd4a6be89a2ede6b98c0d1e0 Mon Sep 17 00:00:00 2001 From: Wenju He Date: Tue, 4 Jun 2024 17:46:53 +0800 Subject: [PATCH 1/5] [CI] Add out-of-tree build --- ...n.yml => on-push-verification-in-tree.yml} | 0 .../on-push-verification-out-of-tree.yml | 88 +++++++++++++++++++ 2 files changed, 88 insertions(+) rename .github/workflows/{on-push-verification.yml => on-push-verification-in-tree.yml} (100%) create mode 100644 .github/workflows/on-push-verification-out-of-tree.yml diff --git a/.github/workflows/on-push-verification.yml b/.github/workflows/on-push-verification-in-tree.yml similarity index 100% rename from .github/workflows/on-push-verification.yml rename to .github/workflows/on-push-verification-in-tree.yml diff --git a/.github/workflows/on-push-verification-out-of-tree.yml b/.github/workflows/on-push-verification-out-of-tree.yml new file mode 100644 index 0000000..9d67b71 --- /dev/null +++ b/.github/workflows/on-push-verification-out-of-tree.yml @@ -0,0 +1,88 @@ +# ===--- +# Running on push & pull_request. +# This workflow parses the destination branch +# to choose correct dependencies revisions +# ===--- + +name: Out-of-tree build +run-name: '${{ github.event_name }}: ${{ github.base_ref }} ${{ github.ref_name }}' # github.base_ref null for 'on: push' + +permissions: + contents: read + +env: + LLVM_PACKAGE_VERSION: 19 + PREFERRED_LLVM_VERSION: 19.0 + ref: main + +on: + push: + branches: + - ${{ env.ref }} + pull_request: + branches: + - ${{ env.ref }} + types: + - opened + - reopened + - synchronize # commit pushed to the PR + - ready_for_review # moved from draft state + +jobs: + + verify_default_branch: + name: Linux + # ref_name for 'on: push' + # base_ref for 'on: pull_request' + runs-on: ubuntu-22.04 + steps: + + - name: Install llvm and its dependencies + run: + curl -L "https://apt.llvm.org/llvm-snapshot.gpg.key" | sudo apt-key add - + curl -L "https://packages.lunarg.com/lunarg-signing-key-pub.asc" | sudo apt-key add - + echo "deb https://apt.llvm.org/jammy/ llvm-toolchain-jammy main" | sudo tee -a /etc/apt/sources.list + echo "deb https://packages.lunarg.com/vulkan jammy main" | sudo tee -a /etc/apt/sources.list + sudo apt-get update + sudo apt-get -yq --no-install-suggests --no-install-recommends install \ + clang-${{ env.LLVM_PACKAGE_VERSION }} \ + llvm-${{ env.LLVM_PACKAGE_VERSION }}-dev \ + libclang-${{ env.LLVM_PACKAGE_VERSION }}-dev \ + libclang-cpp${{ env.LLVM_PACKAGE_VERSION }}-dev \ + libpolly-${{ env.LLVM_PACKAGE_VERSION }}-dev \ + libzstd-dev \ + libedit-dev + + - name: Checkout SPIRV-LLVM-Translator sources + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + with: + path: SPIRV-LLVM-Translator + ref: ${{ env.ref }} + + - name: Build SPIRV-LLVM-Translator + run: | + builddir=${{ github.workspace }}/SPIRV-LLVM-Translator/build + cmake -B "$builddir" \ + ${{ github.workspace }}/SPIRV-LLVM-Translator \ + -DLLVM_INCLUDE_TESTS=OFF \ + -DCMAKE_INSTALL_PREFIX="$builddir"/install \ + -DCMAKE_BUILD_TYPE=Release + cmake --build "$builddir" -j $(nproc) + cmake --install "$builddir" + echo "spirv-translator-dir=${builddir}/install" >> $GITHUB_ENV + + - name: Checkout opencl-clang sources + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + with: + path: opencl-clang + ref: ${{ github.ref }} + + - name: Build opencl-clang + run: | + mkdir build && cd build + cmake ${{ github.workspace }}/opencl-clang \ + -DPREFERRED_LLVM_VERSION=${{ env.PREFERRED_LLVM_VERSION }} \ + -DLLVMSPIRV_INCLUDED_IN_LLVM=OFF \ + -DSPIRV_TRANSLATOR_DIR=${{ env.spirv-translator-dir }} \ + -DCMAKE_BUILD_TYPE=Release + cmake --build . -j $(nproc) From 991a6ea0e8e959384001541c030fce5e48b901e6 Mon Sep 17 00:00:00 2001 From: Wenju He Date: Tue, 4 Jun 2024 18:18:53 +0800 Subject: [PATCH 2/5] repository KhronosGroup/SPIRV-LLVM-Translator --- .../on-push-verification-out-of-tree.yml | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/on-push-verification-out-of-tree.yml b/.github/workflows/on-push-verification-out-of-tree.yml index 9d67b71..efedffe 100644 --- a/.github/workflows/on-push-verification-out-of-tree.yml +++ b/.github/workflows/on-push-verification-out-of-tree.yml @@ -11,17 +11,16 @@ permissions: contents: read env: - LLVM_PACKAGE_VERSION: 19 - PREFERRED_LLVM_VERSION: 19.0 - ref: main + LLVM_VERSION: 19 + LLVM_VERSION_MINOR: 0 on: push: branches: - - ${{ env.ref }} + - main pull_request: branches: - - ${{ env.ref }} + - main types: - opened - reopened @@ -45,19 +44,20 @@ jobs: echo "deb https://packages.lunarg.com/vulkan jammy main" | sudo tee -a /etc/apt/sources.list sudo apt-get update sudo apt-get -yq --no-install-suggests --no-install-recommends install \ - clang-${{ env.LLVM_PACKAGE_VERSION }} \ - llvm-${{ env.LLVM_PACKAGE_VERSION }}-dev \ - libclang-${{ env.LLVM_PACKAGE_VERSION }}-dev \ - libclang-cpp${{ env.LLVM_PACKAGE_VERSION }}-dev \ - libpolly-${{ env.LLVM_PACKAGE_VERSION }}-dev \ + clang-${{ env.LLVM_VERSION }} \ + llvm-${{ env.LLVM_VERSION }}-dev \ + libclang-${{ env.LLVM_VERSION }}-dev \ + libclang-cpp${{ env.LLVM_VERSION }}-dev \ + libpolly-${{ env.LLVM_VERSION }}-dev \ libzstd-dev \ libedit-dev - name: Checkout SPIRV-LLVM-Translator sources uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: + repository: KhronosGroup/SPIRV-LLVM-Translator path: SPIRV-LLVM-Translator - ref: ${{ env.ref }} + ref: main - name: Build SPIRV-LLVM-Translator run: | @@ -81,7 +81,7 @@ jobs: run: | mkdir build && cd build cmake ${{ github.workspace }}/opencl-clang \ - -DPREFERRED_LLVM_VERSION=${{ env.PREFERRED_LLVM_VERSION }} \ + -DLLVM_VERSION_MINOR="${{ env.LLVM_VERSION }}.${{ env.LLVM_VERSION_MINOR }}" \ -DLLVMSPIRV_INCLUDED_IN_LLVM=OFF \ -DSPIRV_TRANSLATOR_DIR=${{ env.spirv-translator-dir }} \ -DCMAKE_BUILD_TYPE=Release From 76f99ae6f7326e5754e7926bae2dbfbc4c1a4885 Mon Sep 17 00:00:00 2001 From: Wenju He Date: Tue, 4 Jun 2024 18:24:38 +0800 Subject: [PATCH 3/5] add missing | --- .github/workflows/on-push-verification-out-of-tree.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/on-push-verification-out-of-tree.yml b/.github/workflows/on-push-verification-out-of-tree.yml index efedffe..bfd9c92 100644 --- a/.github/workflows/on-push-verification-out-of-tree.yml +++ b/.github/workflows/on-push-verification-out-of-tree.yml @@ -37,7 +37,7 @@ jobs: steps: - name: Install llvm and its dependencies - run: + run: | curl -L "https://apt.llvm.org/llvm-snapshot.gpg.key" | sudo apt-key add - curl -L "https://packages.lunarg.com/lunarg-signing-key-pub.asc" | sudo apt-key add - echo "deb https://apt.llvm.org/jammy/ llvm-toolchain-jammy main" | sudo tee -a /etc/apt/sources.list From 56d9a93fe78eab762329f747f829fa99163d1f33 Mon Sep 17 00:00:00 2001 From: Wenju He Date: Tue, 4 Jun 2024 18:32:00 +0800 Subject: [PATCH 4/5] set as not required --- .github/workflows/on-push-verification-out-of-tree.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/on-push-verification-out-of-tree.yml b/.github/workflows/on-push-verification-out-of-tree.yml index bfd9c92..87f4b4b 100644 --- a/.github/workflows/on-push-verification-out-of-tree.yml +++ b/.github/workflows/on-push-verification-out-of-tree.yml @@ -30,7 +30,7 @@ on: jobs: verify_default_branch: - name: Linux + name: linux # ref_name for 'on: push' # base_ref for 'on: pull_request' runs-on: ubuntu-22.04 From 31afe7ec281be43e72c287090b9347dc4a48a16e Mon Sep 17 00:00:00 2001 From: Wenju He Date: Tue, 4 Jun 2024 18:38:21 +0800 Subject: [PATCH 5/5] PREFERRED_LLVM_VERSION --- .github/workflows/on-push-verification-out-of-tree.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/on-push-verification-out-of-tree.yml b/.github/workflows/on-push-verification-out-of-tree.yml index 87f4b4b..17769b1 100644 --- a/.github/workflows/on-push-verification-out-of-tree.yml +++ b/.github/workflows/on-push-verification-out-of-tree.yml @@ -81,7 +81,7 @@ jobs: run: | mkdir build && cd build cmake ${{ github.workspace }}/opencl-clang \ - -DLLVM_VERSION_MINOR="${{ env.LLVM_VERSION }}.${{ env.LLVM_VERSION_MINOR }}" \ + -DPREFERRED_LLVM_VERSION="${{ env.LLVM_VERSION }}.${{ env.LLVM_VERSION_MINOR }}" \ -DLLVMSPIRV_INCLUDED_IN_LLVM=OFF \ -DSPIRV_TRANSLATOR_DIR=${{ env.spirv-translator-dir }} \ -DCMAKE_BUILD_TYPE=Release