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