Merge beta to main #3786
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Linting and Testing | |
on: | |
pull_request: | |
branches: | |
- main | |
env: | |
SECRET_KEY: "some-insecure-key" | |
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/postgres" | |
CSRF_TRUSTED_ORIGIN: http://127.0.0.1 | |
UV_INDEX_TSD_USERNAME: ${{ secrets.UV_INDEX_TSD_USERNAME }} | |
UV_INDEX_TSD_PASSWORD: ${{ secrets.UV_INDEX_TSD_PASSWORD }} | |
DEBUG: "true" | |
jobs: | |
linters: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Setup Python and Poetry | |
uses: './.github/actions/setup-python' | |
with: | |
python-version: "3.12" | |
- name: Install dependencies | |
run: uv sync --frozen | |
- name: Run linters | |
run: | | |
mkdir test_results | |
uv run ruff check . | |
uv run ruff format --check . | |
uv run mypy . | |
tests: | |
runs-on: ubuntu-latest | |
services: | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: postgres | |
# Provide the password for postgres | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: postgres | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
# Maps tcp port 5432 on service container to the host | |
- 5432:5432 | |
redis: | |
image: redis | |
ports: | |
- 6379:6379 | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Setup Python & Poetry | |
uses: './.github/actions/setup-python' | |
with: | |
python-version: "3.12" | |
- name: Install dependencies | |
run: | | |
uv sync --frozen | |
- name: Run tests | |
run: uv run pytest --junitxml=test_results/TEST-pytest.xml | |
- name: Publish test report | |
uses: mikepenz/action-junit-report@v5 | |
if: success() || failure() # always run even if the previous step fails | |
with: | |
report_paths: "test_results/TEST-*.xml" |