| 1 |
# This workflow is intended to check that out-of-tree build of the translator is |
| 2 |
# healthy and all tests pass. It is used in pre-commits and nightly builds. |
| 3 |
# |
| 4 |
# Documentation for GitHub Actions: |
| 5 |
# [workflow-syntax]: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions |
| 6 |
# [context-and-expression-syntax]: https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions |
| 7 |
name: Out-of-tree build & tests |
| 8 |
|
| 9 |
on: |
| 10 |
push: |
| 11 |
branches: |
| 12 |
- main |
| 13 |
- llvm_release_* |
| 14 |
paths-ignore: # no need to check build for: |
| 15 |
- 'docs/**' # documentation |
| 16 |
- '**.md' # README |
| 17 |
- '**/check-code-style.yml' # check-code-style workflow |
| 18 |
- '**/check-in-tree-build.yml' # check-in-tree-build workflow |
| 19 |
pull_request: |
| 20 |
branches: |
| 21 |
- main |
| 22 |
- llvm_release_* |
| 23 |
paths-ignore: # no need to check build for: |
| 24 |
- 'docs/**' # documentation |
| 25 |
- '**.md' # README |
| 26 |
- '**/check-code-style.yml' # check-code-style workflow |
| 27 |
- '**/check-in-tree-build.yml' # check-in-tree-build workflow |
| 28 |
schedule: |
| 29 |
- cron: 0 0 * * * |
| 30 |
|
| 31 |
env: |
| 32 |
LLVM_VERSION: 16 |
| 33 |
|
| 34 |
jobs: |
| 35 |
build_and_test: |
| 36 |
name: Linux |
| 37 |
strategy: |
| 38 |
matrix: |
| 39 |
build_type: [Release, Debug] |
| 40 |
fail-fast: false |
| 41 |
runs-on: ubuntu-22.04 |
| 42 |
steps: |
| 43 |
- name: Install dependencies |
| 44 |
run: | |
| 45 |
curl -L "https://apt.llvm.org/llvm-snapshot.gpg.key" | sudo apt-key add - |
| 46 |
curl -L "https://packages.lunarg.com/lunarg-signing-key-pub.asc" | sudo apt-key add - |
| 47 |
echo "deb https://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" | sudo tee -a /etc/apt/sources.list |
| 48 |
echo "deb https://packages.lunarg.com/vulkan jammy main" | sudo tee -a /etc/apt/sources.list |
| 49 |
sudo apt-get update |
| 50 |
sudo apt-get -yq --no-install-suggests --no-install-recommends install \ |
| 51 |
clang-${{ env.LLVM_VERSION }} \ |
| 52 |
llvm-${{ env.LLVM_VERSION }}-dev \ |
| 53 |
llvm-${{ env.LLVM_VERSION }}-tools \ |
| 54 |
mlir-${{ env.LLVM_VERSION }}-tools \ |
| 55 |
spirv-tools |
| 56 |
# Linux systems in GitHub Actions already have older versions of clang |
| 57 |
# pre-installed. Make sure to override these with the relevant version. |
| 58 |
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{ env.LLVM_VERSION }} 1000 |
| 59 |
- name: Checkout the translator sources |
| 60 |
uses: actions/checkout@v2 |
| 61 |
with: |
| 62 |
path: SPIRV-LLVM-Translator |
| 63 |
- name: Get tag for SPIR-V Headers |
| 64 |
id: spirv-headers-tag |
| 65 |
run: | |
| 66 |
echo "spirv_headers_tag=$(cat SPIRV-LLVM-Translator/spirv-headers-tag.conf)" >> $GITHUB_ENV |
| 67 |
- name: Checkout SPIR-V Headers |
| 68 |
uses: actions/checkout@v2 |
| 69 |
with: |
| 70 |
repository: KhronosGroup/SPIRV-Headers |
| 71 |
ref: ${{ env.spirv_headers_tag }} |
| 72 |
path: SPIRV-Headers |
| 73 |
- name: Configure |
| 74 |
run: | |
| 75 |
mkdir build && cd build |
| 76 |
cmake ${{ github.workspace }}/SPIRV-LLVM-Translator \ |
| 77 |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ |
| 78 |
-DCMAKE_CXX_FLAGS="-Werror" \ |
| 79 |
-DLLVM_INCLUDE_TESTS=ON \ |
| 80 |
-DLLVM_EXTERNAL_LIT="/usr/lib/llvm-${{ env.LLVM_VERSION }}/build/utils/lit/lit.py" \ |
| 81 |
-DLLVM_EXTERNAL_PROJECTS="SPIRV-Headers" \ |
| 82 |
-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=${{ github.workspace }}/SPIRV-Headers \ |
| 83 |
-G "Unix Makefiles" |
| 84 |
- name: Build |
| 85 |
run: | |
| 86 |
cd build |
| 87 |
make llvm-spirv -j$(nproc) |
| 88 |
- name: Build tests & test |
| 89 |
run: | |
| 90 |
cd build |
| 91 |
make check-llvm-spirv -j$(nproc) |