name: Testing
on:
push:
branches:
- main
- develop
pull_request:
types:
- opened
- reopened
- synchronize
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: "${{ !contains(github.ref, 'main')}}"
jobs:
lintje:
name: "Lintje (Git Linter)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 100
- uses: lintje/action@main
rust_lint:
name: Rust lint and format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/cache@v6
with:
key: cargo-lint-${{ hashFiles('**/Cargo.lock') }}
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
- name: "Install rustfmt and clippy"
run: "rustup component add rustfmt clippy"
- name: Rust format
run: cargo fmt --all -- --check
- name: Rust clippy
run: cargo clippy
build_and_test:
name: Tests
runs-on: ubuntu-latest
env:
TERM: xterm-256color
steps:
- name: Configure Git
run: |
git config --global user.email "test@test.com"
git config --global user.name "My Test user"
- uses: actions/checkout@v7
- uses: actions/cache@v6
with:
key: cargo-test-${{ hashFiles('**/Cargo.lock') }}
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
- name: Cargo test
run: cargo test -- --show-output
run:
name: Test run the project
runs-on: ubuntu-latest
env:
TERM: xterm-256color
steps:
- uses: actions/checkout@v7
with:
Fetch-depth: 2 - uses: actions/cache@v6
with:
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
- name: Cargo run
run: cargo run
cross_compile:
name: "Cross compile"
uses: ./.github/workflows/build_release.yaml
with:
branch: "${{ github.head_ref || github.ref_name }}"
upload_artifacts: false
run_versioning: false