Skip to content

Commit

Permalink
feat: add workflow to build agent on changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jr0me committed Aug 13, 2024
1 parent 5fa3e5b commit 094b2d7
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 9 deletions.
31 changes: 22 additions & 9 deletions .github/actions/compile/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,29 @@ inputs:
runs:
using: "composite"
steps:
- name: Compile
- name: Generate CMake project
run: |
SRC_FOLDER=$(pwd)/src
VERSION=$(cat src/VERSION)
echo $VERSION
REVISION=$(cat src/REVISION)
echo $REVISION
SRC_FOLDER=$(pwd)/${{ inputs.path }}
cd ${{ inputs.path }}
mkdir -p build && cd build
cmake -DSRC_FOLDER=${SRC_FOLDER} -DVERSION="$VERSION" -DREVISION="$REVISION" .. && make -j2
cmake ${SRC_FOLDER} -DBUILD_TESTS=1 -G "Unix Makefiles"
echo "CMake project generated in $(pwd)"
shell: bash

- name: Compile
run: |
cd build
if [ ! -f CMakeCache.txt ]; then
echo "CMake cache not found in $(pwd). Aborting."
exit 1
fi
cmake --build .
shell: bash

- name: Run Tests
continue-on-error: true
run: |
set +e
cd build
ctest || echo "Tests failed, but continuing"
shell: bash
27 changes: 27 additions & 0 deletions .github/workflows/compile_and_run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Compile and Run Tests

on:
push:
branches:
- '**'
pull_request:
types:
- opened
- synchronize
- reopened

jobs:
compile:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0

- name: Run Compile Action
uses: ./.github/actions/compile
with:
path: src/

0 comments on commit 094b2d7

Please sign in to comment.