-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (54 loc) · 1.6 KB
/
python-app.yml
File metadata and controls
64 lines (54 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Python application
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
# Add MariaDB service for tests that need a database
services:
mariadb:
image: mariadb:10.5
env:
MYSQL_ROOT_PASSWORD: rootpass
MYSQL_DATABASE: forgecms_test
MYSQL_USER: forgecms
MYSQL_PASSWORD: forgecms_pass
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Remove venv if it exists
run: |
if [ -d "venv" ]; then rm -rf venv; fi
if [ -d ".venv" ]; then rm -rf .venv; fi
- 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: 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: Run tests with pytest
env:
# Point your app to the test database
DATABASE_URL: mysql+pymysql://forgecms:forgecms_pass@127.0.0.1:3306/forgecms_test
SECRET_KEY: ci-test-secret-key
FLASK_ENV: testing
run: |
pytest