From cb92c0a52badead7d827fe2186b608bab281fd28 Mon Sep 17 00:00:00 2001 From: Jakub Miazek Date: Mon, 19 Feb 2024 09:46:22 +0100 Subject: [PATCH] update github ci --- .github/workflows/build-and-test.yml | 52 +++++++++++++++------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 4a25a3e..224f98b 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -1,14 +1,36 @@ -name: Unit Tests +name: CI -on: [pull_request] +on: + pull_request: + push: + branches: + - main jobs: build: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: python-version: ["3.11"] - fail-fast: false + poetry-version: [ "1.7.1" ] + + env: + PYTHONDONTWRITEBYTECODE: 1 + PYTHONUNBUFFERED: 1 + ENVIRONMENT: test + TESTING: 0 + UP: up + DOWN: down + WEB_SERVER: web_server + MONGO_HOST: mongodb + MONGO_PORT: 27017 + MONGO_USER: farmer + MONGO_PASS: tractor + MONGO_DB: greenhouse + MONGO_COLLECTION: greens + MONGO_TEST_DB: farmland + MONGO_URL: mongodb://farmer:tractor@127.0.0.1:27017/?retryWrites=true&w=majority services: mongodb: @@ -27,31 +49,11 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install Poetry - uses: snok/install-poetry@v1 - - name: Load cached venv - id: cached-poetry-dependencies - uses: actions/cache@v3 + uses: abatilo/actions-poetry@v2 with: - path: .venv - key: venv-${{ runner.os }}-3.11-${{ hashFiles('**/poetry.lock') }} + poetry-version: ${{ matrix.poetry-version }} - name: Install dependencies if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' run: poetry install --no-interaction --no-root - name: Test Code run: poetry run pytest - env: - PYTHONDONTWRITEBYTECODE: 1 - PYTHONUNBUFFERED: 1 - ENVIRONMENT: test - TESTING: 0 - UP: up - DOWN: down - WEB_SERVER: web_server - MONGO_HOST: mongodb - MONGO_PORT: 27017 - MONGO_USER: farmer - MONGO_PASS: tractor - MONGO_DB: greenhouse - MONGO_COLLECTION: greens - MONGO_TEST_DB: farmland - MONGO_URL: mongodb://farmer:tractor@127.0.0.1:27017/?retryWrites=true&w=majority