diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 9d9f6a3..b4076d8 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -8,10 +8,11 @@ on: - main env: - CARGO_INCREMENTAL: 1 + CACHE_VERSION: 0 + + CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse CARGO_TERM_COLOR: always - GITHUB_CACHE_VERSION: 1 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} RUST_BACKTRACE: full @@ -24,33 +25,30 @@ jobs: matrix: action: [clippy, fmt, nextest] steps: + - name: Setup build environment + run: rustup toolchain install nightly --profile minimal - name: Fetch latest code uses: actions/checkout@v3 - - name: Cache cargo - uses: actions/cache@v3 + - uses: Swatinem/rust-cache@v2 with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: cargo-${{ env.GITHUB_CACHE_VERSION }}-${{ matrix.action }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: cargo-${{ env.GITHUB_CACHE_VERSION }}-${{ matrix.action }}- - - name: Cargo ${{ matrix.action }} + prefix-key: ${{ env.CACHE_VERSION }} + - name: Cargo clippy if: matrix.action == 'clippy' uses: actions-rs/clippy-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} args: --workspace --all-features --all-targets --locked - - name: Cargo ${{ matrix.action }} + - name: Cargo fmt if: matrix.action == 'fmt' - run: cargo ${{ matrix.action }} --all -- --check + run: cargo fmt --all -- --check - name: Install cargo-nextest if: matrix.action == 'nextest' uses: taiki-e/install-action@nextest - - name: Cargo ${{ matrix.action }} + - name: Cargo nextest if: matrix.action == 'nextest' - # Skip `node-test` feature. - run: cargo ${{ matrix.action }} run --release --workspace --all-targets --locked + # Ignore feature `node-test` + # run: cargo nextest run --cargo-profile ci-dev --workspace --all-features --all-targets --locked + run: cargo nextest run --cargo-profile ci-dev --workspace --all-targets --locked - name: Fast fail uses: vishnudxb/cancel-workflow@v1.2 if: failure() diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 04bcafb..3315860 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,6 @@ jobs: [ { name: x86_64-unknown-linux-gnu, os: ubuntu-latest }, { name: aarch64-apple-darwin, os: macos-latest }, - { name: x86_64-apple-darwin, os: macos-latest }, { name: x86_64-pc-windows-msvc, os: windows-latest, @@ -30,10 +29,10 @@ jobs: - name: Setup Rust toolchain run: rustup target add ${{ matrix.target.name }} - name: Build - run: cargo build --release --locked --target ${{ matrix.target.name }} + run: cargo build --profile ci-release --locked --target ${{ matrix.target.name }} - name: Compress run: | - mv target/${{ matrix.target.name }}/release/slothunter${{ matrix.target.extension }} . + mv target/${{ matrix.target.name }}/ci-release/slothunter${{ matrix.target.extension }} . zstd --ultra -22 -o slothunter-${{ matrix.target.name }}.zst slothunter${{ matrix.target.extension }} - name: Collect artifact run: | @@ -69,16 +68,16 @@ jobs: generate_release_notes: true files: artifacts/* - publish-on-crates-io: - name: Publish on crates.io - runs-on: ubuntu-latest - steps: - - name: Fetch latest code - uses: actions/checkout@v3 - - name: Login - run: cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }} - - name: Publish - run: cargo publish --locked + # publish-on-crates-io: + # name: Publish on crates.io + # runs-on: ubuntu-latest + # steps: + # - name: Fetch latest code + # uses: actions/checkout@v3 + # - name: Login + # run: cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }} + # - name: Publish + # run: .maintain/release.sh clean-artifacts: name: Clean artifacts diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 71e04a8..210fc1f 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -15,7 +15,6 @@ jobs: [ { name: x86_64-unknown-linux-gnu, os: ubuntu-latest }, { name: aarch64-apple-darwin, os: macos-latest }, - { name: x86_64-apple-darwin, os: macos-latest }, { name: x86_64-pc-windows-msvc, os: windows-latest, @@ -28,10 +27,10 @@ jobs: - name: Setup Rust toolchain run: rustup target add ${{ matrix.target.name }} - name: Build - run: cargo build --release --locked --target ${{ matrix.target.name }} + run: cargo build --profile ci-release --locked --target ${{ matrix.target.name }} - name: Compress run: | - mv target/${{ matrix.target.name }}/release/slothunter${{ matrix.target.extension }} . + mv target/${{ matrix.target.name }}/ci-release/slothunter${{ matrix.target.extension }} . zstd --ultra -22 -o slothunter-${{ matrix.target.name }}.zst slothunter${{ matrix.target.extension }} - name: Collect artifact run: | diff --git a/Cargo.toml b/Cargo.toml index 50c7d25..c035501 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,14 @@ readme = "README.md" repository = "https://github.com/hack-ink/slothunter" version = "0.1.5" +[profile.ci-dev] +incremental = false +inherits = "dev" + +[profile.ci-release] +inherits = "release" +lto = true + [features] node-test = [] diff --git a/README.md b/README.md index 4492288..b7e4674 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ For more details, please refer to [guide.md](test/guide.md).
![crab](pic/crab.png) -As shown in the picture, Slothunter promptly placed their bid immediately after other competitors. +*As shown in the picture, Slothunter promptly placed their bid immediately after other competitors.*