-
-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (47 loc) · 1.5 KB
/
test_script.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 is the workflow file that runs the tests on every pull request.
name: 🧪 Tests
on:
pull_request:
branches: [ main ]
permissions:
contents: read
pull-requests: write
jobs:
test:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: 🛒 Checkout
uses: actions/checkout@v3
# Setting up Python
- name: 🐍 Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
architecture: "x64"
# Install pipenv
- name: ⚙️ Install pipenv
run: |
python -m pip install --upgrade pipenv wheel
# Cache pipenv
- name: 🗃️ Cache pipenv
id: cache-pipenv
uses: actions/cache@v3
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
# Install dependencies from Pipfile.lock
- name: ⚙️ Install dependencies
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: |
pipenv install --deploy --dev
# Run all the tests
- name: 🧪 Tests with pytest
run: |
pipenv run pytest --junitxml=pytest.xml -v --cov script/ > pytest-coverage.txt
# Write the coverage report as a comment on the pull request
- name: 💬 Pytest Coverage Comment
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml