Skip to content

Use Zephyr GitHub action for CI (#41) #277

Use Zephyr GitHub action for CI (#41)

Use Zephyr GitHub action for CI (#41) #277

Workflow file for this run

name: Zephyr unit testing and docs build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: thingset-node-c
fetch-depth: 0 # necessary to get tags
- name: Setup Zephyr project
uses: zephyrproject-rtos/action-zephyr-setup@v1
with:
app-path: thingset-node-c
- name: Trailing whitespace check
working-directory: thingset-node-c
run: |
git diff --check `git rev-list HEAD | tail -n 1`..
- name: Install docs dependencies
working-directory: thingset-node-c
run: |
sudo apt-get update
sudo apt-get install -y doxygen lcov
pip3 install -r docs/requirements.txt
- name: Run unit tests
working-directory: thingset-node-c
run: |
../zephyr/scripts/twister --integration --testsuite-root ./tests --inline-logs
- name: Generate coverage report
working-directory: thingset-node-c
run: |
west build -b native_posix tests/protocol -t run
lcov --capture --directory build/modules/thingset-node-c --output-file build/lcov.info --rc lcov_branch_coverage=1 --exclude '*zephyr*' --exclude '*lib*'
genhtml build/lcov.info --output-directory build/lcov_html --ignore-errors source --branch-coverage --highlight --legend
- name: Build documentation
working-directory: thingset-node-c
run: |
cd docs
make html
cp -r ../build/lcov_html build/html/coverage
- name: Deploy docs and coverage report to gh-pages
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./thingset-node-c/docs/build/html/
enable_jekyll: false
allow_empty_commit: false
force_orphan: true
publish_branch: gh-pages