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

Split list unit tests v2 #630

Closed
wants to merge 3 commits into from
Closed
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
101 changes: 65 additions & 36 deletions .github/workflows/lint_build_unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,73 @@ on:
pull_request:

jobs:
lint_and_unit_test:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
submodules: 'recursive'
# Fetch depth must be greater than the number of commits included in the push in order to
# compare against commit prior to merge. 15 is chosen as a reasonable default for the upper
# bound of commits in a single PR.
fetch-depth: 15
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.x
architecture: 'x64'
- name: Install clang-format
shell: bash
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17
sudo apt install clang-format-17
- name: Check code formatting
shell: bash
run: |
git fetch --no-recurse-submodules
if [[ $GITHUB_EVENT_NAME == 'push' ]]; then
BASE=${{ github.event.before }}
else
BASE=origin/$GITHUB_BASE_REF
fi
git clang-format-17 --verbose --extensions c,h --diff --diffstat $BASE
- name: Run unit tests
shell: bash
run: |
cd tests/unit_tests
./test.sh
- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
# Fetch depth must be greater than the number of commits included in the push in order to
# compare against commit prior to merge. 15 is chosen as a reasonable default for the upper
# bound of commits in a single PR.
fetch-depth: 15

- name: Install clang-format
shell: bash
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17
sudo apt install clang-format-17

- name: Check code formatting
shell: bash
run: |
git fetch --no-recurse-submodules
if [[ $GITHUB_EVENT_NAME == 'push' ]]; then
BASE=${{ github.event.before }}
else
BASE=origin/$GITHUB_BASE_REF
fi
git clang-format-17 --verbose --extensions c,h --diff --diffstat $BASE

unit_tests:
runs-on: ubuntu-latest

steps:
- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Install gcovr and ninja
run: |
pip install gcovr ninja

- name: Run unit tests
run: |
ctest --build-and-test tests/unit_tests build \
--build-generator Ninja \
--test-command \
ctest \
--output-on-failure \
--timeout 2

- name: Coverage
run: |
gcovr \
--gcov-ignore-parse-errors=negative_hits.warn_once_per_file \
--merge-mode-functions=separate \
--json coverage.json \
build

- name: Upload test coverage artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: unit-test-coverage
path: coverage.json

linux_build:
runs-on: ubuntu-latest
Expand Down
Loading