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 5, 2023
1 parent 0daf48f commit 58b5e4d
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .ci/build-kit/compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

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
5 changes: 5 additions & 0 deletions .ci/build-kit/test_and_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh


ninja -j$(nproc) -C build install
ninja -j$(nproc) -C build test
53 changes: 53 additions & 0 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
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:
test:
name: Build and test libfsm
runs-on: ${{ inputs.runner || 'ubuntu-22.04' }}
steps:
- name: Checkout libfsm
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
- 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: Compile
run: |
docker run \
--volume "$(pwd):/ext" \
--name compile-container \
build-kit run-script compile
- name: Unit test and install
run: |
docker commit compile-container build-image
docker run \
--volume "$(pwd):/ext" \
--name test-container \
build-image run-script test_and_install

0 comments on commit 58b5e4d

Please sign in to comment.