Skip to content

Docs: Update README.md #563

Docs: Update README.md

Docs: Update README.md #563

name: Tests
on:
push:
branches:
- main
pull_request:
workflow_call:
inputs:
api_url:
required: true
type: string
deployment_env:
required: true
type: string
secrets:
API_KEY:
required: true
env:
HATCH_VERSION: "v1.7.0" # keep in sync with deploy.yml
jobs:
format-black:
name: Format black
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Run black
run: hatch run code-quality:format
mypy:
name: MyPy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Run mypy
run: hatch run code-quality:types
lint:
name: Lint Code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Run pylint
run: hatch run code-quality:lint
isort:
name: Sort imports
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Run mypy
run: hatch run code-quality:sort
pydocstyle:
name: Check docstrings
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Run pydocstyle
run: hatch run code-quality:docstrings
scan-for-secrets:
name: Scan for secrets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install gitleaks
run: wget -O - https://github.com/gitleaks/gitleaks/releases/download/v8.16.1/gitleaks_8.16.1_linux_x64.tar.gz | tar -xz
- run: ./gitleaks detect --log-opts "${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}"
if: github.event_name == 'pull_request'
- run: ./gitleaks detect --log-opts "${{ github.event.before }}..${{ github.event.after }}"
if: github.event_name == 'push'
tests:
name: Tests
runs-on: ubuntu-latest
env:
API_KEY: "not-a-real-api-key"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Run unit tests
run: hatch run test:unit-with-cov
- name: Coverage comment
if: github.event_name == 'push' || github.event_name == 'pull_request'
id: coverage_comment
uses: py-cov-action/python-coverage-comment-action@48708266a6e77ebf564b50d9cff2b7df9a25b458
with:
GITHUB_TOKEN: ${{ github.token }}
# the API_KEYs are stored as a secret in the repository
# we are using the "automated-tests" organization with predefined users and workspaces
integration_tests:
name: Integration Tests for deployment
environment: ${{ github.event.inputs.deployment_env }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run integration tests
uses: ./.github/actions/integration_tests
with:
API_KEY: "${{ inputs.deployment_env == 'release' && secrets.API_KEY_PROD || secrets.API_KEY}}"
API_URL: "${{ inputs.api_url || 'https://api.dev.cloud.dpst.dev/api/v1'}}"
build:
name: Build package
needs: [format-black, mypy, lint, tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Build
run: hatch build