forked from Bot-detector/public-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GitHub workflow init for pytest (Bot-detector#17)
* merge conflicts * removing unused * remove test requirements and docker runs in detached mode * add workflow for pytest * Revert "merge conflicts" This reverts commit 553305a. * run on self hosted + minor changes * on push & pull request * fix style * sudo apt install python3-venv -y * make file improvements * run deployment affter succesfull test --------- Co-authored-by: extreme4all <[email protected]>
- Loading branch information
1 parent
a9eee32
commit 8b313a3
Showing
4 changed files
with
91 additions
and
16 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Pytest report | ||
|
||
on: [push, pull_request] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
linter: | ||
name: Black Syntax Check | ||
runs-on: [self-hosted, "hetzner"] | ||
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@stable | ||
with: | ||
options: "--check --verbose" | ||
src: "./src" | ||
|
||
Build-Test: | ||
name: Setup Enviornment and Run Tests | ||
runs-on: [self-hosted, "hetzner"] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.11.6" | ||
|
||
- name: Setup Docker Containers | ||
run: | | ||
make setup-detached | ||
- name: Check API is Up | ||
uses: cygnetdigital/[email protected] | ||
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: | | ||
make test-report | ||
# 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 |
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
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