-
-
Notifications
You must be signed in to change notification settings - Fork 38
71 lines (59 loc) · 1.91 KB
/
cmake.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
name: CMake
on:
push:
pull_request:
release:
types: [created]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build:
name: ${{matrix.name}}
strategy:
matrix:
include:
- os: ubuntu-20.04
name: Pi400KB Ubuntu
cache-key: pi400kb-ubuntu
cmake-args: -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
apt-packages: ccache libconfig-dev
runs-on: ${{matrix.os}}
env:
RELEASE_FILE: ${{github.event.repository.name}}-${{github.event.release.tag_name}}-${{matrix.release-suffix}}
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
submodules: true
- name: Cache
uses: actions/cache@v2
with:
path: /home/runner/.ccache
key: ccache-${{matrix.cache-key}}-${{github.ref}}-${{github.sha}}
restore-keys: |
ccache-${{matrix.cache-key}}-${{github.ref}}
ccache-${{matrix.cache-key}}-
# Linux deps
- name: Install deps
if: runner.os == 'Linux'
run: |
sudo apt update && sudo apt install ${{matrix.apt-packages}}
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Set Tag Variable
if: github.event_name == 'release'
shell: bash
run: |
echo "TRAVIS_TAG=${{github.event.release.tag_name}}" >> $GITHUB_ENV
- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCPACK_PACKAGE_FILE_NAME=${{env.RELEASE_FILE}} ${{matrix.cmake-args}}
- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
ccache --zero-stats || true
cmake --build . --config $BUILD_TYPE -j 2
ccache --show-stats || true