Skip to content

Commit

Permalink
ci: add ruff, mypy, pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
tigattack committed Aug 20, 2024
1 parent 7c12404 commit a5ba6ba
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/test-reusable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
name: Test

on:
workflow_call:
inputs:
package_name:
description: 'The name of the package to test'
required: true
type: string
tests_path:
description: 'The path to the directory containing pytest tests'
required: true
type: string

jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry

- name: Setup python and restore poetry
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
cache: "poetry"

- name: Lint with ruff
run: |
poetry install --with dev
poetry run ruff check ${{ inputs.package_name }} --output-format=github
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry

- name: Setup python and restore poetry
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
cache: "poetry"

- name: Type check with mypy
run: |
poetry install --with dev
poetry run mypy --strict ${{ inputs.package_name }}
pytest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry

- name: Setup python and restore poetry
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
cache: "poetry"

- name: Test with pytest
run: |
poetry install --with dev
poetry run pytest ${{ inputs.tests_path }}
env:
CI: true
TEST_API_KEY: ${{ secrets.TEST_API_KEY }}
15 changes: 15 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Test

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

jobs:
test:
uses: ./.github/workflows/test-reusable.yml
with:
package_name: dvla_vehicle_enquiry_service
tests_path: tests

0 comments on commit a5ba6ba

Please sign in to comment.