Clean up github actions CI, test time feature

This commit is contained in:
Thom Chiovoloni 2020-10-04 12:52:52 -07:00
parent 9ac2a97568
commit 058023ebfe

View File

@ -13,19 +13,19 @@ env:
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
jobs: jobs:
test: test:
name: Test name: Test ${{ matrix.target }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
platform: include:
- { target: x86_64-pc-windows-msvc, os: windows-latest } - { target: x86_64-pc-windows-msvc, os: windows-latest }
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest } - { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
- { target: x86_64-apple-darwin, os: macos-latest } - { target: x86_64-apple-darwin, os: macos-latest }
- { target: x86_64-pc-windows-gnu, os: windows-latest, host: -x86_64-pc-windows-gnu } - { target: x86_64-pc-windows-gnu, os: windows-latest, host: -x86_64-pc-windows-gnu }
runs-on: ${{ matrix.platform.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -33,48 +33,26 @@ jobs:
# we use actions-rs/toolchain. # we use actions-rs/toolchain.
- uses: hecrj/setup-rust-action@v1 - uses: hecrj/setup-rust-action@v1
with: with:
rust-version: stable${{ matrix.platform.host }} rust-version: stable${{ matrix.host }}
targets: ${{ matrix.platform.target }} targets: ${{ matrix.target }}
- uses: actions-rs/cargo@v1 - run: cargo build --features bundled --workspace --all-targets --verbose
with: - run: cargo test --features bundled --workspace --all-targets --verbose
command: build - run: cargo test --features bundled --workspace --doc --verbose
args: --features bundled --workspace --all-targets
- uses: actions-rs/cargo@v1 - name: Test Features
with:
command: test
args: --features bundled --workspace --all-targets
- name: "cargo test --features 'bundled-full session buildtime_bindgen'"
# TODO: clang is installed on these -- but `bindgen` can't find it... # TODO: clang is installed on these -- but `bindgen` can't find it...
if: matrix.platform.os != 'windows-latest' if: matrix.os != 'windows-latest'
uses: actions-rs/cargo@v1 run: |
with: cargo test --features 'bundled-full session buildtime_bindgen time' --all-targets --workspace --verbose
command: test cargo test --features 'bundled-full session buildtime_bindgen time' --doc --workspace --verbose
args: --features 'bundled-full session buildtime_bindgen' --all-targets --workspace
- name: "cargo test --doc --features 'bundled-full session buildtime_bindgen'"
# TODO: clang is installed on these -- but `bindgen` can't find it...
if: matrix.platform.os != 'windows-latest'
uses: actions-rs/cargo@v1
with:
command: test
args: --features 'bundled-full session buildtime_bindgen' --doc --workspace
- name: "cargo test --features bundled-full"
uses: actions-rs/cargo@v1
with:
command: test
args: --features bundled-full --all-targets --workspace
- name: Static build - name: Static build
# Do we expect this to work / should we test with gnu toolchain? # Do we expect this to work / should we test with gnu toolchain?
if: matrix.platform.os == 'x86_64-pc-windows-msvc' if: matrix.os == 'x86_64-pc-windows-msvc'
shell: cmd env:
run: | RUSTFLAGS: -Ctarget-feature=+crt-static
set RUSTFLAGS=-Ctarget-feature=+crt-static run: cargo build --features bundled
cargo build --features bundled
sanitizer: sanitizer:
name: Address Sanitizer name: Address Sanitizer
@ -82,11 +60,9 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
# Need nightly rust. # Need nightly rust.
- uses: actions-rs/toolchain@v1 - uses: hecrj/setup-rust-action@v1
with: with:
profile: minimal rust-version: nightly
toolchain: nightly
override: true
components: rust-src components: rust-src
- name: Tests with asan - name: Tests with asan
env: env:
@ -98,32 +74,20 @@ jobs:
# leak sanitization, but we don't care about backtraces here, so long # leak sanitization, but we don't care about backtraces here, so long
# as the other tests have them. # as the other tests have them.
RUST_BACKTRACE: '0' RUST_BACKTRACE: '0'
run: cargo -Z build-std test --features 'bundled-full session buildtime_bindgen with-asan' --target x86_64-unknown-linux-gnu run: cargo -Z build-std test --features 'bundled-full session buildtime_bindgen time with-asan' --target x86_64-unknown-linux-gnu
# Ensure clippy doesn't complain. # Ensure clippy doesn't complain.
clippy: clippy:
name: Clippy name: Clippy
strategy:
fail-fast: false
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1 - uses: hecrj/setup-rust-action@v1
with: with:
profile: minimal components: clippy
toolchain: stable - run: cargo clippy --all-targets --workspace --features bundled -- -D warnings
override: true # Clippy with all non-conflicting features
- run: rustup component add clippy - run: cargo clippy --all-targets --workspace --features 'bundled-full session buildtime_bindgen time' -- -D warnings
- uses: actions-rs/cargo@v1
with:
command: clippy
# clippy with just bundled
args: --all-targets --workspace --features bundled -- -D warnings
- uses: actions-rs/cargo@v1
with:
command: clippy
# Clippy with all non-conflicting features
args: --all-targets --workspace --features 'bundled-full session buildtime_bindgen' -- -D warnings
# Ensure patch is formatted. # Ensure patch is formatted.
fmt: fmt:
@ -131,17 +95,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
# This has a matcher for rustfmt errors, so we use it even though
# elsewhere we use actions-rs/toolchain.
- uses: hecrj/setup-rust-action@v1 - uses: hecrj/setup-rust-action@v1
with: with:
rust-version: stable
components: rustfmt components: rustfmt
- run: rustup component add rustfmt - run: cargo fmt --all -- --check
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
# Detect cases where documentation links don't resolve and such. # Detect cases where documentation links don't resolve and such.
doc: doc:
@ -149,32 +106,24 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1 - uses: hecrj/setup-rust-action@v1
with: with:
profile: minimal rust-version: nightly
# Docs.rs uses nightly, which allows for easier syntax for linking to functions. # Need to use `cargo rustdoc` to actually get it to respect -D
toolchain: nightly # warnings... Note: this also requires nightly.
override: true - run: cargo rustdoc --features 'bundled-full session buildtime_bindgen time' -- -D warnings
- uses: actions-rs/cargo@v1
with:
# Need to use `cargo rustdoc` to actually get it to respect -D
# warnings... Note: this also requires nightly.
command: rustdoc
args: --features 'bundled-full session buildtime_bindgen' -- -D warnings
codecov: codecov:
name: Generate code coverage name: Generate code coverage
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1 - uses: hecrj/setup-rust-action@v1
with:
toolchain: stable
override: true
- name: Run cargo-tarpaulin - name: Run cargo-tarpaulin
uses: actions-rs/tarpaulin@v0.1 uses: actions-rs/tarpaulin@v0.1
with: with:
# Intentionally omit time feature until we're on time 0.3, at which
# point it should be added to `bundled-full`.
args: '--features "bundled-full session buildtime_bindgen"' args: '--features "bundled-full session buildtime_bindgen"'
- name: Upload to codecov.io - name: Upload to codecov.io