Skip to content

Allow self in non-unit struct and enum top-level assert #479

Allow self in non-unit struct and enum top-level assert

Allow self in non-unit struct and enum top-level assert #479

Workflow file for this run

name: Rust Build and Test
on:
pull_request:
push:
branches:
- master
env:
CARGO_TERM_COLOR: always
jobs:
lint:
name: Lint ${{ matrix.features.name }}
runs-on: ubuntu-latest
strategy:
matrix:
features:
- name: all features
value: --all-features --manifest-path binrw/Cargo.toml
check_formatting: True
- name: no_std
value: --no-default-features --manifest-path binrw/Cargo.toml
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy, rustfmt
- name: Check formatting
# There is no reason to check formatting more than once since it is
# a syntax check that does not change depending upon compiler features
if: matrix.features.check_formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets ${{ matrix.features.value }} -- -D warnings
- name: Build documentation
uses: actions-rs/cargo@v1
with:
command: rustdoc
args: ${{ matrix.features.value }} -- -D warnings
test:
name: Test ${{ matrix.features.name }} on Rust ${{ matrix.rust }}
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- nightly
features:
- name: all features
value: --all-features
- name: no_std
value: --no-default-features --manifest-path binrw/Cargo.toml
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- name: Build workspace
uses: actions-rs/cargo@v1
with:
command: build
args: ${{ matrix.features.value }}
# Testing is separated just to more clearly differentiate in the CI
# whether the build failed or a test failed
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: ${{ matrix.features.value }}
coverage:
name: Code coverage
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: 1
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: llvm-tools-preview
- name: Install llvm-cov
uses: taiki-e/install-action@v1
with:
tool: cargo-llvm-cov
- name: Generate default features
run: >
cargo llvm-cov --doctests
--no-report
- name: Generate all features
run: >
cargo llvm-cov --doctests --all-features
--no-report
- name: Generate no features
run: >
cargo llvm-cov --doctests --no-default-features
--no-report
- name: Show coverage results
run: >
cargo llvm-cov --doctests
--ignore-filename-regex 'binrw/(tests|src/docs)'
--no-run
# https://github.com/actions/runner/issues/520
- name: Determine whether codecov.io secret is available
id: has_codecov
run: echo 'result=${{ secrets.CODECOV_TOKEN }}' >> $GITHUB_OUTPUT
- name: Generate coverage file
run: >
cargo llvm-cov --doctests
--ignore-filename-regex 'binrw/(tests|src/docs)'
--no-run
--lcov --output-path lcov.info
if: steps.has_codecov.outputs.result != 0
- name: Upload to codecov.io
uses: codecov/codecov-action@v1
with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
if: steps.has_codecov.outputs.result != 0