Skip to content

Commit

Permalink
Add build and test to repo
Browse files Browse the repository at this point in the history
Signed-off-by: Coury Richards <[email protected]>
  • Loading branch information
couryrr-afs committed Dec 7, 2023
1 parent 1826478 commit 8e5038c
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 24 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" \
-DBUILD_TESTING_LIBOCPP=ON \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX="$WORKSPACE_PATH/dist"

make -j$(nproc) -C build install

cd ./build/tests/

./database_tests
./utils_tests
49 changes: 49 additions & 0 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build and test libocpp
on:
push:
branches:
- "**"
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: Install and test
strategy:
matrix:
os: [ubuntu-22.04]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout libocpp
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: Run install with tests
run: |
docker run \
--volume "$(pwd):/ext" \
--name test-container \
build-kit run-script install_and_test
21 changes: 0 additions & 21 deletions .github/workflows/lint.yaml

This file was deleted.

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
*build*
!.ci/**
!.github/**
!.gitignore
*vscode
.cache/
cache/
workspace.yaml
CMakeLists.txt.user
!doc/build-with-fetchcontent
5 changes: 3 additions & 2 deletions tests/database_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ ChargingProfile get_sample_charging_profile() {
class DatabaseTest : public ::testing::Test {
protected:
void SetUp() override {
this->db_handler = std::make_unique<DatabaseHandler>(CP_ID, std::filesystem::path("/tmp"),
std::filesystem::path("../../config/v16/init.sql"));
this->db_handler =
std::make_unique<DatabaseHandler>(CP_ID, std::filesystem::path("/tmp"),
std::filesystem::path("../../dist/share/everest/modules/OCPP/init.sql"));
this->db_handler->open_db_connection(2);
}

Expand Down

0 comments on commit 8e5038c

Please sign in to comment.