| 1 |
# This workflow is intended to check that in-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: In-tree build & tests |
| 8 |
|
| 9 |
on: |
| 10 |
push: |
| 11 |
branches: |
| 12 |
# This check is expensive; do not run it after pushes to llvm_release_* |
| 13 |
- main |
| 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-out-of-tree-build.yml' # check-out-of-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-out-of-tree-build.yml' # check-out-of-tree-build workflow |
| 28 |
schedule: |
| 29 |
# Ideally, we might want to simplify our regular nightly build as we |
| 30 |
# probably don't need every configuration to be built every day: most of |
| 31 |
# them are only necessary in pre-commits to avoid breakages |
| 32 |
- cron: 0 0 * * * |
| 33 |
|
| 34 |
env: |
| 35 |
LLVM_VERSION: 16 |
| 36 |
|
| 37 |
jobs: |
| 38 |
build_and_test_linux: |
| 39 |
name: Linux |
| 40 |
strategy: |
| 41 |
matrix: |
| 42 |
build_type: [Release, Debug] |
| 43 |
shared_libs: [NoSharedLibs] |
| 44 |
include: |
| 45 |
- build_type: Release |
| 46 |
shared_libs: EnableSharedLibs |
| 47 |
fail-fast: false |
| 48 |
runs-on: ubuntu-22.04 |
| 49 |
steps: |
| 50 |
- name: Install dependencies |
| 51 |
run: | |
| 52 |
curl -L "https://apt.llvm.org/llvm-snapshot.gpg.key" | sudo apt-key add - |
| 53 |
curl -L "https://packages.lunarg.com/lunarg-signing-key-pub.asc" | sudo apt-key add - |
| 54 |
echo "deb https://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" | sudo tee -a /etc/apt/sources.list |
| 55 |
echo "deb https://packages.lunarg.com/vulkan jammy main" | sudo tee -a /etc/apt/sources.list |
| 56 |
sudo apt-get update |
| 57 |
sudo apt-get -yq --no-install-suggests --no-install-recommends install \ |
| 58 |
clang-${{ env.LLVM_VERSION }} \ |
| 59 |
spirv-tools |
| 60 |
# Linux systems in GitHub Actions already have older versions of clang |
| 61 |
# pre-installed. Make sure to override these with the relevant version. |
| 62 |
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{ env.LLVM_VERSION }} 1000 |
| 63 |
- name: Checkout LLVM sources |
| 64 |
uses: actions/checkout@v2 |
| 65 |
with: |
| 66 |
repository: llvm/llvm-project |
| 67 |
ref: release/16.x |
| 68 |
path: llvm-project |
| 69 |
- name: Checkout the translator sources |
| 70 |
uses: actions/checkout@v2 |
| 71 |
with: |
| 72 |
path: llvm-project/llvm/projects/SPIRV-LLVM-Translator |
| 73 |
- name: Get tag for SPIR-V Headers |
| 74 |
id: spirv-headers-tag |
| 75 |
run: | |
| 76 |
echo "spirv_headers_tag=$(cat llvm-project/llvm/projects/SPIRV-LLVM-Translator/spirv-headers-tag.conf)" >> $GITHUB_ENV |
| 77 |
- name: Checkout SPIR-V Headers |
| 78 |
uses: actions/checkout@v2 |
| 79 |
with: |
| 80 |
repository: KhronosGroup/SPIRV-Headers |
| 81 |
ref: ${{ env.spirv_headers_tag }} |
| 82 |
path: llvm-project/llvm/projects/SPIRV-Headers |
| 83 |
- name: Configure |
| 84 |
run: | |
| 85 |
mkdir build && cd build |
| 86 |
# ON/OFF specifically weren't used as a values for shared_libs matrix |
| 87 |
# field to improve usability of PR page: instead of (Release, ON) a |
| 88 |
# job will be displayed as (Release, EnableSharedLibs) |
| 89 |
SHARED_LIBS=OFF |
| 90 |
if [[ "${{ matrix.shared_libs }}" == "EnableSharedLibs" ]]; then |
| 91 |
SHARED_LIBS=ON |
| 92 |
fi |
| 93 |
cmake ${{ github.workspace }}/llvm-project/llvm \ |
| 94 |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ |
| 95 |
-DBUILD_SHARED_LIBS=${SHARED_LIBS} \ |
| 96 |
-DLLVM_TARGETS_TO_BUILD="X86" \ |
| 97 |
-DSPIRV_SKIP_CLANG_BUILD=ON \ |
| 98 |
-DSPIRV_SKIP_DEBUG_INFO_TESTS=ON \ |
| 99 |
-DLLVM_LIT_ARGS="-sv --no-progress-bar" \ |
| 100 |
-G "Unix Makefiles" |
| 101 |
- name: Build |
| 102 |
run: | |
| 103 |
cd build |
| 104 |
make llvm-spirv -j$(nproc) |
| 105 |
- name: Build tests & test |
| 106 |
run: | |
| 107 |
cd build |
| 108 |
make check-llvm-spirv -j$(nproc) |
| 109 |
|
| 110 |
build_windows: |
| 111 |
name: Windows |
| 112 |
strategy: |
| 113 |
matrix: |
| 114 |
build_type: [Release] |
| 115 |
fail-fast: false |
| 116 |
runs-on: windows-latest |
| 117 |
steps: |
| 118 |
- name: Checkout LLVM sources |
| 119 |
uses: actions/checkout@v2 |
| 120 |
with: |
| 121 |
repository: llvm/llvm-project |
| 122 |
ref: release/16.x |
| 123 |
path: llvm-project |
| 124 |
- name: Checkout the translator sources |
| 125 |
uses: actions/checkout@v2 |
| 126 |
with: |
| 127 |
path: llvm-project\\llvm\\projects\\SPIRV-LLVM-Translator |
| 128 |
- name: Get tag for SPIR-V Headers |
| 129 |
id: spirv-headers-tag |
| 130 |
run: | |
| 131 |
echo "spirv_headers_tag=$(type llvm-project\\llvm\\projects\\SPIRV-LLVM-Translator\\spirv-headers-tag.conf)" >> $GITHUB_ENV |
| 132 |
- name: Checkout SPIR-V Headers |
| 133 |
uses: actions/checkout@v2 |
| 134 |
with: |
| 135 |
repository: KhronosGroup/SPIRV-Headers |
| 136 |
ref: ${{ env.spirv_headers_tag }} |
| 137 |
path: llvm-project\\llvm\\projects\\SPIRV-Headers |
| 138 |
- name: Configure |
| 139 |
shell: bash |
| 140 |
run: | |
| 141 |
mkdir build && cd build |
| 142 |
cmake ..\\llvm-project\\llvm \ |
| 143 |
-Thost=x64 \ |
| 144 |
-DCMAKE_BUILD_TYPE=Release \ |
| 145 |
-DLLVM_TARGETS_TO_BUILD="X86" \ |
| 146 |
-DSPIRV_SKIP_CLANG_BUILD=ON \ |
| 147 |
-DSPIRV_SKIP_DEBUG_INFO_TESTS=ON \ |
| 148 |
-DLLVM_LIT_ARGS="-sv --no-progress-bar" |
| 149 |
- name: Build |
| 150 |
shell: bash |
| 151 |
run: | |
| 152 |
cd build |
| 153 |
cmake --build . --config ${{ matrix.build_type }} --target llvm-spirv -j2 |
| 154 |
# FIXME: Testing is disabled at the moment as it requires clang to be present |
| 155 |
# - name: Build tests & test |
| 156 |
# shell: bash |
| 157 |
# run: | |
| 158 |
# cd build |
| 159 |
# cmake --build . --config Release --target check-llvm-spirv -j2 |
| 160 |
|
| 161 |
build_and_test_macosx: |
| 162 |
name: macOS |
| 163 |
strategy: |
| 164 |
matrix: |
| 165 |
build_type: [Release] |
| 166 |
fail-fast: false |
| 167 |
runs-on: macos-latest |
| 168 |
continue-on-error: true |
| 169 |
steps: |
| 170 |
- name: Checkout LLVM sources |
| 171 |
uses: actions/checkout@v2 |
| 172 |
with: |
| 173 |
repository: llvm/llvm-project |
| 174 |
ref: release/16.x |
| 175 |
path: llvm-project |
| 176 |
- name: Checkout the translator sources |
| 177 |
uses: actions/checkout@v2 |
| 178 |
with: |
| 179 |
path: llvm-project/llvm/projects/SPIRV-LLVM-Translator |
| 180 |
- name: Get tag for SPIR-V Headers |
| 181 |
id: spirv-headers-tag |
| 182 |
run: | |
| 183 |
echo "spirv_headers_tag=$(cat llvm-project/llvm/projects/SPIRV-LLVM-Translator/spirv-headers-tag.conf)" >> $GITHUB_ENV |
| 184 |
- name: Checkout SPIR-V Headers |
| 185 |
uses: actions/checkout@v2 |
| 186 |
with: |
| 187 |
repository: KhronosGroup/SPIRV-Headers |
| 188 |
ref: ${{ env.spirv_headers_tag }} |
| 189 |
path: llvm-project/llvm/projects/SPIRV-Headers |
| 190 |
- name: Configure |
| 191 |
run: | |
| 192 |
mkdir build && cd build |
| 193 |
cmake ${{ github.workspace }}/llvm-project/llvm \ |
| 194 |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ |
| 195 |
-DLLVM_TARGETS_TO_BUILD="X86" \ |
| 196 |
-DSPIRV_SKIP_CLANG_BUILD=ON \ |
| 197 |
-DSPIRV_SKIP_DEBUG_INFO_TESTS=ON \ |
| 198 |
-DLLVM_LIT_ARGS="-sv --no-progress-bar" \ |
| 199 |
-G "Unix Makefiles" |
| 200 |
- name: Build |
| 201 |
run: | |
| 202 |
cd build |
| 203 |
make llvm-spirv -j$(sysctl -n hw.logicalcpu) |
| 204 |
# FIXME: Testing is disabled at the moment as it requires clang to be present |
| 205 |
# - name: Build tests & test |
| 206 |
# run: | |
| 207 |
# cd build |
| 208 |
# make check-llvm-spirv -j2 |