Implement Camera Handler #35
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unit and Integration Tests | |
on: | |
pull_request: | |
branches: ["development"] | |
push: | |
branches: ["development"] | |
workflow_dispatch: | |
concurrency: | |
group: "unit-tests" | |
cancel-in-progress: false | |
jobs: | |
build-tests: | |
runs-on: [self-hosted, linux, X64] | |
outputs: | |
check_unit: ${{ steps.check_unit.outputs.files_exists }} | |
check_integration: ${{ steps.check_integration.outputs.files_exists }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Fix Dubious Ownership | |
run: git config --global --add safe.directory /opt/Autonomy_Software | |
- name: Extract branch name | |
shell: bash | |
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | |
id: extract_branch | |
- name: Update Branch | |
run: | | |
cd /opt/Drone_Autonomy_Software/ | |
git fetch --force | |
branch=${{ steps.extract_branch.outputs.branch }} | |
echo $branch | |
git checkout $branch | |
git pull | |
- name: Build Tests | |
run: | | |
cd /opt/Drone_Autonomy_Software/ | |
if [ -d "build" ]; then rm -Rf build; fi | |
mkdir build | |
cd build | |
cmake .. | |
make | |
- name: Check File Existence (Unit Tests) | |
id: check_unit | |
uses: andstor/file-existence-action@v2 | |
with: | |
files: "/opt/Autonomy_Software/build/Autonomy_Software_UnitTests" | |
- name: Check File Existence (Integration Tests) | |
id: check_integration | |
uses: andstor/file-existence-action@v2 | |
with: | |
files: "/opt/Autonomy_Software/build/Autonomy_Software_IntegrationTests" | |
run-unit-tests: | |
needs: build-tests | |
runs-on: [self-hosted, linux, X64] | |
if: needs.build-tests.outputs.check_unit == 'true' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Fix Dubious Ownership | |
run: git config --global --add safe.directory /opt/Autonomy_Software | |
- name: Run Unit Tests | |
run: | | |
cd /opt/Drone_Autonomy_Software/build | |
if test -f "Drone_Autonomy_Software_UnitTests"; then ./Drone_Autonomy_Software_UnitTests ; else echo "No Unit Tests Exist" ; fi | |
run-integration-tests: | |
needs: build-tests | |
runs-on: [self-hosted, linux, X64] | |
if: needs.build-tests.outputs.check_integration == 'true' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Fix Dubious Ownership | |
run: git config --global --add safe.directory /opt/Autonomy_Software | |
- name: Run Integration Tests | |
run: | | |
cd /opt/Drone_Autonomy_Software/build | |
if test -f "Drone_Autonomy_Software_IntegrationTests"; then ./Drone_Autonomy_Software_IntegrationTests ; else echo "No Integration Tests Exist" ; fi |