Skip to content

Commit

Permalink
Adding simple lint, build and test ci workflows
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Lukas <sebastian.lukas@pionix.de>
  • Loading branch information
SebaLukas committed Jun 13, 2024
1 parent c07c0dd commit caee335
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .ci/build-kit/build_and_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

set -e

cmake \
-B build \
-S "$EXT_MOUNT/source" \
-G Ninja \
-DCB_V2G_BUILD_TESTS=ON \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON

ninja -j$(nproc) -C build

trap "cp build/Testing/Temporary/LastTest.log /ext/ctest-report" EXIT

ninja -j$(nproc) -C build test
56 changes: 56 additions & 0 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build and test libcbv2g
on:
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'
jobs:
lint:
name: Lint
runs-on: ${{ inputs.runner || 'ubuntu-22.04' }}
steps:
- name: Checkout libcbv2g
uses: actions/checkout@v3
with:
path: source
- name: Run clang-format
uses: everest/everest-ci/github-actions/run-clang-format@v1.1.0
with:
source-dir: source
extensions: hpp,cpp
exclude: cache
build_and_test:
name: Build and test
runs-on: ${{ inputs.runner || 'ubuntu-22.04' }}
steps:
- name: Checkout libcbv2g
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: Build and test
run: |
docker run \
--volume "$(pwd):/ext" \
--name test-container \
build-kit run-script build_and_test
- name: Archive test results
if: always()
uses: actions/upload-artifact@v3
with:
name: ctest-report
path: ${{ github.workspace }}/ctest-report

0 comments on commit caee335

Please sign in to comment.