Skip to content

Add workflow without testing model #94

Add workflow without testing model

Add workflow without testing model #94

Workflow file for this run

name: Run Pytest Parallel
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
env:
WORKING_DIRECTORY: application
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test-db
MYSQL_HOST: 127.0.0.1
MYSQL_PORT: 3306
MYSQL_USER: test
MYSQL_PASSWORD: test
DJANGO_SETTINGS_MODULE: project.settings.local
jobs:
Test:
if: |
github.event.pull_request.draft == false
&& !startsWith(github.head_ref, 'release')
&& !startsWith(github.head_ref, 'doc')
name: Run Test Code
strategy:
matrix:
test-path: ['test_health_check.py', 'test_login.py']
runs-on: ubuntu-20.04
defaults:
run:
working-directory: ${{ env.WORKING_DIRECTORY }}
services:
db:
image: mysql:8.0
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: ${{ env.MYSQL_ROOT_PASSWORD }}
MYSQL_DATABASE: ${{ env.MYSQL_DATABASE }}
MYSQL_USER: ${{ env.MYSQL_USER }}
MYSQL_PASSWORD: ${{ env.MYSQL_PASSWORD }}
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Chekcout code
uses: actions/checkout@v3
- name: Grant privileges to user
run: mysql --protocol=tcp -h 127.0.0.1 -P 3306 -u root -p$MYSQL_ROOT_PASSWORD -e "GRANT ALL PRIVILEGES ON *.* TO '$MYSQL_USER'@'%'; FLUSH PRIVILEGES;"
- name: Setup Poetry
uses: ./.github/actions/set-up-poetry
with:
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: Run migration
run: |
poetry run python manage.py makemigrations
poetry run python manage.py migrate
- name: Run Pytest
run: poetry run pytest application/tests/${{ matrix.test-path }} -n auto --cov --no-cov-on-fail --suppress-no-test-exit-code