Skip to content

Commit

Permalink
general: Add CI
Browse files Browse the repository at this point in the history
This commit adds a CI workflow that runs clang-format, builds the application and examples,
and runs our unit tests.

Signed-off-by: Christopher Davis <[email protected]>
  • Loading branch information
christopher-davis-afs committed Dec 19, 2023
1 parent e427550 commit 8822fa3
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .ci/build-kit/install_and_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

set -e

cmake \
-B build \
-G Ninja \
-S "$EXT_MOUNT/source" \
-DBUILD_EXAMPLES=ON \
-DBUILD_TESTING=ON \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX="$WORKSPACE_PATH/dist"

ninja -j$(nproc) -C build install

ninja -j$(nproc) -C build test

cp build/Testing/Temporary/LastTest.log /ext/ctest-report
66 changes: 66 additions & 0 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Build and test libfsm
on:
push: {}
pull_request: {}
workflow_dispatch:
inputs:
runner:
description: Which runner to use
type: choice
default: 'ubuntu-22.04'
required: true
options:
- 'ubuntu-22.04'
- 'large-ubuntu-22.04-xxl'
schedule:
- cron: '37 13,1 * * *'

jobs:
lint:
name: Lint
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout libevse-security
uses: actions/checkout@v3
with:
path: source
- name: Run clang-format
uses: everest/everest-ci/github-actions/[email protected]
with:
source-dir: source
extensions: hpp,cpp
exclude: cache
test:
name: Build and test libfsm
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout libfsm
uses: actions/checkout@v3
with:
path: source
- name: Setup run scripts
run: |
mkdir scripts
rsync -a source/.ci/build-kit/ scripts
- name: Pull docker container
run: |
docker pull --platform=linux/x86_64 --quiet ghcr.io/everest/build-kit-alpine:latest
docker image tag ghcr.io/everest/build-kit-alpine:latest build-kit
- name: Unit test and install
run: |
docker run \
--volume "$(pwd):/ext" \
--name test-container \
build-kit run-script install_and_test
- name: Archive test results
if: always()
uses: actions/upload-artifact@v3
with:
name: ctest-report
path: ${{ github.workspace }}/ctest-report
6 changes: 6 additions & 0 deletions readme.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
========
libfsm
========

|GitHub Actions|

--------------------------------------------------------------------
a tiny c++ library for writing maintainable finite state machines
--------------------------------------------------------------------
Expand All @@ -22,3 +25,6 @@ Todo
- improve documentation

- structure

.. |GitHub Actions| image:: https://github.com/EVerest/libevse-security/actions/workflows/build_and_test.yml/badge.svg
:target:

0 comments on commit 8822fa3

Please sign in to comment.