- Add tests to cmake run

- Share .dependencies cache with pr-size
pull/304/head
VintagePC 2023-09-17 18:15:07 -04:00
parent 1f66a8b908
commit fbb00f38d3
3 changed files with 73 additions and 1 deletions

View File

@ -56,3 +56,64 @@ jobs:
with:
name: Firmware
path: build/*.hex
tests:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
# setup base required dependencies
- name: Setup dependencies
run: |
sudo apt-get install gcc g++ cmake ninja-build python3-pyelftools python3-regex python3-polib
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout ${{ github.event.pull_request.head.ref }}
uses: actions/checkout@v3
if: ${{ github.event.pull_request }}
with:
ref: ${{ github.event.pull_request.head.sha }}
submodules: true
- name: Checkout ${{ github.event.ref }}
uses: actions/checkout@v3
if: ${{ !github.event.pull_request }}
with:
ref: ${{ github.event.ref }}
submodules: true
- name: Cache Dependencies
uses: actions/cache@v3.0.11
id: cache-pkgs
with:
path: ".dependencies"
key: "build-deps-1_0_0-linux"
- name: Setup build dependencies
run: |
./utils/bootstrap.py
- name: Cache permissions
run: sudo chmod -R 744 .dependencies
- name: Build
run: |
mkdir build
cd build
cmake .. -G Ninja
ninja test_coverage_report
- name: Add PR Comment
if: ${{ github.event.pull_request }}
uses: mshick/add-pr-comment@v2
with:
message-path: build/Summary.txt
- name: Upload artifacts
uses: actions/upload-artifact@v3.1.1
with:
name: Coverage
path: build/Coverage

View File

@ -24,10 +24,20 @@ jobs:
- name: Checkout base
uses: actions/checkout@v3
- name: Cache Dependencies
uses: actions/cache@v3.0.11
id: cache-pkgs
with:
path: ".dependencies"
key: "build-deps-1_0_0-linux"
- name: Setup build dependencies
run: |
./utils/bootstrap.py
- name: Cache permissions
run: sudo chmod -R 744 .dependencies
- name: Build base
run: |
rm -rf build-base

View File

@ -55,7 +55,8 @@ if(GCOV_ENABLE)
COMMAND tar -zcvf Coverage.tar.gz Coverage
# Cheat and compare a file to itself to check for existence. File-Not-Found is a failure
# code.
COMMAND ../../utils/gcovr.py -r . -e '../../tests' -e '../../lib/Catch2' | tee Summary.txt
COMMAND ${PROJECT_SOURCE_DIR}/utils/gcovr.py -r . -e '../../tests' -e '../../lib/Catch2' | tee
Summary.txt
COMMAND ${CMAKE_COMMAND} -E compare_files ${PROJECT_BINARY_DIR}/.ctest-finished
${PROJECT_BINARY_DIR}/.ctest-finished
BYPRODUCTS ${PROJECT_BINARY_DIR}/Summary.txt ${PROJECT_BINARY_DIR}/Coverage.tar.gz