-
Notifications
You must be signed in to change notification settings - Fork 9
111 lines (90 loc) · 3.14 KB
/
build-test-codecov.yml
File metadata and controls
111 lines (90 loc) · 3.14 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Lint Build Test Codecov
permissions:
contents: read
pull-requests: write
on:
push:
branches: [ main ]
pull_request:
branches: [ main, pre-release ]
jobs:
# Main Build Job
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest, macos-latest ]
python-version: [ '3.10', '3.11', '3.12', '3.13' ] # Add multiple Python versions for testing
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Verify uv installation
run: |
uv --version || echo "uv installation failed"
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install the project
run: |
uv sync --all-extras --dev || echo "Dependency installation failed"
- name: Lint with flake8
run: |
uv run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Run tests and generate coverage report
run: |
uv run pytest --verbose --cov --cov-report=xml --cov-report=term-missing || echo "Tests failed"
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false # Don't fail CI if Codecov upload fails
token: ${{ secrets.CODECOV_TOKEN }}
- name: Run examples
run: |
uv run raman_fitting run examples
- name: Upload raman_fitting examples as artifacts
uses: actions/upload-artifact@v4
with:
name: raman-fitting-examples
path: $HOME/raman_fitting/examples/
# Separate Windows Job
windows:
runs-on: windows-latest
continue-on-error: true # Allow this job to fail without failing the whole workflow
strategy:
fail-fast: true
matrix:
python-version: [ '3.13' ] # Add multiple Python versions for testing
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Verify uv installation
run: |
uv --version || echo "uv installation failed"
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install the project
run: |
uv sync --all-extras --dev || echo "Dependency installation failed"
- name: Run Windows-specific tests
run: |
uv pip install ansi2html # Ensure ansi2html is installed
echo "from ansi2html.parser import Ansi2HTMLParser; import sys; sys.stdout.write(Ansi2HTMLParser().parse(input()))" > strip_ansi.py
uv run pytest --capture=sys --tb=short | uv run strip_ansi.py # Use uv run to execute strip_ansi.py
- name: Run examples
run: |
uv run raman_fitting run examples