Skip to content

Commit

Permalink
Add basic build
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid committed Oct 13, 2021
1 parent 7e60532 commit fd31ee5
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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

0 comments on commit fd31ee5

Please sign in to comment.