Repository navigation
89 lines (74 loc) · 2.41 KB
/
Copy pathtest-script.yaml
File metadata and controls
89 lines (74 loc) · 2.41 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
name: test-script
on:
push:
branches:
- main
pull_request:
branches:
- main
# Removed hardcoded test API key - use secrets instead if needed
jobs:
packaging-smoke:
name: Clean wheel install smoke test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Build wheel and smoke-test a fresh install
run: |
set -euo pipefail
python -m pip install --upgrade pip build
python -m build --wheel
python -m venv /tmp/structkit-smoke
/tmp/structkit-smoke/bin/pip install --upgrade pip
/tmp/structkit-smoke/bin/pip install dist/*.whl
/tmp/structkit-smoke/bin/structkit --help
/tmp/structkit-smoke/bin/structkit generate --help
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: '3.10'
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements.dev.txt
- name: Lint with flake8
run: flake8 --max-line-length=200 .
continue-on-error: true
- name: Type check with mypy
run: |
mypy structkit tests
continue-on-error: true
- name: Run tests
env:
REPORT_OUTPUT: md_report.md
shell: bash
run: |
echo "REPORT_FILE=${REPORT_OUTPUT}" >> "$GITHUB_ENV"
pytest --cov=structkit --cov-branch --cov-report=xml -v --md-report --md-report-flavor gfm --md-report-exclude-outcomes passed skipped xpassed --md-report-output "$REPORT_OUTPUT" --pyargs tests
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Output reports to the job summary when tests fail
if: failure()
shell: bash
run: |
if [ -f "$REPORT_FILE" ]; then
echo "<details><summary>Failed Test Report</summary>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
cat "$REPORT_FILE" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY
fi