name: Build and run unit tests
on:
push:
branches:
- '**'
tags:
- v*
jobs:
build-and-test:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: update apt cache
run: sudo apt update
- name: install needed linux libraries
run: sudo apt-get install -y libdbus-1-dev libudev-dev
- name: Formatting check
run: cargo fmt -- --check
- name: Generate Cargo.lock
uses: actions-rs/cargo@v1
with:
command: generate-lockfile
args: --manifest-path Cargo.toml
- name: Cache cargo registry and index
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
# target/
key: cargo-${{ hashFiles('Cargo.lock') }}
- name: test orouter-serial
run: cargo test
- name: test without std
run: cargo build --no-default-features --features=defmt-impl
notify_failure:
needs: [build-and-test]
if: ${{ failure() }}
runs-on: ubuntu-latest
steps:
- name: Notify telegram if job failed
uses: Lukasss93/telegram-action@v2
env:
TELEGRAM_TOKEN: ${{ secrets.BC_DEV_BOT_TOKEN }}
TELEGRAM_CHAT: ${{ secrets.BC_CORE_CHAT_ID }}
with:
release_template: ./.github/workflows/release_failure_templates.mustache
status: 'failure'