Skip to content

Add: Docker CI Workflow #4

Add: Docker CI Workflow

Add: Docker CI Workflow #4

Workflow file for this run

name: Python CI
on:
push:
branches:
- develop
- "feature/**"
- "release/**"
pull_request:
branches:
- develop
- main
jobs:
test:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_DATABASE: scholar_db
MYSQL_USER: scholar_user
MYSQL_PASSWORD: scholar_pass
MYSQL_ROOT_PASSWORD: rootpass
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pylint pytest pytest-cov
- name: Initialize Database
run: |
mysql -h127.0.0.1 -P3306 -uscholar_user -pscholar_pass scholar_db < init/01_schema.sql
- name: Run tests with pytest
run: |
python -m pytest tests/ --cov=code --cov=app
env:
MYSQL_HOST: 127.0.0.1
MYSQL_PORT: 3306
MYSQL_USER: scholar_user
MYSQL_PASSWORD: scholar_pass
MYSQL_DATABASE: scholar_db
- name: Lint with pylint
run: |
pylint code/ app/ tests/ --disable=C0111,C0301
- name: Upload coverage reports
if: success()
uses: codecov/codecov-action@v3