feat: add unit testing and standardize to org #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: CI | |
on: | |
pull_request: | |
branches: | |
- master | |
types: | |
- opened | |
- synchronize | |
- reopened | |
push: | |
branches: | |
- master | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build_win: | |
name: Windows | |
runs-on: windows-2019 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Dependencies Windows | |
uses: msys2/setup-msys2@v2 | |
with: | |
update: true | |
install: >- | |
base-devel | |
make | |
mingw-w64-x86_64-binutils | |
mingw-w64-x86_64-cmake | |
mingw-w64-x86_64-toolchain | |
- name: Setup python | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Python Path | |
id: python-path | |
shell: msys2 {0} | |
run: | | |
# replace backslashes with double backslashes | |
python_path=$(echo "${{ steps.setup-python.outputs.python-path }}" | sed 's/\\/\\\\/g') | |
# step output | |
echo "python-path=${python_path}" | |
echo "python-path=${python_path}" >> $GITHUB_OUTPUT | |
- name: Build Windows | |
shell: msys2 {0} | |
run: | | |
mkdir build | |
cd build | |
cmake \ | |
-G "MinGW Makefiles" \ | |
.. | |
mingw32-make -j$(nproc) | |
- name: Run tests | |
id: test | |
shell: msys2 {0} | |
working-directory: build/tests | |
run: | | |
./test_tray.exe --gtest_color=yes | |
- name: Generate gcov report | |
# any except canceled or skipped | |
if: always() && (steps.test.outcome == 'success' || steps.test.outcome == 'failure') | |
id: test_report | |
shell: msys2 {0} | |
working-directory: build | |
run: | | |
${{ steps.python-path.outputs.python-path }} -m pip install gcovr | |
${{ steps.python-path.outputs.python-path }} -m gcovr -r .. \ | |
--exclude ../tests/ \ | |
--exclude ../third-party/ \ | |
--xml-pretty \ | |
-o coverage.xml | |
- name: Upload coverage | |
# any except canceled or skipped | |
if: always() && (steps.test_report.outcome == 'success') | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: true | |
files: ./build/coverage.xml | |
flags: ${{ runner.os }} | |
token: ${{ secrets.CODECOV_TOKEN }} |