Skip to content

Commit

Permalink
ci: Run tests in CI (#25)
Browse files Browse the repository at this point in the history
* .gitignore: Don't ignore CI paths

Signed-off-by: Christopher Davis <[email protected]>

* ci: Run tests in CI

This commit changes our CI configuration to run our tests when we receive a PR.
To keep consistency between libevse-security and other EVerest projects, we also
handle linting within `build_and_test.yaml`.

Signed-off-by: Christopher Davis <[email protected]>

---------

Signed-off-by: Christopher Davis <[email protected]>
  • Loading branch information
christopher-davis-afs authored Feb 7, 2024
1 parent 722d7e0 commit eaf20b9
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 23 deletions.
17 changes: 17 additions & 0 deletions .ci/build-kit/install_and_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

set -e

cmake \
-B build \
-S "$EXT_MOUNT/source" \
-G Ninja \
-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
57 changes: 57 additions & 0 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build and test libevse-security
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 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 libevse-security
runs-on: ${{ inputs.runner || 'ubuntu-22.04' }}
steps:
- name: Checkout libevse-security
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
21 changes: 0 additions & 21 deletions .github/workflows/lint.yaml

This file was deleted.

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.*
!.ci
!.github
!.gitignore
build
build
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# libevse-security

![Github Actions](https://github.com/EVerest/libevse-security/actions/workflows/build_and_test.yml/badge.svg)

This is a C++ library for security related operations for charging stations. It respects the requirements specified in OCPP and ISO15118 and can be used in combination with OCPP and ISO15118 implementations.

In the near future this library will also contain support for secure storage on TPM2.0.
Expand All @@ -24,7 +26,8 @@ make -j$(nproc) install

## Tests

GTest is required for building the test cases target. To build the target and run the tests use
GTest is required for building the test cases target.
To build the target and run the tests use:

```bash
mkdir build && cd build
Expand Down

0 comments on commit eaf20b9

Please sign in to comment.