From 5cfe0cc22c05ffb00f512515a248b991152e56a5 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Wed, 4 Aug 2021 14:46:13 +0800 Subject: [PATCH] Update GitHub Actions --- .github/workflows/rust.yml | 42 +++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 3e6f5962..736e72b7 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -15,9 +15,37 @@ jobs: test: name: Unit Test runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + + - uses: Swatinem/rust-cache@v1 + + - uses: actions-rs/cargo@v1 + with: + command: build + args: > + --all + + - uses: actions-rs/cargo@v1 + with: + command: test + + postgres: + name: Postgres + runs-on: ubuntu-20.04 + strategy: + matrix: + version: [13.3, 12.7, 11.12, 10.17, 9.6.22] + project: [live] services: postgres: - image: postgres:11 + image: postgres:${{ matrix.version }} env: POSTGRES_HOST: 127.0.0.1 POSTGRES_USER: sea @@ -38,22 +66,16 @@ jobs: toolchain: stable override: true - - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-test-${{ hashFiles('**/Cargo.lock') }} + - uses: Swatinem/rust-cache@v1 - uses: actions-rs/cargo@v1 with: command: build args: > - --all + --manifest-path tests/${{ matrix.project }}/postgres/Cargo.toml - uses: actions-rs/cargo@v1 with: command: test args: > - --all + --manifest-path tests/${{ matrix.project }}/postgres/Cargo.toml