Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add xtask crate and use in CI #635

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[alias]
xtask = "run --manifest-path ./xtask/Cargo.toml --"
107 changes: 30 additions & 77 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,98 +17,63 @@ jobs:
os: "macOS-latest"
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install rust channel
run: |
rustup install ${{matrix.rust_channel}}
rustup default ${{matrix.rust_channel}}
- name: Test debug
run: |
cargo test --verbose --features all
cargo test --verbose --features unstable-all
- name: Test release
run: cargo test --verbose --features all --release
- uses: actions/checkout@v4
with:
submodules: true
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust_channel}}
- run: cargo xtask check
- run: cargo xtask test

features:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- run: cargo test --no-default-features --features read
- run: cargo test --no-default-features --features write
- run: cargo test --no-default-features --features read_core,write_core,coff
- run: cargo test --no-default-features --features read_core,write_core,elf
- run: cargo test --no-default-features --features read_core,write_core,macho
- run: cargo test --no-default-features --features read_core,write_core,pe
- run: cargo test --no-default-features --features read_core,wasm
- run: cargo test --no-default-features --features read_core,xcoff
- run: cargo test --no-default-features --features std
- run: cargo test --no-default-features --features compression
- run: cargo test --no-default-features --features unaligned
- run: cargo test --no-default-features --features doc
- uses: dtolnay/rust-toolchain@stable
- run: cargo xtask features

cross:
strategy:
matrix:
target:
# A 32-bit target.
- "i686-unknown-linux-gnu"
# A big-endian target
- "powerpc64-unknown-linux-gnu"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install rust
run: |
rustup install stable
rustup default stable
- run: cargo install cross
- run: rustup target add ${{matrix.target}}
- run: cross test --target ${{matrix.target}} --features all
- uses: dtolnay/rust-toolchain@stable
with:
targets: i686-unknown-linux-gnu, powerpc64-unknown-linux-gnu
- uses: taiki-e/install-action@v2
with:
tool: cross
- run: cargo xtask cross

msrv-read:
msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install rust
run: rustup update 1.60.0 && rustup default 1.60.0
- name: MSRV dependencies
run: |
cargo update -p memchr --precise 2.6.2
- name: Test
run: cargo test -p object --verbose --no-default-features --features read,std
- uses: dtolnay/rust-toolchain@1.60.0
- uses: dtolnay/rust-toolchain@1.65.0
- run: cargo xtask msrv

msrv-all:
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
submodules: true
- name: Install rust
run: rustup update 1.65.0 && rustup default 1.65.0
- name: MSRV dependencies
run: |
cargo update -p ahash --precise 0.8.6
- name: Test
run: cargo test -p object --verbose --features all
components: rustfmt
- run: cargo xtask fmt

rustfmt:
doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install rust
run: |
rustup install stable
rustup default stable
rustup component add rustfmt
- run: cargo fmt --all -- --check
- uses: dtolnay/rust-toolchain@stable
- run: cargo xtask doc

coverage:
runs-on: ubuntu-latest
Expand All @@ -119,22 +84,10 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install rust
run: |
rustup install stable
rustup default stable
- name: Run cargo-tarpaulin
run: cargo tarpaulin --features all --ignore-tests --out Lcov
- uses: dtolnay/rust-toolchain@stable
- run: cargo xtask coverage_lcov
- name: Upload to Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: './lcov.info'

doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo rustdoc --no-default-features --features doc
env:
RUSTDOCFLAGS: "-D warnings"
8 changes: 8 additions & 0 deletions xtask/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "xtask"
version = "0.0.0"
edition = "2021"

[dependencies]

[workspace]