From aec43bfb35f7bbb4264abf2270daff048a916b0e Mon Sep 17 00:00:00 2001 From: Macpie Date: Wed, 15 May 2024 14:47:37 -0700 Subject: [PATCH] Separate test with postgres --- .github/workflows/CI.yml | 44 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0d177663f..de82d56e4 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -108,15 +108,15 @@ jobs: - name: Clippy run: cargo clippy --all-targets -- -Dclippy::all -D warnings - tests: + tests-postgres: needs: build runs-on: oracles-20.04 strategy: fail-fast: false matrix: - package: [boost-manager,file-store,ingest,iot-config,iot-packet-verifier,iot-verifier,mobile-config,mobile-packet-verifier,mobile-verifier,reward-scheduler,task-manager] + package: [boost-manager,iot-config,iot-packet-verifier,iot-verifier,mobile-config,mobile-verifier] concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-tests-${{ matrix.package }} + group: ${{ github.workflow }}-${{ github.ref }}-tests-postgres-${{ matrix.package }} cancel-in-progress: true services: postgres: @@ -156,8 +156,44 @@ jobs: DATABASE_URL: "postgres://postgres:postgres@localhost:5432/postgres" run: cargo test -p ${{ matrix.package }} -- --include-ignored + tests: + needs: build + runs-on: oracles-20.04 + strategy: + fail-fast: false + matrix: + package: [file-store,ingest,mobile-packet-verifier,reward-scheduler,task-manager] + concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-tests-${{ matrix.package }} + cancel-in-progress: true + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Rust install + uses: dtolnay/rust-toolchain@stable + + - name: Install protoc + run: sudo apt-get install -y protobuf-compiler + + - name: Cache + 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') }} + + - name: Run unit and integration tests + env: + DATABASE_URL: "postgres://postgres:postgres@localhost:5432/postgres" + run: cargo test -p ${{ matrix.package }} -- --include-ignored + build-release: - needs: [fmt, clippy, tests] + needs: [fmt, clippy, tests, tests-postgres] runs-on: oracles-20.04 concurrency: group: ${{ github.workflow }}-${{ github.ref }}-build-release