1 name: LLVM Project Tests
17 default: '["ubuntu-latest", "windows-2019", "macOS-13"]'
40 # Use windows-2019 due to:
41 # https://developercommunity.visualstudio.com/t/Prev-Issue---with-__assume-isnan-/1597317
42 default: '["ubuntu-latest", "windows-2019", "macOS-13"]'
50 # Skip intermediate builds: always.
51 # Cancel intermediate builds: only if it is a pull request build.
52 # If the group name here is the same as the group name in the workflow that includes
53 # this one, then the action will try to wait on itself and get stuck.
54 group: llvm-project-${{ github.workflow }}-${{ inputs.projects }}${{ github.ref }}
55 cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
60 runs-on: ${{ matrix.os }}
62 image: ${{(startsWith(matrix.os, 'ubuntu') && 'ghcr.io/llvm/ci-ubuntu-22.04:latest') || null}}
68 os: ${{ fromJSON(inputs.os_list) }}
71 if: startsWith(matrix.os, 'windows')
72 uses: llvm/actions/setup-windows@main
75 # On Windows, starting with win19/20220814.1, cmake choose the 32-bit
76 # python3.10.6 libraries instead of the 64-bit libraries when building
77 # lldb. Using this setup-python action to make 3.10 the default
80 uses: actions/setup-python@v5
82 python-version: ${{ inputs.python_version }}
84 if: runner.os != 'Linux'
85 uses: llvm/actions/install-ninja@main
86 # actions/checkout deletes any existing files in the new git directory,
87 # so this needs to either run before ccache-action or it has to use
89 - uses: actions/checkout@v4
93 uses: hendrikmuhs/ccache-action@v1
95 # A full build of llvm, clang, lld, and lldb takes about 250MB
96 # of ccache space. There's not much reason to have more than this,
97 # because we usually won't need to save cache entries from older
98 # builds. Also, there is an overall 10GB cache limit, and each
99 # run creates a new cache entry so we want to ensure that we have
100 # enough cache space for all the tests to run at once and still
101 # fit under the 10 GB limit.
102 # Default to 2G to workaround: https://github.com/hendrikmuhs/ccache-action/issues/174
104 key: ${{ matrix.os }}
106 - name: Build and Test
108 # Workaround for https://github.com/actions/virtual-environments/issues/5900.
109 # This should be a no-op for non-mac OSes
110 PKG_CONFIG_PATH: /usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig//12
114 if [ "${{ runner.os }}" == "Linux" ]; then
115 builddir="/mnt/build/"
117 extra_cmake_args="-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang"
119 builddir="$(pwd)"/build
121 if [ "${{ runner.os }}" == "macOS" ]; then
122 # Workaround test failure on some lld tests on MacOS
123 # https://github.com/llvm/llvm-project/issues/81967
124 extra_cmake_args="-DLLVM_DISABLE_ASSEMBLY_FILES=ON"
126 echo "llvm-builddir=$builddir" >> "$GITHUB_OUTPUT"
130 -DLLVM_ENABLE_PROJECTS="${{ inputs.projects }}" \
131 -DCMAKE_BUILD_TYPE=Release \
132 -DLLVM_ENABLE_ASSERTIONS=ON \
133 -DLLDB_INCLUDE_TESTS=OFF \
134 -DLIBCLC_TARGETS_TO_BUILD="amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl" \
135 -DCMAKE_C_COMPILER_LAUNCHER=sccache \
136 -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
138 ${{ inputs.extra_cmake_args }}
139 ninja -C "$builddir" '${{ inputs.build_target }}'
141 - name: Build and Test libclc
142 if: "!startsWith(matrix.os, 'windows') && contains(inputs.projects, 'libclc')"
144 LLVM_BUILDDIR: ${{ steps.build-llvm.outputs.llvm-builddir }}
146 # The libclc tests don't have a generated check target so all we can
148 ninja -C "$LLVM_BUILDDIR"