Backend Security Audit fixes (#352) #1595
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: Unit Tests | |
on: [push] | |
jobs: | |
Pytest_bootstrapper: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: pipx install pipenv | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
cache: 'pipenv' | |
- run: pipenv install --dev --deploy | |
- name: Test with pytest | |
run: pipenv run pytest | |
Pytest: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: testuser | |
POSTGRES_PASSWORD: testpass | |
POSTGRES_DB: my_project_test_db | |
ports: | |
- 5432:5432 | |
# needed because the postgres container does not provide a healthcheck | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
strategy: | |
matrix: | |
fe_type: [react, vue] | |
steps: | |
- uses: actions/checkout@v4 | |
- run: pipx install pipenv | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
cache: 'pipenv' | |
- name: Install bootstrapper dependencies | |
run: pipenv install --dev --deploy | |
- run: | | |
config_file="cookiecutter/${{ matrix.fe_type }}_template.yaml" | |
pipenv run cookiecutter . --config-file $config_file --no-input -f | |
- name: Pytest, McCabe, and Coverage | |
run: | | |
cd my_project | |
pipenv install --dev --deploy | |
mkdir -p client/dist/static | |
pipenv run python server/manage.py collectstatic | |
pipenv run pytest --mccabe --cov=my_project -vv server/my_project | |
pipenv run coverage report --fail-under=60 |