Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / .github / workflows / llvm-project-tests.yml
blob996cfe41f047f679651b39d29af67b3dd851a1b5
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   workflow_call:
14     inputs:
15       build_target:
16         required: true
17         type: string
19       projects:
20         required: true
21         type: string
23 concurrency:
24   # Skip intermediate builds: always.
25   # Cancel intermediate builds: only if it is a pull request build.
26   # If the group name here is the same as the group name in the workflow that includes
27   # this one, then the action will try to wait on itself and get stuck.
28   group: llvm-project-${{ github.workflow }}-${{ inputs.projects }}${{ github.ref }}
29   cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
31 jobs:
32   lit-tests:
33     name: Lit Tests
34     runs-on: ${{ matrix.os }}
35     strategy:
36       fail-fast: false
37       matrix:
38         os:
39           - ubuntu-latest
40           # Use windows-2019 due to:
41           # https://developercommunity.visualstudio.com/t/Prev-Issue---with-__assume-isnan-/1597317
42           - windows-2019
43           # We're using a specific version of macOS due to:
44           # https://github.com/actions/virtual-environments/issues/5900
45           - macOS-11
46     steps:
47       - name: Setup Windows
48         if: startsWith(matrix.os, 'windows')
49         uses: llvm/actions/setup-windows@main
50         with:
51           arch: amd64
52       # On Windows, starting with win19/20220814.1, cmake choose the 32-bit
53       # python3.10.6 libraries instead of the 64-bit libraries when building
54       # lldb.  Using this setup-python action to make 3.10 the default
55       # python fixes this.
56       - name: Setup Python
57         uses: actions/setup-python@v4
58         with:
59           python-version: '3.11'
60       - name: Install Ninja
61         uses: llvm/actions/install-ninja@main
62       # actions/checkout deletes any existing files in the new git directory,
63       # so this needs to either run before ccache-action or it has to use
64       # clean: false.
65       - uses: actions/checkout@v4
66         with:
67           fetch-depth: 250
68       - name: Setup ccache
69         uses: hendrikmuhs/ccache-action@v1
70         with:
71           # A full build of llvm, clang, lld, and lldb takes about 250MB
72           # of ccache space. There's not much reason to have more than this,
73           # because we usually won't need to save cache entries from older
74           # builds.  Also, there is an overall 10GB cache limit, and each
75           # run creates a new cache entry so we want to ensure that we have
76           # enough cache space for all the tests to run at once and still
77           # fit under the 10 GB limit.
78           max-size: 500M
79           key: sccache-${{ matrix.os }}
80           variant: sccache
81       - name: Build and Test
82         uses: llvm/actions/build-test-llvm-project@main
83         env:
84           # Workaround for https://github.com/actions/virtual-environments/issues/5900.
85           # This should be a no-op for non-mac OSes
86           PKG_CONFIG_PATH: /usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig//12
87         with:
88           cmake_args: '-GNinja -DLLVM_ENABLE_PROJECTS="${{ inputs.projects }}" -DCMAKE_BUILD_TYPE=Release -DLLDB_INCLUDE_TESTS=OFF -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache'
89           build_target: '${{ inputs.build_target }}'
91       - name: Build and Test libclc
92         if: "!startsWith(matrix.os, 'windows') && contains(inputs.projects, 'libclc')"
93         run: |
94           # Make sure all of LLVM libraries that llvm-config needs are built.
95           ninja -C build
96           cmake -G Ninja -S libclc -B libclc-build -DLLVM_DIR="$(pwd)"/build/lib/cmake/llvm -DLIBCLC_TARGETS_TO_BUILD="amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl"
97           ninja -C libclc-build
98           ninja -C libclc-build test