Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add linux bare build action #77

Merged
merged 6 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions .github/workflows/build-on-change-linux-bare.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Build framework on Linux Bare

on:
# execute on every PR made targeting the branches bellow
pull_request:
branches:
- master
- develop # can be removed on master merge
paths: # we only include paths critical for building to avoid unnecessary runs
- src/**
- include/**
- scripts/cmake/**
- test/**
- .github/workflows/**
- doc/**
- runtime/**
- docker/**

# execute on every push made targeting the branches bellow
push:
branches:
- master
- develop # can be removed on master merge
paths: # we only include paths critical for building to avoid unnecessary runs
- src/**
- include/**
- scripts/cmake/**
- test/**
- .github/workflows/**
- doc/**
- runtime/**
- docker/**

jobs:
build-linux:
runs-on: ubuntu-22.04
env:
TEST_ENABLED: ${{ github.event_name == 'pull_request' && 'ON' || 'OFF' }}
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Create dependencies build space
run: mkdir dependencies
shell: bash

- name: Install dependencies
working-directory: dependencies
run: |
echo "Installing Dependencies..."
sudo apt update
sudo apt install \
g++ \
g++-10 \
make \
build-essential \
cmake \
libgtest-dev \
qtbase5-dev \
libqt5xmlpatterns5-dev \
libxerces-c-dev \
pkg-config
echo "Dependencies installed."
shell: bash

- name: Build framework
# Currently this is building without the XSD file. If we want to expose
# the build artifact after, we might as well need to add the XSD file.
run: |
echo Building framework...
cmake -G "Unix Makefiles" -B./build -S . \
-DCMAKE_INSTALL_PREFIX="/home/$(whoami)/qc-build" \
-DENABLE_FUNCTIONAL_TESTS=$TEST_ENABLED -DXERCES_ROOT="/usr" \
-DQt5_DIR="/usr/lib/x86_64-linux-gnu/cmake/Qt5/" \
-DQt5XmlPatterns_DIR="/usr/lib/x86_64-linux-gnu/cmake/Qt5XmlPatterns/"
cmake --build ./build --target install --config Release -j4
cmake --install ./build
echo Done.
shell: bash

- name: Unit test execution
if: github.event_name == 'pull_request'
run: |
echo Starting tests...

ctest --test-dir build -C Release

echo All tests done.
shell: bash

- name: Archive test results
if: github.event_name == 'pull_request' && (success() || failure())
uses: actions/upload-artifact@v4
with:
name: unit-test-report
path: ${{ github.workspace }}/build/Testing/Temporary/LastTest.log

- name: Runtime test execution
if: github.event_name == 'pull_request'
run: |
mv build out_build
cp -r /home/$(whoami)/qc-build build
cp out_build/examples/checker_bundle_example/DemoCheckerBundle build/bin/
cd runtime
python3 -m pip install -r requirements.txt
python3 -m pytest -rA > runtime_test.log

- name: Archive runtime test results
if: github.event_name == 'pull_request' && (success() || failure())
uses: actions/upload-artifact@v4
with:
name: runtime-test-report
path: ${{ github.workspace }}/runtime/runtime_test.log
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build framework on Linux
name: Build framework on Linux Docker

on:
# execute on every PR made targeting the branches bellow
Expand All @@ -10,7 +10,7 @@ on:
- src/**
- include/**
- scripts/cmake/**
- tests/**
- test/**
- .github/workflows/**
- doc/**
- runtime/**
Expand All @@ -25,6 +25,7 @@ on:
- src/**
- include/**
- scripts/cmake/**
- test/**
- .github/workflows/**
- doc/**
- runtime/**
Expand All @@ -39,9 +40,9 @@ jobs:

- name: Docker Build
run: |
docker build -f docker/Dockerfile.linux --target unit_test -t unit_test .
docker build -f docker/Dockerfile.linux --target runtime_test -t runtime_test .
docker build -f docker/Dockerfile.linux --target unit_test -t unit_test .
docker build -f docker/Dockerfile.linux --target runtime_test -t runtime_test .

- name: Unit test execution
if: github.event_name == 'pull_request'
run: |
Expand All @@ -53,16 +54,15 @@ jobs:
with:
name: unit-test-report
path: ${{ github.workspace }}/LastTest.log

- name: Runtime test execution
if: github.event_name == 'pull_request'
run: |
docker run -v ${{ github.workspace }}:/out --rm --name runtime_test runtime_test

- name: Archive runtime test results
if: github.event_name == 'pull_request' && (success() || failure())
uses: actions/upload-artifact@v4
with:
name: runtime-test-report
path: ${{ github.workspace }}/runtime_test.log

8 changes: 3 additions & 5 deletions .github/workflows/build-on-change-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ on:
- src/**
- include/**
- scripts/cmake/**
- test/**
- .github/workflows/**
- doc/**
- runtime/**
Expand Down Expand Up @@ -124,7 +125,7 @@ jobs:

Write-Output "All unit tests done."
shell: pwsh

- name: Archive test results
if: github.event_name == 'pull_request' && (success() || failure())
uses: actions/upload-artifact@v4
Expand All @@ -140,13 +141,10 @@ jobs:
Rename-Item -path "$env:WORKING_PATH\qc-framework\qc-framework\build" -NewName "$env:WORKING_PATH\qc-framework\qc-framework\out_build"
Copy-Item -Path "$env:WORKING_PATH\QC-Framework-Out" -Destination "$env:WORKING_PATH\qc-framework\qc-framework\build" -Recurse
Copy-Item -Path "$env:WORKING_PATH\qc-framework\qc-framework\out_build\examples\checker_bundle_example\Release\DemoCheckerBundle.exe" -Destination "$env:WORKING_PATH\qc-framework\qc-framework\build\bin"

cd "$env:WORKING_PATH\qc-framework\qc-framework\runtime"
python3 -m pip install -r requirements.txt
python3 -m pytest

Write-Output "All runtime tests done."
shell: pwsh



Loading