From 2f8f7539d788adc189dafbbbef31fb0784ec817e Mon Sep 17 00:00:00 2001 From: TCLL253 <168653957+TCLL253@users.noreply.github.com> Date: Fri, 19 Jul 2024 18:08:37 +0200 Subject: [PATCH] update tests --- .github/workflows/ci.yaml | 358 ++++++++++++++++++++++++++------------ 1 file changed, 249 insertions(+), 109 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index aa01570..c6c2745 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,11 +10,6 @@ jobs: - name: Checkout sources uses: actions/checkout@v4 - - name: Install protoc - uses: taiki-e/install-action@v2 - with: - tool: protoc - - name: Install toolchain id: rust-toolchain uses: dtolnay/rust-toolchain@stable @@ -26,22 +21,69 @@ jobs: method: 'network' sub-packages: '["nvcc", "cudart"]' - - name: Cache + - name: Cache cargo bin uses: actions/cache@v4 with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + path: ~/.cargo/bin/ + key: ${{ runner.os }}-cargo-bin-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-bin- - - name: Run cargo check - uses: actions-rs/cargo@v1 + - name: Cache cargo registry index + uses: actions/cache@v4 + with: + path: ~/.cargo/registry/index/ + key: ${{ runner.os }}-cargo-registry-index-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry-index- + + - name: Cache cargo registry cache + uses: actions/cache@v4 + with: + path: ~/.cargo/registry/cache/ + key: ${{ runner.os }}-cargo-registry-cache-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry-cache- + + - name: Cache cargo git db + uses: actions/cache@v4 + with: + path: ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-git-db-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-git-db- + + - name: Cache cargo registry + uses: actions/cache@v4 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry- + + - name: Cache cargo git + uses: actions/cache@v4 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-git- + + - name: Cache build + uses: actions/cache@v4 with: - command: check - args: --tests + path: target + key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-target- + + - name: Install protoc + uses: taiki-e/install-action@v2 + with: + tool: protoc + + - name: Run cargo check + run: cargo check --tests test: name: Test Suite @@ -58,11 +100,6 @@ jobs: if: runner.os == 'Windows' run: git config --global core.autocrlf false - - name: Install protoc - uses: taiki-e/install-action@v2 - with: - tool: protoc - - name: Install toolchain id: rust-toolchain uses: dtolnay/rust-toolchain@stable @@ -83,41 +120,78 @@ jobs: method: 'network' sub-packages: '["nvcc", "cudart"]' - - name: Cache + - name: Cache cargo bin uses: actions/cache@v4 with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + path: ~/.cargo/bin/ + key: ${{ runner.os }}-cargo-bin-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-bin- - - name: Run cargo test regular features - uses: actions-rs/cargo@v1 + - name: Cache cargo registry index + uses: actions/cache@v4 with: - command: test - args: -p karlsen-miner + path: ~/.cargo/registry/index/ + key: ${{ runner.os }}-cargo-registry-index-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry-index- - - name: Run cargo test no asm - uses: actions-rs/cargo@v1 + - name: Cache cargo registry cache + uses: actions/cache@v4 with: - command: test - args: -p karlsen-miner --features=no-asm + path: ~/.cargo/registry/cache/ + key: ${{ runner.os }}-cargo-registry-cache-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry-cache- + - name: Cache cargo git db + uses: actions/cache@v4 + with: + path: ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-git-db-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-git-db- - - name: Run cargo test no parking_lot - uses: actions-rs/cargo@v1 + - name: Cache cargo registry + uses: actions/cache@v4 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry- + + - name: Cache cargo git + uses: actions/cache@v4 with: - command: test - args: -p karlsen-miner --no-default-features + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-git- - - name: Run cargo test shuttle - uses: actions-rs/cargo@v1 + - name: Cache build + uses: actions/cache@v4 + with: + path: target + key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-target- + + - name: Install protoc + uses: taiki-e/install-action@v2 with: - command: test - args: -p karlsen-miner --no-default-features --features=shuttle + tool: protoc + + - name: Run cargo test regular features + run: cargo test -p karlsen-miner + + - name: Run cargo test no asm + run: cargo test -p karlsen-miner --features=no-asm + + - name: Run cargo test with parking_lot + run: cargo test -p karlsen-miner --features=parking_lot + + - name: Run cargo test shuttle + run: cargo test -p karlsen-miner --features=shuttle test-release: @@ -129,23 +203,15 @@ jobs: os: [ ubuntu-latest, windows-latest ] steps: - name: Checkout sources - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Fix CRLF on Windows if: runner.os == 'Windows' run: git config --global core.autocrlf false - - name: Install protoc - uses: taiki-e/install-action@v2 - with: - tool: protoc - - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true + - name: Install toolchain + id: rust-toolchain + uses: dtolnay/rust-toolchain@stable - name: Install CUDA Linux if: runner.os == 'Linux' @@ -163,40 +229,78 @@ jobs: method: 'network' sub-packages: '["nvcc", "cudart"]' - - name: Cache - uses: actions/cache@v2 + - name: Cache cargo bin + uses: actions/cache@v4 with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + path: ~/.cargo/bin/ + key: ${{ runner.os }}-cargo-bin-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-bin- - - name: Run cargo test release regular features - uses: actions-rs/cargo@v1 + - name: Cache cargo registry index + uses: actions/cache@v4 with: - command: test - args: --release -p karlsen-miner + path: ~/.cargo/registry/index/ + key: ${{ runner.os }}-cargo-registry-index-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry-index- - - name: Run cargo test release no asm - uses: actions-rs/cargo@v1 + - name: Cache cargo registry cache + uses: actions/cache@v4 with: - command: test - args: --features=no-asm --release -p karlsen-miner + path: ~/.cargo/registry/cache/ + key: ${{ runner.os }}-cargo-registry-cache-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry-cache- - - name: Run cargo test release no parking_lot - uses: actions-rs/cargo@v1 + - name: Cache cargo git db + uses: actions/cache@v4 with: - command: test - args: --no-default-features --release -p karlsen-miner + path: ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-git-db-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-git-db- - - name: Run cargo test release shuttle - uses: actions-rs/cargo@v1 + - name: Cache cargo registry + uses: actions/cache@v4 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry- + + - name: Cache cargo git + uses: actions/cache@v4 with: - command: test - args: --no-default-features --features=shuttle --release -p karlsen-miner + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-git- + + - name: Cache build + uses: actions/cache@v4 + with: + path: target + key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-target- + + - name: Install protoc + uses: taiki-e/install-action@v2 + with: + tool: protoc + + - name: Run cargo test release regular features + run: cargo test -p karlsen-miner --release + + - name: Run cargo test release no asm + run: cargo test -p karlsen-miner --features=no-asm --release + + - name: Run cargo test release with parking_lot + run: cargo test -p karlsen-miner --features=parking_lot --release + + - name: Run cargo test release shuttle + run: cargo test -p karlsen-miner --no-default-features --features=shuttle --release lints: name: Lints @@ -205,17 +309,10 @@ jobs: - name: Checkout sources uses: actions/checkout@v4 - - name: Install protoc - uses: taiki-e/install-action@v2 - with: - tool: protoc - - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 + - name: Install toolchain + id: rust-toolchain + uses: dtolnay/rust-toolchain@stable with: - profile: minimal - toolchain: stable - override: true components: rustfmt, clippy - name: Install cuda @@ -225,26 +322,69 @@ jobs: method: 'network' sub-packages: '["nvcc", "cudart"]' - - name: Cache + - name: Cache cargo bin uses: actions/cache@v4 with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + path: ~/.cargo/bin/ + key: ${{ runner.os }}-cargo-bin-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-bin- + - name: Cache cargo registry index + uses: actions/cache@v4 + with: + path: ~/.cargo/registry/index/ + key: ${{ runner.os }}-cargo-registry-index-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry-index- - - name: Run cargo fmt - uses: actions-rs/cargo@v1 + - name: Cache cargo registry cache + uses: actions/cache@v4 with: - command: fmt - args: --all -- --check + path: ~/.cargo/registry/cache/ + key: ${{ runner.os }}-cargo-registry-cache-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry-cache- - - name: Run cargo clippy - uses: actions-rs/cargo@v1 + - name: Cache cargo git db + uses: actions/cache@v4 + with: + path: ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-git-db-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-git-db- + + - name: Cache cargo registry + uses: actions/cache@v4 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry- + + - name: Cache cargo git + uses: actions/cache@v4 with: - command: clippy - args: --tests -- -D warnings + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-git- + + - name: Cache build + uses: actions/cache@v4 + with: + path: target + key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-target- + + - name: Install protoc + uses: taiki-e/install-action@v2 + with: + tool: protoc + + - name: Run cargo fmt + run: cargo fmt --all -- --check + + - name: Run cargo clippy + run: cargo clippy --tests -- -D warnings