[FEATURE] Create unit test for rust code #860
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: Format sourcecode | |
on: | |
push: | |
paths: | |
- ".github/workflows/format.yml" | |
- "src/**.c" | |
- "src/**.h" | |
- "src/rust/**" | |
tags-ignore: # ignore push via new tag | |
- "*.*" | |
pull_request: | |
types: [opened, synchronize, reopened] | |
paths: | |
- ".github/workflows/format.yml" | |
- "src/**.c" | |
- "src/**.h" | |
- "src/rust/**" | |
jobs: | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Format code | |
run: | | |
find src/ -type f -not -path "src/thirdparty/*" -not -path "src/lib_ccx/zvbi/*" -name '*.c' -not -path "src/GUI/icon_data.c" | xargs clang-format -i | |
git diff-index --quiet HEAD -- || (git diff && exit 1) | |
format_rust: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./src/rust | |
steps: | |
- uses: actions/checkout@v4 | |
- name: cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
src/rust/.cargo/registry | |
src/rust/.cargo/git | |
src/rust/target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo- | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
components: rustfmt, clippy | |
- name: dependencies | |
run: sudo apt update && sudo apt install libtesseract-dev libavformat-dev libavdevice-dev libswscale-dev yasm | |
- name: rustfmt | |
run: cargo fmt --all -- --check | |
- name: clippy | |
run: | | |
cargo clippy --all-features -- -D warnings | |
unit_test_rust: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install dependencies | |
run: sudo apt update && sudo apt-get install libgpac-dev | |
- uses: actions/checkout@v4 | |
- name: cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
src/rust/.cargo/registry | |
src/rust/.cargo/git | |
src/rust/target | |
src/rust/lib_ccxr/target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo- | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Build and test main module | |
run: cargo test | |
working-directory: ./src/rust | |
- name: Build and test lib_ccxr | |
run: cargo test | |
working-directory: ./src/rust/lib_ccxr |