bug fix #163
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: Pytest report | |
on: | |
pull_request: | |
branches: | |
- main | |
- develop | |
push: | |
branches: | |
- main | |
- develop | |
permissions: | |
contents: read | |
jobs: | |
linter: | |
name: Black Syntax Check | |
runs-on: [self-hosted, "hetzner"] | |
if: github.repository_owner == 'Bot-detector' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install python3-venv package | |
run: sudo apt update && sudo apt install python3-venv -y | |
- name: Run Black | |
uses: psf/black@24.3.0 | |
with: | |
options: "--check --verbose" | |
src: "./src" | |
Build-Test: | |
name: Setup Enviornment and Run Tests | |
runs-on: [self-hosted, "hetzner"] | |
if: github.repository_owner == 'Bot-detector' | |
env: | |
ENV: "DVP" | |
DATABASE_URL: "mysql+aiomysql://root:root_bot_buster@mysql:3306/playerdata" | |
KAFKA_HOST: "localhost:9092" | |
POOL_RECYCLE: 60 | |
POOL_TIMEOUT: 30 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11.6" | |
- name: install testing requirements | |
run: | | |
python3 -m pip install pytest-asyncio | |
python3 -m pip install httpx | |
python3 -m pip install hypothesis | |
python3 -m pip install -r requirements.txt | |
- name: Setup Docker Containers | |
run: | | |
docker-compose --verbose up --build -d | |
- name: Check API is Up | |
uses: cygnetdigital/wait_for_response@v2.0.0 | |
with: | |
url: "http://localhost:5000/docs" | |
responseCode: "200,500" | |
timeout: 120000 # wait up to 120 seconds | |
interval: 5000 # poll every 5 seconds | |
- name: Generate Pytest Report | |
run: | | |
python3 -m pytest --junit-xml=pytest_report.xml | |
# https://github.com/marketplace/actions/pytest-results-actions | |
- name: Surface Failing Tests | |
if: always() | |
uses: pmeier/pytest-results-action@main | |
with: | |
# A list of JUnit XML files, directories containing the former, and wildcard | |
# patterns to process. | |
# See @actions/glob for supported patterns. | |
path: pytest_report.xml | |
# Add a summary of the results at the top of the report | |
# Default: true | |
summary: true | |
# Select which results should be included in the report. | |
# Follows the same syntax as | |
# `pytest -r` | |
# Default: fEX | |
display-options: fEX | |
# Fail the workflow if no JUnit XML was found. | |
# Default: true | |
fail-on-empty: true |