Update issue templates #3
This file contains hidden or 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: Python application | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:8.4 | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd="mysqladmin ping --silent" | |
--health-interval=30s | |
--health-timeout=10s | |
--health-retries=5 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_DATABASE: test_db | |
MYSQL_USER: user | |
MYSQL_PASSWORD: password | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10" | |
- name: Cache dependencies | |
uses: actions/cache@v3.3.0 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 pytest | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Wait for MySQL to be ready | |
run: | | |
while ! mysqladmin ping -h"127.0.0.1" --silent; do | |
echo "Waiting for MySQL to be ready..." | |
sleep 5 | |
done | |
- name: Lint with flake8 | |
run: | | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Test with pytest | |
run: | | |
python3 -m pytest tests/ |