diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 6d4b49df2..36cfc822d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -3,10 +3,10 @@ name: Build and Test on: [push, pull_request] jobs: - build: + build-and-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: recursive - name: Install Rust components @@ -17,7 +17,10 @@ jobs: ~/.cargo/registry ~/.cargo/git target - key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} + key: ${{ runner.os }}-${{ runner.arch }}-cargo-test-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-${{ runner.arch }}-cargo-test + ${{ runner.os }}-${{ runner.arch }}-cargo - name: Install moleculec v0.7.2 run: CARGO_TARGET_DIR=target/ cargo install moleculec --version 0.7.2 - name: Check format @@ -42,7 +45,28 @@ jobs: git submodule update --init --recursive --depth=1 make all-via-docker - - name: Tests + - name: Tests all targets run: RUST_BACKTRACE=1 cargo test --all-targets - - name: Test TOML serialization - run: cargo run --bin godwoken -- generate-example-config -o test.toml + + test-generate-example-config: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Cache of Cargo + id: cargo-test-cache + uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-${{ runner.arch }}-cargo-build + ${{ runner.os }}-${{ runner.arch }}-cargo + - name: Test TOML serialization + run: cargo run --bin godwoken -- generate-example-config -o test.toml