forked from ueckoken/KM4K
-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (52 loc) · 1.54 KB
/
python-app.yml
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python application
on:
push:
branches: [ "main" ]
pull_request:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-20.04
services:
# ref: https://docs.github.com/ja/actions/using-containerized-services/creating-redis-service-containers
redis:
image: redis:alpine
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version-file: ".python-version"
- name: Install dev dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Check format
run: black --check --verbose --diff .
- name: Lint
run: ruff check --format github .
- name: Test with unittest and gather code coverage
run: coverage run --branch -m unittest
env:
REDIS_HOST: localhost
REDIS_PORT: 6379
REDIS_DB: 0
- name: Show coverage
run: |
coverage report -m
coverage html
- name: Save coverage HTML report
uses: actions/upload-artifact@v3
with:
name: code-coverage-report
path: htmlcov