diff --git a/.github/actions/compile/action.yml b/.github/actions/compile/action.yml index ff7c41cd70..07ae5ea1c0 100644 --- a/.github/actions/compile/action.yml +++ b/.github/actions/compile/action.yml @@ -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 diff --git a/.github/workflows/compile_and_run_tests.yml b/.github/workflows/compile_and_run_tests.yml new file mode 100644 index 0000000000..d4a0d02f93 --- /dev/null +++ b/.github/workflows/compile_and_run_tests.yml @@ -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/