-
Notifications
You must be signed in to change notification settings - Fork 15
131 lines (114 loc) · 4.31 KB
/
build.yml
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Build
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
jobs:
build:
name: '${{ matrix.os }} shared=${{ matrix.shared }} ${{ matrix.build_type }}'
runs-on: ${{ matrix.os }}
env:
CCACHE_COMPRESS: 'true'
CCACHE_COMPRESSLEVEL: '6'
CCACHE_MAXSIZE: '500M'
CCACHE_WIN_VERSION: 4.2.1
CCACHE_KEY: 'ccache-${{ matrix.os }}-${{ matrix.shared }}-${{ matrix.build_type }}'
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
shared: [true, false]
build_type: [Release]
include:
- os: windows-latest
triplet: x64-windows
- os: macos-latest
triplet: x64-osx
- os: ubuntu-latest
triplet: x64-linux
- os: ubuntu-latest
shared: true
build_type: Coverage
steps:
# checkout to workspace
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Get CMake and ninja
uses: lukka/get-cmake@v3.20.1
- name: Restore artifacts, or run vcpkg, build and cache artifacts
uses: lukka/run-vcpkg@v7
id: runvcpkg
with:
vcpkgArguments: 'boost-variant boost-optional boost-format boost-functional boost-range boost-iterator boost-rational'
vcpkgTriplet: '${{ matrix.triplet }}'
vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg'
vcpkgGitCommitId: '7ad236f60f5f7197e93c4d7f0807622f4899076d'
- name: 'Install ubuntu dependencies'
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y ccache
- name: 'Install ccache on windows'
if: matrix.os == 'windows-latest'
shell: cmake -P {0}
run: |
set(ccache_url "https://github.com/cristianadam/ccache/releases/download/v$ENV{CCACHE_WIN_VERSION}/Windows.tar.xz")
file(DOWNLOAD "${ccache_url}" ./ccache.tar.xz SHOW_PROGRESS)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./ccache.tar.xz)
working-directory: ${{ runner.workspace }}
- name: 'Install ccache on macos'
if: matrix.os == 'macos-latest'
run: |
brew install ccache
- name: 'Config env for ccache'
run: |
echo "${{ runner.workspace }}" >> $GITHUB_PATH
echo "CCACHE_BASEDIR=${{ github.workspace }}" >> $GITHUB_ENV
echo "CCACHE_DIR=${{ github.workspace }}/.ccache" >> $GITHUB_ENV
shell: bash
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
message("::set-output name=timestamp::${current_date}")
- name: ccache cache files
uses: actions/cache@v1.1.0
with:
path: ${{ github.workspace }}/.ccache
key: ${{ env.CCACHE_KEY }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: ${{ env.CCACHE_KEY }}-
- name: 'zero ccache stats'
run: ccache -z
- name: 'print ccache config'
run: ccache -p
- name: 'Build with CMake and Ninja'
uses: lukka/run-cmake@v3
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
useVcpkgToolchainFile: true
buildDirectory: '${{ runner.workspace }}/b/ninja'
cmakeAppendedArgs: >-
-GNinja
-DCMAKE_C_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DBUILD_SHARED_LIBS=${{ matrix.shared }}
- name: 'print ccache stats'
run: ccache -s
- name: Add library directory to PATH for Tests
if: matrix.os == 'windows-latest'
run: 'echo "${{ runner.workspace }}/b/ninja/src" >> $GITHUB_PATH'
shell: bash
- name: Show library sizes
run: 'ls -l ${{ runner.workspace }}/b/ninja/src'
shell: bash
- name: 'Run tests'
run: ctest . --output-on-failure
working-directory: '${{ runner.workspace }}/b/ninja'
- uses: codecov/codecov-action@v1
if: matrix.build_type == 'Coverage'
with:
root_dir: '${{ github.workspace }}'
working-directory: '${{ runner.workspace }}/b/ninja'