-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (111 loc) · 3.58 KB
/
ci.yml
File metadata and controls
134 lines (111 loc) · 3.58 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Debug - Check environment
run: |
echo "Python version:"
python --version
echo "Python path:"
which python
echo "Site packages:"
python -c "import site; print(site.getsitepackages())"
echo "Current directory:"
pwd
echo "Directory contents:"
ls -la
echo "Installed packages:"
pip list
- name: Debug - Test package import
run: |
echo "Testing direct import:"
python -c "import nutrient_dws; print('Import successful:', nutrient_dws.__version__)"
echo "Testing submodule imports:"
python -c "from nutrient_dws.client import NutrientClient; print('Client import successful')"
python -c "from nutrient_dws.exceptions import NutrientError; print('Exceptions import successful')"
- name: Debug - Check test structure
run: |
echo "Test directory structure:"
find tests -name "*.py" -type f
echo "Test __init__ files:"
find tests -name "__init__.py" -type f
echo "Python path:"
python -c "import sys; print('\n'.join(sys.path))"
- name: Debug - pytest collection dry run
run: |
echo "Running pytest collection only:"
python -m pytest --collect-only -v
continue-on-error: true
- name: Run linting with ruff
run: |
python -m ruff check .
python -m ruff format --check .
- name: Run type checking with mypy
run: python -m mypy src tests
- name: Run basic test without coverage
run: |
echo "Running basic test without any plugins:"
python -m pytest tests/test_basic.py -v -p no:asyncio -p no:cov
continue-on-error: true
- name: Run all tests without coverage
run: |
echo "Running all tests without coverage:"
python -m pytest -v -p no:asyncio
continue-on-error: true
- name: Run tests with pytest (with coverage)
run: python -m pytest -v --cov=nutrient_dws --cov-report=xml --cov-report=term
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
build:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: python -m build
- name: Check package with twine
run: twine check dist/*
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/