ds323x-rs/.github/workflows/build.yml

111 lines
2.7 KiB
YAML
Raw Normal View History

2021-01-30 19:22:32 +00:00
name: Build
2023-07-16 11:44:50 +00:00
on: [push, pull_request]
2021-01-30 19:22:32 +00:00
env:
RUSTFLAGS: '--deny warnings'
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
2023-07-16 11:44:50 +00:00
rust: [stable, 1.60.0]
2021-01-30 19:22:32 +00:00
TARGET:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- arm-unknown-linux-gnueabi # Raspberry Pi 1
- armv7-unknown-linux-gnueabihf # Raspberry Pi 2, 3, etc
# Bare metal
- thumbv6m-none-eabi
- thumbv7em-none-eabi
- thumbv7em-none-eabihf
- thumbv7m-none-eabi
steps:
2023-07-16 11:44:50 +00:00
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
2021-01-30 19:22:32 +00:00
with:
toolchain: ${{ matrix.rust }}
2023-07-16 11:44:50 +00:00
targets: ${{ matrix.TARGET }}
2021-01-30 19:22:32 +00:00
- name: Checkout CI scripts
2023-07-16 11:44:50 +00:00
uses: actions/checkout@v3
2021-01-30 19:22:32 +00:00
with:
repository: 'eldruin/rust-driver-ci-scripts'
ref: 'master'
path: 'ci'
- run: ./ci/patch-no-std.sh
if: ${{ ! contains(matrix.TARGET, 'x86_64') }}
2023-07-16 11:44:50 +00:00
- run: cargo build --target=${{ matrix.TARGET }}
2021-01-30 19:22:32 +00:00
checks:
name: Checks
runs-on: ubuntu-latest
steps:
2023-07-16 11:44:50 +00:00
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
2021-01-30 19:22:32 +00:00
with:
2023-07-16 11:44:50 +00:00
targets: x86_64-unknown-linux-gnu
2021-01-30 19:22:32 +00:00
components: rustfmt
2023-07-16 11:44:50 +00:00
- run: cargo doc
- run: cargo fmt --all -- --check
2021-01-30 19:22:32 +00:00
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
2023-07-16 11:44:50 +00:00
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
2021-01-30 19:22:32 +00:00
with:
2023-07-16 11:44:50 +00:00
toolchain: 1.70.0
targets: x86_64-unknown-linux-gnu
2021-01-30 19:22:32 +00:00
components: clippy
2023-07-16 11:44:50 +00:00
- run: cargo clippy --all-targets
2021-01-30 19:22:32 +00:00
test:
name: Tests
runs-on: ubuntu-latest
strategy:
matrix:
2023-07-16 11:44:50 +00:00
rust: [stable]
2021-01-30 19:22:32 +00:00
TARGET: [x86_64-unknown-linux-gnu, x86_64-unknown-linux-musl]
2022-02-20 09:55:37 +00:00
2021-01-30 19:22:32 +00:00
steps:
2023-07-16 11:44:50 +00:00
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
2021-01-30 19:22:32 +00:00
with:
toolchain: ${{ matrix.rust }}
2023-07-16 11:44:50 +00:00
targets: ${{ matrix.TARGET }}
2021-01-30 19:22:32 +00:00
- name: Test
2023-07-16 11:44:50 +00:00
run: cargo test --target=${{ matrix.TARGET }}
2021-01-30 19:22:32 +00:00
- name: Build examples
2023-07-16 11:44:50 +00:00
run: cargo build --target=${{ matrix.TARGET }} --examples
2021-01-30 19:22:32 +00:00
coverage:
name: Coverage
runs-on: ubuntu-latest
2023-07-16 11:44:50 +00:00
container:
image: xd009642/tarpaulin:latest
options: --security-opt seccomp=unconfined
2021-01-30 19:22:32 +00:00
steps:
2023-07-16 11:44:50 +00:00
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
2021-01-30 19:22:32 +00:00
- name: Run cargo-tarpaulin
2023-07-16 11:44:50 +00:00
run: cargo tarpaulin --out Lcov -- --test-threads 1
2021-01-30 19:22:32 +00:00
- name: upload to Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: './lcov.info'