- Make size share cache

- Add tests step
- Add lang-check step
This commit is contained in:
VintagePC 2023-09-20 19:05:46 -04:00
parent 8c9b754b3f
commit 5ddac5cb6c
3 changed files with 129 additions and 2 deletions

View File

@ -1,8 +1,11 @@
name: ci-build name: ci-build
on: on:
- push pull_request:
- pull_request branches:
- '*'
push:
branches: [ MK3, MK3_* ]
jobs: jobs:
build: build:
@ -56,3 +59,93 @@ jobs:
with: with:
name: Firmware name: Firmware
path: build/*.hex path: build/*.hex
check-lang:
runs-on: ubuntu-latest
steps:
# setup base required dependencies
- name: Setup dependencies
run: |
sudo apt-get install gcc-11 g++11 lcov 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: Run check
run: |
mkdir build
cd build
cmake .. -G Ninja
ninja check_lang
tests:
runs-on: ubuntu-latest
steps:
# setup base required dependencies
- name: Setup dependencies
run: |
sudo apt-get install gcc-11 g++11 lcov 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: Run check
run: |
mkdir build
cd build
cmake .. -G Ninja
ninja test_run_all

View File

@ -24,10 +24,20 @@ jobs:
- name: Checkout base - name: Checkout base
uses: actions/checkout@v3 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 - name: Setup build dependencies
run: | run: |
./utils/bootstrap.py ./utils/bootstrap.py
- name: Cache permissions
run: sudo chmod -R 744 .dependencies
- name: Build base - name: Build base
run: | run: |
rm -rf build-base rm -rf build-base

View File

@ -16,3 +16,27 @@ add_executable(tests ${TEST_SOURCES})
target_include_directories(tests PRIVATE tests) target_include_directories(tests PRIVATE tests)
target_link_libraries(tests Catch2::Catch2WithMain) target_link_libraries(tests Catch2::Catch2WithMain)
catch_discover_tests(tests) catch_discover_tests(tests)
set(ctest_test_args --output-on-failure)
include(ProcessorCount)
ProcessorCount(N)
if(N EQUAL 0)
message(
WARNING "CTest: There was an issue reading the core count, tests won't be run in parallel"
)
else()
message(STATUS "CTest: Detected ${N} CPU threads")
set(ctest_test_args -j${N} ${ctest_test_args})
endif()
# This step needs to always return OK but log whether it was successful or not. The thought here
# is that if the tests all pass, .ctest-finished is created and we can check for its existance
# after generating the report to determine if the overall build result is a pass or fail.
add_custom_target(
test_run_all
COMMAND ${CMAKE_CTEST_COMMAND} ${ctest_test_args}
COMMAND ${CMAKE_COMMAND} -E touch .ctest-finished || exit 0
BYPRODUCTS ${PROJECT_BINARY_DIR}/.ctest-finished
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
)