From f9f188524e6185e988bdbc48346aba994fab7a14 Mon Sep 17 00:00:00 2001 From: Max Countryman Date: Thu, 10 Oct 2024 11:00:17 -0700 Subject: [PATCH] service per job --- .github/workflows/rust.yml | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index aeb62b3..905c8e2 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -10,10 +10,24 @@ env: CARGO_TERM_COLOR: always DATABASE_URL: postgres://postgres:postgres@postgres:5432/underway +postgres_service: &postgres_service + postgres: + image: postgres + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: underway + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + jobs: check: runs-on: ubuntu-latest - + services: + <<: *postgres_service steps: - uses: actions/checkout@v4 - run: | @@ -26,21 +40,10 @@ jobs: run: | cargo +nightly fmt --all -- --check - services: - postgres: - image: postgres - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: underway - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - check-docs: runs-on: ubuntu-latest + services: + <<: *postgres_service steps: - uses: actions/checkout@v4 - run: | @@ -55,6 +58,8 @@ jobs: test-docs: needs: check runs-on: ubuntu-latest + services: + <<: *postgres_service steps: - uses: actions/checkout@v4 - run: | @@ -67,6 +72,8 @@ jobs: test-lib: needs: check runs-on: ubuntu-latest + services: + <<: *postgres_service steps: - uses: actions/checkout@v4 - run: |