From 587958ab222eb38fd2404decc09aefd823312f59 Mon Sep 17 00:00:00 2001 From: Daniel Bacher Date: Wed, 5 Feb 2025 14:06:05 +0100 Subject: [PATCH] move tests to own stage --- .../workflows/{lint.yml => lint_and_test.yml} | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) rename .github/workflows/{lint.yml => lint_and_test.yml} (72%) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint_and_test.yml similarity index 72% rename from .github/workflows/lint.yml rename to .github/workflows/lint_and_test.yml index 151eb2a..94b7449 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint_and_test.yml @@ -1,4 +1,4 @@ -name: Lint the projects files +name: Lint and test the projects on: - push - pull_request @@ -10,6 +10,31 @@ jobs: PythonLinting: name: Python linting runs-on: ubuntu-latest + env: + NAUTOBOT_CONFIG: "${{ github.workspace }}/development/nautobot_config.py" + steps: + - uses: actions/checkout@master + - uses: actions/setup-python@v5 + with: + python-version: "3.10" + cache: 'poetry' + - name: Run image + uses: abatilo/actions-poetry@v2 + with: + poetry-version: 1.3.2 + - name: Install all dependencies + run: poetry install + - name: Run black (check mode) + run: poetry run black --check nautobot_dns_records + - name: Run pylint + run: poetry run pylint --init-hook "import nautobot; nautobot.setup()" --rcfile pyproject.toml nautobot_dns_records + - name: Run pydocstyle + run: poetry run pydocstyle nautobot_dns_records + Unittests: + name: Unittests + runs-on: ubuntu-latest + needs: + - PythonLinting services: postgres: image: postgres @@ -37,21 +62,16 @@ jobs: NAUTOBOT_CONFIG: "${{ github.workspace }}/development/nautobot_config.py" steps: - uses: actions/checkout@master - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.10" + cache: 'poetry' - name: Run image uses: abatilo/actions-poetry@v2 with: poetry-version: 1.3.2 - name: Install all dependencies run: poetry install - - name: Run black (check mode) - run: poetry run black --check nautobot_dns_records - - name: Run pylint - run: poetry run pylint --init-hook "import nautobot; nautobot.setup()" --rcfile pyproject.toml nautobot_dns_records - - name: Run pydocstyle - run: poetry run pydocstyle nautobot_dns_records - name: Run the tests with coverage run: poetry run coverage run development/manage.py -c development/nautobot_config.py test - name: Report coverage