[SLP]Fix PR104422: Wrong value truncation
[llvm-project.git] / .github / workflows / llvm-project-tests.yml
blob17a54be16badc151a0dc67124c997ff43a629322
1 name: LLVM Project Tests
3 permissions:
4   contents: read
6 on:
7   workflow_dispatch:
8     inputs:
9       build_target:
10         required: false
11       projects:
12         required: false
13       extra_cmake_args:
14         required: false
15       os_list:
16         required: false
17         default: '["ubuntu-latest", "windows-2019", "macOS-13"]'
18       python_version:
19         required: false
20         type: string
21         default: '3.11'
22   workflow_call:
23     inputs:
24       build_target:
25         required: false
26         type: string
27         default: "all"
29       projects:
30         required: true
31         type: string
33       extra_cmake_args:
34         required: false
35         type: string
37       os_list:
38         required: false
39         type: string
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"]'
44       python_version:
45         required: false
46         type: string
47         default: '3.11'
49 concurrency:
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/') }}
57 jobs:
58   lit-tests:
59     name: Lit Tests
60     runs-on: ${{ matrix.os }}
61     container:
62       image: ${{(startsWith(matrix.os, 'ubuntu') && 'ghcr.io/llvm/ci-ubuntu-22.04:latest') || null}}
63       volumes:
64         - /mnt/:/mnt/
65     strategy:
66       fail-fast: false
67       matrix:
68         os: ${{ fromJSON(inputs.os_list) }}
69     steps:
70       - name: Setup Windows
71         if: startsWith(matrix.os, 'windows')
72         uses: llvm/actions/setup-windows@main
73         with:
74           arch: amd64
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
78       # python fixes this.
79       - name: Setup Python
80         uses: actions/setup-python@v5
81         with:
82           python-version: ${{ inputs.python_version }}
83       - name: Install Ninja
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
88       # clean: false.
89       - uses: actions/checkout@v4
90         with:
91           fetch-depth: 250
92       - name: Setup ccache
93         uses: hendrikmuhs/ccache-action@v1
94         with:
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
103           max-size: 2G
104           key: ${{ matrix.os }}
105           variant: sccache
106       - name: Build and Test
107         env:
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
111         shell: bash
112         id: build-llvm
113         run: |
114           if [ "${{ runner.os }}" == "Linux" ]; then
115             builddir="/mnt/build/"
116             mkdir -p $builddir
117             extra_cmake_args="-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang"
118           else
119             builddir="$(pwd)"/build
120           fi
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"
125           fi
126           echo "llvm-builddir=$builddir" >> "$GITHUB_OUTPUT"
127           cmake -G Ninja \
128                 -B "$builddir" \
129                 -S llvm \
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 \
137                 $extra_cmake_args \
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')"
143         env:
144           LLVM_BUILDDIR: ${{ steps.build-llvm.outputs.llvm-builddir }}
145         run: |
146           # The libclc tests don't have a generated check target so all we can
147           # do is build it.
148           ninja -C "$LLVM_BUILDDIR"