Skip to content

Commit

Permalink
chore: default-features, dev-mode, feature-fun (#308)
Browse files Browse the repository at this point in the history
# Description

Attempt(s) to clean-up and speed-up compile times (CI + local)
  • Loading branch information
Zeeshan Lakhani authored Sep 15, 2023
1 parent 1fad8c4 commit 48a790e
Show file tree
Hide file tree
Showing 17 changed files with 513 additions and 1,151 deletions.
31 changes: 22 additions & 9 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: short
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"

jobs:
coverage:
runs-on: ubuntu-latest
Expand All @@ -28,6 +34,10 @@ jobs:
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
save-if: ${{ github.event_name == 'push' }}

- name: Sccache
uses: mozilla-actions/sccache-action@v0.0.3

- name: Use mold-linker
uses: rui314/setup-mold@v1
Expand All @@ -42,13 +52,16 @@ jobs:
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

- name: Generate Code Coverage
run: cargo llvm-cov --all-features --workspace --doctests --lcov --output-path lcov.info
# Temporary Disable https://github.com/time-rs/time/issues/618,
# which is an underlying dep

- name: Upload to codecov.io
uses: codecov/codecov-action@v3
continue-on-error: true
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
files: lcov.info
# - name: Generate Code Coverage
# run: cargo llvm-cov --all-features --workspace --doctests --lcov --output-path lcov.info

# - name: Upload to codecov.io
# uses: codecov/codecov-action@v3
# continue-on-error: true
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# fail_ci_if_error: false
# files: lcov.info
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 🐳 Docker

on:
schedule:
- cron: '0 */12 * * *'
- cron: '0 */4 * * *'

jobs:
build-docker:
Expand Down
93 changes: 77 additions & 16 deletions .github/workflows/tests_and_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,15 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: short

jobs:
run-checks:
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
strategy:
fail-fast: false
matrix:
Expand All @@ -21,6 +28,10 @@ jobs:
- stable
- nightly
- 1.70.0
include:
- os: windows-latest
rustflags: -C target-feature=+crt-static

runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
Expand All @@ -33,8 +44,13 @@ jobs:
with:
cache-on-failure: true
shared-key: check-${{ matrix.rust-toolchain }}-${{ matrix.os }}
save-if: ${{ github.event_name == 'push' }}

- name: Sccache
uses: mozilla-actions/sccache-action@v0.0.3

- name: Use mold-linker
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: rui314/setup-mold@v1

- name: Install Rust Toolchain
Expand All @@ -53,34 +69,58 @@ jobs:
- name: Run Linter
run: cargo clippy --all -- -D warnings

# Only "test" release build on push event.
- name: Test Release
if: ${{ matrix.rust-toolchain == 'stable' && github.event_name == 'push' }}
run: cargo build --workspace --release

run-deny:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Cache Project
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
shared-key: deny-stable-ubuntu-latest
save-if: ${{ github.event_name == 'push' }}

- name: Use mold-linker
uses: rui314/setup-mold@v1

- name: Install Rust Toolchain
uses: dtolnay/rust-toolchain@stable

# Check for security advisories
- name: Check Advisories
if: ${{ matrix.rust-toolchain == 'stable' && matrix.os == 'ubuntu-latest' }}
uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check advisories
continue-on-error: true

# Audit licenses, unreleased crates, and unexpected duplicate versions.
- name: Check Bans, Licenses, and Sources
if: ${{ matrix.rust-toolchain == 'stable' && matrix.os == 'ubuntu-latest' }}
uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check bans licenses sources

# Only "test" release build on push event.
- name: Test Release
if: ${{ matrix.rust-toolchain == 'stable' && github.event_name == 'push' }}
run: cargo build --release

run-tests-all-features:
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
rust-toolchain:
- stable
- nightly
include:
- os: windows-latest
rustflags: -C target-feature=+crt-static

runs-on: ${{ matrix.os }}
steps:
- name: Setup IPFS
Expand All @@ -96,8 +136,13 @@ jobs:
with:
cache-on-failure: true
shared-key: test-all-${{ matrix.rust-toolchain }}-${{ matrix.os }}
save-if: ${{ github.event_name == 'push' }}

- name: Sccache
uses: mozilla-actions/sccache-action@v0.0.3

- name: Use mold-linker
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: rui314/setup-mold@v1

- name: Install Rust Toolchain
Expand All @@ -113,19 +158,26 @@ jobs:
uses: taiki-e/install-action@nextest

- name: Run Tests
run: cargo nextest run --profile ci --all-features
run: cargo nextest run --workspace --profile ci --all-features

- name: Run Doc Tests
run: cargo test --doc
run: cargo test --doc --workspace

run-tests-no-default-features:
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
rust-toolchain:
- stable
- nightly
include:
- os: windows-latest
rustflags: -C target-feature=+crt-static

runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
Expand All @@ -136,8 +188,13 @@ jobs:
with:
cache-on-failure: true
shared-key: test-0-${{ matrix.rust-toolchain }}-${{ matrix.os }}
save-if: ${{ github.event_name == 'push' }}

- name: Sccache
uses: mozilla-actions/sccache-action@v0.0.3

- name: Use mold-linker
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: rui314/setup-mold@v1

- name: Install Rust Toolchain
Expand All @@ -153,13 +210,13 @@ jobs:
uses: taiki-e/install-action@nextest

- name: Run Tests
run: cargo nextest run --profile ci --no-default-features --features "test-utils"
run: cargo nextest run --workspace --profile ci --no-default-features --features "test-utils"

run-docs:
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- name: Checkout Repository
uses: actions/checkout@v4
Expand All @@ -168,6 +225,10 @@ jobs:
uses: Swatinem/rust-cache@v2
with:
shared-key: doc
save-if: ${{ github.event_name == 'push' }}

- name: Sccache
uses: mozilla-actions/sccache-action@v0.0.3

- name: Use mold-linker
uses: rui314/setup-mold@v1
Expand All @@ -178,4 +239,4 @@ jobs:
- name: Run Doc(s) compilation
env:
RUSTDOCFLAGS: -Dwarnings
run: cargo doc --document-private-items
run: cargo doc --workspace --document-private-items
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ homestar-wasm/out
**/fixtures/test_*
.zed
result-alejandra

report.json

# ipfs
.ipfs
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ repos:
entry: cargo fmt
language: system
types: [rust]
args: ["--", "--check"]
args: ["--all", "--", "--check"]
- id: cargo-check
name: cargo check
description: Check the package for errors.
entry: cargo check
entry: cargo check --workspace
language: system
types: [rust]
pass_filenames: false
Expand All @@ -32,7 +32,7 @@ repos:
description: Check docs for warnings.
entry: env RUSTDOCFLAGS=-Dwarnings cargo doc
language: system
args: ["--document-private-items"]
args: ["--workspace", "--document-private-items"]
types: [rust]
pass_filenames: false

Expand Down
Loading

0 comments on commit 48a790e

Please sign in to comment.