From dbc0387d3210de7fae37ff47b318b98151ba0e04 Mon Sep 17 00:00:00 2001 From: "M.V. Bego" Date: Tue, 16 Jan 2024 14:35:53 +0100 Subject: [PATCH] build: include service of mongodb to run the application and test --- .github/workflows/rust.yml | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d54fa2f..0e509ec 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -11,12 +11,24 @@ env: jobs: build: - runs-on: ubuntu-latest + services: + mongodb: + image: mongo:latest + ports: + - 27017:27017 + options: >- + --health-cmd 'mongo --eval "db.runCommand({ ping: 1 })" --quiet' + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: - - uses: actions/checkout@v3 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose + - uses: actions/checkout@v3 + - name: Build + run: cargo build --verbose + - name: Run tests + env: + MONGO_URL: mongodb://localhost:27017 + run: cargo test --verbose