From 3304e90970903251be688f4b8771ffbd72c0df93 Mon Sep 17 00:00:00 2001 From: lens0021 Date: Tue, 17 Dec 2024 19:43:18 +0900 Subject: [PATCH] needs test --- .github/workflows/rust.yml | 43 ++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e392da10..7786d248 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -27,9 +27,40 @@ env: CARGO_TERM_COLOR: always jobs: - build_and_test: + build: + name: Rust build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + # - uses: awalsh128/cache-apt-pkgs-action@latest + # with: + # packages: bc shfmt + # version: 1.0 + # - name: Install bshchk + # run: | + # sudo curl https://github.com/b1ek/bshchk/releases/download/1.1/bshchk.linux.amd64 -L -o /usr/bin/bshchk + # sudo chmod +x /usr/bin/bshchk + - uses: dtolnay/rust-toolchain@stable + - name: Cache dependencies installed with cargo + uses: actions/cache@v4 + with: + path: | + ./target/deps + ~/.cargo + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- + - name: Build binary + # the binary will be used by the next cargo test step + run: cargo build --tests --all-targets --all-features + - uses: actions/upload-artifact@v4 + with: + name: target + path: target/ + retention-days: 1 + test: name: Rust tests runs-on: ubuntu-latest + needs: build strategy: fail-fast: false matrix: @@ -68,9 +99,11 @@ jobs: ~/.cargo key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} restore-keys: ${{ runner.os }}-cargo- - - name: Build binary - # the binary will be used by the next cargo test step - run: cargo build + - name: Download a single artifact + uses: actions/download-artifact@v4 + with: + name: target + path: target - name: Run cargo tests env: AMBER_TEST_STRATEGY: docker @@ -91,6 +124,8 @@ jobs: docker build -t testbash . docker run --network host --detach --name test_container testbash sleep infinity + export CARGO_TARGET_DIR="$PWD/target" + chmod +x target/debug/amber cargo test --all-targets --all-features docker stop test_container -t 0 docker rm --force test_container