Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Improve CI #41

Merged
merged 4 commits into from
Jul 14, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 14 additions & 16 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down
25 changes: 12 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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: |
Expand Down Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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: |
Expand Down
8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ For more details, please refer to [guide.md](test/guide.md).
<div align="center">

![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.*

</div>