Merge pull request #11 from ueckoken/card-class-dependency-injection #31
This file contains 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
# 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 |