-
-
Notifications
You must be signed in to change notification settings - Fork 50
87 lines (85 loc) · 2.49 KB
/
ci-pr-test.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: CI - Pull Request
on:
pull_request:
branches: [main]
paths:
- src/**
- tests/**
- Dockerfile
- pylintrc
- pytest.ini
- requirements-test.txt
- requirements.txt
- run-ci.sh
workflow_dispatch:
jobs:
cache-requirements-install:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Cache pip dependencies
uses: actions/cache@v4
id: cache-dependencies
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
pip install -r requirements-test.txt
test:
needs: cache-requirements-install
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Restore pip cache dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install -r requirements-test.txt
- name: Test with pytest
run: |
sudo mkdir /config /icloud &&
sudo chown -R $(id -u):$(id -g) /config /icloud &&
ruff check &&
ENV_CONFIG_FILE_PATH=./tests/data/test_config.yaml pytest
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- name: Generate Allure Report
uses: simple-elf/allure-report-action@master
if: always()
with:
allure_results: allure-results
allure_history: allure-history
keep_reports: 100
- name: Upload tests artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: tests-output
path: allure-history
retention-days: 1
- name: Upload coverage artifacts
uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: coverage-output
path: htmlcov
retention-days: 1