-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
70 lines (63 loc) · 2.32 KB
/
Copy pathaction.yml
File metadata and controls
70 lines (63 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Setup C++
description: 'Configure the C++ toolchain, clang-format, and compiler caching'
inputs:
cache:
description: 'Enable ccache on Linux/macOS and sccache on Windows'
default: 'true'
cache_key:
description: 'Additional compiler cache key'
default: 'cpp'
clang_format:
description: 'Install clang-format when it is not already available'
default: 'true'
msvc_arch:
description: 'MSVC target architecture on Windows'
default: 'x64'
runs:
using: 'composite'
steps:
- name: Configure MSVC
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
with:
arch: ${{ inputs.msvc_arch }}
if: ${{ runner.os == 'Windows' }}
- name: Install clang-format (Linux)
shell: bash
run: |
if ! command -v clang-format >/dev/null 2>&1; then
sudo apt-get update
sudo apt-get install --yes clang-format
fi
clang-format --version
if: ${{ inputs.clang_format == 'true' && runner.os == 'Linux' }}
- name: Install clang-format (macOS)
shell: bash
run: |
if ! command -v clang-format >/dev/null 2>&1; then
brew install clang-format
fi
clang-format --version
if: ${{ inputs.clang_format == 'true' && runner.os == 'macOS' }}
- name: Install clang-format (Windows)
shell: pwsh
run: |
if (-not (Get-Command clang-format -ErrorAction SilentlyContinue)) {
choco install llvm --no-progress --yes
$env:Path = "C:\Program Files\LLVM\bin;$env:Path"
"C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
}
clang-format --version
if: ${{ inputs.clang_format == 'true' && runner.os == 'Windows' }}
- name: Setup compiler cache
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
with:
key: ${{ runner.os }}-${{ inputs.cache_key }}
variant: ${{ runner.os == 'Windows' && 'sccache' || 'ccache' }}
create-symlink: ${{ runner.os != 'Windows' }}
if: ${{ inputs.cache == 'true' }}
- name: Use sccache for MSVC
shell: bash
run: |
echo 'CC=sccache cl' >> "$GITHUB_ENV"
echo 'CXX=sccache cl' >> "$GITHUB_ENV"
if: ${{ inputs.cache == 'true' && runner.os == 'Windows' }}