forked from Soju06/python-kis
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (89 loc) · 2.64 KB
/
Copy pathci.yml
File metadata and controls
91 lines (89 loc) · 2.64 KB
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
88
89
90
91
name: CI
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
jobs:
test:
name: Tests (${{ matrix.os }}, Python ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: pipx install poetry
- name: Install dependencies
run: poetry install --no-interaction --with=dev
- name: Run unit + integration tests
env:
PYTEST_ADDOPTS: "-m 'not requires_api'"
run: |
poetry run pytest \
--maxfail=1 -q \
--cov=pykis --cov-report=xml:reports/coverage.xml \
--cov-report=html:reports/coverage_html \
--html=reports/test_report.html --self-contained-html
- name: Check coverage threshold
run: |
poetry run coverage report --fail-under=90
continue-on-error: false
- name: Upload coverage.xml
uses: actions/upload-artifact@v4
with:
name: coverage-xml
path: reports/coverage.xml
- name: Upload coverage html
uses: actions/upload-artifact@v4
with:
name: coverage-html
path: reports/coverage_html
- name: Upload pytest html
uses: actions/upload-artifact@v4
with:
name: pytest-report
path: reports/test_report.html
build:
if: startsWith(github.ref, 'refs/tags/v')
name: Build (tagged releases)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Poetry
run: pipx install poetry
- name: Install deps
run: poetry install --no-interaction --with=dev
- name: Inject version from tag (current B-option)
shell: bash
run: |
tag=${GITHUB_REF_NAME#v}
python - <<'PY'
from pathlib import Path
import os
ver=os.environ.get('TAG') or os.environ.get('GITHUB_REF_NAME','v0.0.0')[1:]
p=Path('pykis/__env__.py')
s=p.read_text(encoding='utf-8')
s=s.replace('{{VERSION_PLACEHOLDER}}', ver)
p.write_text(s, encoding='utf-8')
print('Set version to', ver)
PY
env:
TAG: ${{ github.ref_name }}
- name: Build
run: poetry build
- name: Upload dist
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/*