- Make size share cache
- Add tests step - Add lang-check step
This commit is contained in:
parent
8c9b754b3f
commit
5ddac5cb6c
|
|
@ -1,8 +1,11 @@
|
|||
name: ci-build
|
||||
|
||||
on:
|
||||
- push
|
||||
- pull_request
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
push:
|
||||
branches: [ MK3, MK3_* ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
|
@ -56,3 +59,93 @@ jobs:
|
|||
with:
|
||||
name: Firmware
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -16,3 +16,27 @@ add_executable(tests ${TEST_SOURCES})
|
|||
target_include_directories(tests PRIVATE tests)
|
||||
target_link_libraries(tests Catch2::Catch2WithMain)
|
||||
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}"
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue