Skip to content

Commit

Permalink
Add coverage badge & use short sha for docker tag
Browse files Browse the repository at this point in the history
  • Loading branch information
StdioA committed Aug 25, 2024
1 parent f5bee5d commit 5c6d029
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Get short SHA
uses: benjlevesque/[email protected]
id: short-sha
with:
length: 7

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
Expand All @@ -43,7 +49,7 @@ jobs:
push: true
tags: |
${{ env.GHCR_REPO }}:latest
${{ env.GHCR_REPO }}:${{ github.sha }}
${{ env.GHCR_REPO }}:${{ env.SHA }}
cache-from: type=gha
cache-to: type=gha,mode=max

Expand All @@ -56,6 +62,6 @@ jobs:
push: true
tags: |
${{ env.GHCR_REPO }}:latest
${{ env.GHCR_REPO }}:${{ github.sha }}
${{ env.GHCR_REPO }}:${{ env.SHA }}
cache-from: type=gha
cache-to: type=gha,mode=max
9 changes: 6 additions & 3 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ jobs:
python -m pip install "pip<24.1"
pip install -r requirements-full.txt
pip install "sqlite-vec==0.1.1"
pip install pytest pytest-cov coverage codecov
- name: Test with pytest
run: |
pip install pytest pytest-cov coverage
coverage run -m pytest
coverage report --include="**/*.py" --omit="**/*_test.py"
pytest --cov
- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ lint:
@ruff check

test:
coverage run -m pytest
coverage report --include="**/*.py" --omit="**/*_test.py"
@coverage html --include="**/*.py" --omit="**/*_test.py"
coverage run --source=. --omit="**/*_test.py,bots/mmbot.py,bots/telegram_bot.py" -m pytest
coverage report
@coverage html
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Beancount Bot
[![codecov](https://codecov.io/github/StdioA/beancount-bot/graph/badge.svg?token=PPEO1607AJ)](https://codecov.io/github/StdioA/beancount-bot) ![ghcr image size](https://ghcr-badge.egpl.dev/stdioa/beancount-bot/size?color=%2344cc11&tag=latest&label=image+size&trim=)

[中文文档](README_zh.md)

A Beancount bot that allows for quick manual recording of simple transactions via IM software.
Expand Down

0 comments on commit 5c6d029

Please sign in to comment.