-
Notifications
You must be signed in to change notification settings - Fork 2
50 lines (50 loc) · 2.05 KB
/
pythontests.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
name: Python tests
on:
push:
paths:
- 'infra/api/**.py'
jobs:
unittest:
runs-on: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # ratchet:actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@7f80679172b057fc5e90d70d197929d454754a5a # ratchet:actions/setup-python@v2
with:
python-version: "3.10"
- uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed # ratchet:actions/cache@v2
name: Configure pip caching
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Python dependencies
run: |
pip install -r requirements.txt
pip install -r infra/api/requirements.txt
- name: test functions
run: |
coverage run -m pytest infra/api/test_extract.py infra/api/test_notify.py &&\
coverage report -m
- name: Coverage Badge
uses: tj-actions/coverage-badge-py@c3a0870495183a1848c89d568db7a4e7954fee71 # ratchet:tj-actions/[email protected]
- name: Verify Changed files
uses: tj-actions/verify-changed-files@c09bcad97929b17bacf737670bee312af98be94f # ratchet:tj-actions/verify-changed-files@v9
id: changed_files
with:
files: coverage.svg
- name: Commit files
if: steps.changed_files.outputs.files_changed == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add coverage.svg
git commit -m "Updated coverage.svg"
- name: Push changes
if: steps.changed_files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@552c074ed701137ebd2bf098e70c394ca293e87f # ratchet:ad-m/github-push-action@master
with:
github_token: ${{ secrets.GH_TOKEN }}
branch: ${{ github.ref_name }}