marEx 2.0.0__tar.gz → 3.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. marex-3.0.2/.github/workflows/README.md +205 -0
  2. marex-3.0.2/.github/workflows/ci.yml +328 -0
  3. marex-3.0.2/.github/workflows/release.yml +296 -0
  4. marex-3.0.2/.github/workflows/tests.yml.bak +81 -0
  5. marex-3.0.2/.github/workflows/validate.py +156 -0
  6. marex-3.0.2/.readthedocs.yaml +52 -0
  7. marex-3.0.2/CITATION.cff +21 -0
  8. marex-3.0.2/CONTRIBUTING.md +372 -0
  9. marex-3.0.2/MANIFEST.in +35 -0
  10. marex-3.0.2/PKG-INFO +273 -0
  11. marex-3.0.2/README.md +185 -0
  12. marex-3.0.2/examples/gridded data/01_preprocess_extremes.ipynb +2948 -0
  13. {marex-2.0.0 → marex-3.0.2}/examples/gridded data/02_id_track_events.ipynb +528 -520
  14. marex-3.0.2/examples/gridded data/03_visualise_events.ipynb +2317 -0
  15. {marex-2.0.0 → marex-3.0.2}/examples/unstructured data/01_preprocess_extremes.ipynb +109 -93
  16. {marex-2.0.0 → marex-3.0.2}/examples/unstructured data/02_id_track_events.ipynb +63 -48
  17. {marex-2.0.0 → marex-3.0.2}/examples/unstructured data/03_visualise_events.ipynb +86 -64
  18. marex-3.0.2/marEx/__init__.py +128 -0
  19. marex-3.0.2/marEx/_coverage_init.py +71 -0
  20. marex-3.0.2/marEx/_dependencies.py +250 -0
  21. marex-3.0.2/marEx/detect.py +2321 -0
  22. marex-3.0.2/marEx/exceptions.py +494 -0
  23. marex-3.0.2/marEx/helper.py +641 -0
  24. marex-3.0.2/marEx/logging_config.py +548 -0
  25. marex-3.0.2/marEx/plotX/__init__.py +198 -0
  26. marex-3.0.2/marEx/plotX/base.py +626 -0
  27. marex-3.0.2/marEx/plotX/gridded.py +99 -0
  28. marex-3.0.2/marEx/plotX/unstructured.py +225 -0
  29. {marex-2.0.0 → marex-3.0.2}/marEx/track.py +2647 -1425
  30. marex-3.0.2/marEx.egg-info/PKG-INFO +273 -0
  31. marex-3.0.2/marEx.egg-info/SOURCES.txt +49 -0
  32. marex-3.0.2/marEx.egg-info/requires.txt +74 -0
  33. marex-3.0.2/pyproject.toml +250 -0
  34. marex-3.0.2/tests/__init__.py +3 -0
  35. marex-3.0.2/tests/conftest.py +415 -0
  36. marex-3.0.2/tests/coverage_config.py +87 -0
  37. marex-3.0.2/tests/make_test_data.ipynb +2339 -0
  38. marex-3.0.2/tests/test_detect_helpers.py +690 -0
  39. marex-3.0.2/tests/test_error_handling.py +1116 -0
  40. marex-3.0.2/tests/test_exceptions.py +364 -0
  41. marex-3.0.2/tests/test_gridded_preprocessing.py +538 -0
  42. marex-3.0.2/tests/test_gridded_tracking.py +976 -0
  43. marex-3.0.2/tests/test_integration.py +490 -0
  44. marex-3.0.2/tests/test_logging_system.py +896 -0
  45. marex-3.0.2/tests/test_plotx.py +1215 -0
  46. marex-3.0.2/tests/test_track_helpers.py +413 -0
  47. marex-3.0.2/tests/test_unstructured_preprocessing.py +385 -0
  48. marex-3.0.2/tests/test_unstructured_tracking.py +895 -0
  49. marex-2.0.0/.gitignore +0 -9
  50. marex-2.0.0/PKG-INFO +0 -247
  51. marex-2.0.0/README.md +0 -205
  52. marex-2.0.0/examples/gridded data/01_preprocess_extremes.ipynb +0 -912
  53. marex-2.0.0/examples/gridded data/03_visualise_events.ipynb +0 -2253
  54. marex-2.0.0/marEx/__init__.py +0 -78
  55. marex-2.0.0/marEx/detect.py +0 -490
  56. marex-2.0.0/marEx/helper.py +0 -251
  57. marex-2.0.0/marEx/plotX/__init__.py +0 -83
  58. marex-2.0.0/marEx/plotX/base.py +0 -387
  59. marex-2.0.0/marEx/plotX/gridded.py +0 -55
  60. marex-2.0.0/marEx/plotX/unstructured.py +0 -147
  61. marex-2.0.0/marEx.egg-info/PKG-INFO +0 -247
  62. marex-2.0.0/marEx.egg-info/SOURCES.txt +0 -29
  63. marex-2.0.0/marEx.egg-info/requires.txt +0 -29
  64. marex-2.0.0/media/logo.png +0 -0
  65. marex-2.0.0/media/logo_trans.png +0 -0
  66. marex-2.0.0/media/movie_ID_field_basic_gridded.mp4 +0 -0
  67. marex-2.0.0/media/movie_ID_field_gridded.mp4 +0 -0
  68. marex-2.0.0/media/old/movie_ID_field_centroid.mp4 +0 -0
  69. marex-2.0.0/media/old/movie_ID_field_nn.mp4 +0 -0
  70. marex-2.0.0/media/old/movie_ID_field_original.mp4 +0 -0
  71. marex-2.0.0/pyproject.toml +0 -70
  72. {marex-2.0.0 → marex-3.0.2}/marEx.egg-info/dependency_links.txt +0 -0
  73. {marex-2.0.0 → marex-3.0.2}/marEx.egg-info/top_level.txt +0 -0
  74. {marex-2.0.0 → marex-3.0.2}/setup.cfg +0 -0
@@ -0,0 +1,205 @@
1
+ # GitHub Actions Workflows for marEx
2
+
3
+ This directory contains comprehensive GitHub Actions workflows for the marEx package that provide automated testing, code quality checks, performance monitoring, and release management.
4
+
5
+ ## Workflows Overview
6
+
7
+ ### 1. Continuous Integration (`ci.yml`)
8
+
9
+ **Triggers:**
10
+ - Push to `main` and `advanced_preproc` branches
11
+ - Pull requests to `main` branch
12
+
13
+ **Features:**
14
+ - **Multi-platform testing**: Ubuntu, Windows, and macOS
15
+ - **Multi-python testing**: Python 3.10, 3.11, and 3.12
16
+ - **Code quality checks**: Black, isort, flake8, bandit, mypy
17
+ - **Comprehensive test suite**: Unit tests, integration tests, error handling tests
18
+ - **Coverage reporting**: Codecov integration and HTML reports
19
+ - **Notebook validation**: Syntax checking and formatting for example notebooks
20
+ - **Build testing**: Package building and installation verification
21
+ - **Dependency caching**: Pip cache for faster builds
22
+
23
+ **Jobs:**
24
+ 1. `code-quality`: Code formatting, linting, and security checks
25
+ 2. `test`: Main test suite across multiple OS/Python combinations
26
+ 3. `coverage`: Coverage report generation and upload
27
+ 4. `test-notebooks`: Notebook syntax and formatting validation
28
+ 5. `build-test`: Package building and installation testing
29
+ 6. `all-checks-passed`: Final validation of all workflow jobs
30
+
31
+ ### 2. Release Management (`release.yml`)
32
+
33
+ **Triggers:**
34
+ - Push to version tags (e.g., `v1.0.0`, `v2.1.3`)
35
+ - Manual workflow dispatch
36
+
37
+ **Features:**
38
+ - **Version validation**: Semantic version tag validation
39
+ - **Full test suite**: Comprehensive testing before release
40
+ - **Multi-platform build testing**: Verify installation across platforms
41
+ - **PyPI publishing**: Automated package publishing using trusted publishing
42
+ - **GitHub release creation**: Automatic release notes and changelog generation
43
+ - **Prerelease support**: Automatic detection of alpha/beta/rc versions
44
+
45
+ **Jobs:**
46
+ 1. `validate-tag`: Version tag validation and prerelease detection
47
+ 2. `run-tests`: Full test suite execution
48
+ 3. `build`: Source and wheel distribution building
49
+ 4. `test-install`: Installation testing across platforms
50
+ 5. `publish-pypi`: PyPI package publishing
51
+ 6. `create-github-release`: GitHub release creation with changelog
52
+ 7. `announce-release`: Post-release notifications (for stable releases)
53
+
54
+ ### 3. Performance Testing (`performance.yml`)
55
+
56
+ **Triggers:**
57
+ - Push/PR to `main` branch (when performance-related files change)
58
+ - Weekly schedule (Sundays at 2 AM UTC)
59
+ - Manual workflow dispatch
60
+
61
+ **Features:**
62
+ - **Quick performance tests**: Run on all PRs and pushes
63
+ - **Full performance suite**: Comprehensive benchmarking (main branch only)
64
+ - **Performance regression detection**: Automated performance monitoring
65
+ - **Multiple Python versions**: Testing across supported Python versions
66
+ - **Artifact storage**: Performance results stored for historical analysis
67
+
68
+ **Jobs:**
69
+ 1. `performance-tests`: Quick performance tests for PRs
70
+ 2. `full-performance-tests`: Comprehensive benchmarking suite
71
+
72
+ ## Setup Instructions
73
+
74
+ ### Required Secrets
75
+
76
+ For the workflows to function properly, you need to configure the following secrets in your GitHub repository:
77
+
78
+ #### 1. CodeCov Integration (Optional)
79
+ - `CODECOV_TOKEN`: Token for uploading coverage reports to Codecov
80
+ - Go to https://codecov.io/ and connect your repository
81
+ - Copy the repository token and add it as a secret
82
+
83
+ #### 2. PyPI Publishing (Required for releases)
84
+ The release workflow uses PyPI's trusted publishing feature, which is more secure than using API tokens.
85
+
86
+ **Setup Trusted Publishing:**
87
+ 1. Go to https://pypi.org/manage/account/publishing/
88
+ 2. Add a new pending publisher with these details:
89
+ - **PyPI Project Name**: `marEx`
90
+ - **Owner**: `wienkers` (or your GitHub username)
91
+ - **Repository name**: `marEx`
92
+ - **Workflow name**: `release.yml`
93
+ - **Environment name**: `pypi`
94
+
95
+ **Alternative: Using API Token (less secure)**
96
+ If you prefer to use an API token instead:
97
+ 1. Generate a PyPI API token at https://pypi.org/manage/account/token/
98
+ 2. Add it as a repository secret named `PYPI_API_TOKEN`
99
+ 3. Modify the release workflow to use the token instead of trusted publishing
100
+
101
+ ### Environment Configuration
102
+
103
+ The release workflow uses a GitHub environment named `pypi` for additional security. To set this up:
104
+
105
+ 1. Go to your repository settings
106
+ 2. Navigate to "Environments"
107
+ 3. Create a new environment named `pypi`
108
+ 4. (Optional) Configure environment protection rules:
109
+ - Require reviewers for production releases
110
+ - Restrict to specific branches (e.g., `main`)
111
+
112
+ ## Workflow Customization
113
+
114
+ ### Modifying Test Coverage
115
+
116
+ To adjust which tests run in different scenarios, modify the test markers in `ci.yml`:
117
+
118
+ ```yaml
119
+ # Skip slow tests in CI
120
+ pytest tests/ -m "not slow"
121
+
122
+ # Run only integration tests
123
+ pytest tests/ -m "integration"
124
+
125
+ # Run specific test files
126
+ pytest tests/test_gridded_preprocessing.py -v
127
+ ```
128
+
129
+ ### Adding New Platforms
130
+
131
+ To test on additional platforms, add them to the matrix in `ci.yml`:
132
+
133
+ ```yaml
134
+ strategy:
135
+ matrix:
136
+ os: [ubuntu-latest, windows-latest, macos-latest, ubuntu-20.04]
137
+ python-version: ['3.10', '3.11', '3.12']
138
+ ```
139
+
140
+ ### Performance Regression Thresholds
141
+
142
+ Customize performance regression detection by modifying the performance workflow:
143
+
144
+ ```yaml
145
+ - name: Performance regression check
146
+ run: |
147
+ # Add custom logic to compare with baseline performance
148
+ python scripts/check_performance_regression.py
149
+ ```
150
+
151
+ ### Notification Customization
152
+
153
+ Add custom notifications in the release workflow:
154
+
155
+ ```yaml
156
+ - name: Notify Slack
157
+ run: |
158
+ curl -X POST -H 'Content-type: application/json' \
159
+ --data '{"text":"marEx v${{ needs.validate-tag.outputs.version }} released!"}' \
160
+ ${{ secrets.SLACK_WEBHOOK_URL }}
161
+ ```
162
+
163
+ ## Workflow Dependencies
164
+
165
+ The workflows require these system dependencies:
166
+
167
+ **Ubuntu:**
168
+ ```bash
169
+ libhdf5-dev libnetcdf-dev libproj-dev proj-data proj-bin libgeos-dev
170
+ ```
171
+
172
+ **macOS:**
173
+ ```bash
174
+ hdf5 netcdf proj geos
175
+ ```
176
+
177
+ **Windows:**
178
+ Dependencies are handled through pip packages.
179
+
180
+ ## Troubleshooting
181
+
182
+ ### Common Issues
183
+
184
+ 1. **Build failures on Windows**: Ensure all dependencies are properly specified in `pyproject.toml`
185
+ 2. **Coverage upload failures**: Check that `CODECOV_TOKEN` is correctly configured
186
+ 3. **Release workflow failures**: Verify that PyPI trusted publishing is properly configured
187
+ 4. **Performance test timeouts**: Adjust timeout values in the workflow if needed
188
+
189
+ ### Debugging Tips
190
+
191
+ 1. **Check workflow logs**: Go to Actions tab in your repository to view detailed logs
192
+ 2. **Local testing**: Run tests locally with the same commands used in CI
193
+ 3. **Matrix debugging**: Use `strategy.fail-fast: false` to see all platform failures
194
+ 4. **Artifact inspection**: Download artifacts from failed runs to analyze results
195
+
196
+ ## Contributing
197
+
198
+ When contributing to marEx, please ensure that:
199
+
200
+ 1. Your changes pass all CI checks
201
+ 2. New features include appropriate tests
202
+ 3. Documentation is updated if needed
203
+ 4. Performance-critical changes include performance tests
204
+
205
+ The workflows will automatically run on your pull requests and provide feedback on code quality, test coverage, and performance impact.
@@ -0,0 +1,328 @@
1
+ name: Continuous Integration
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, advanced_preproc ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ concurrency:
10
+ group: ${{ github.workflow }}-${{ github.ref }}
11
+ cancel-in-progress: true
12
+
13
+ jobs:
14
+ code-quality:
15
+ name: Code Quality Checks
16
+ runs-on: ubuntu-latest
17
+
18
+ steps:
19
+ - name: Checkout code
20
+ uses: actions/checkout@v4
21
+
22
+ - name: Set up Python
23
+ uses: actions/setup-python@v5
24
+ with:
25
+ python-version: '3.11'
26
+ cache: 'pip'
27
+ cache-dependency-path: 'pyproject.toml'
28
+
29
+ - name: Install dependencies
30
+ run: |
31
+ python -m pip install --upgrade pip
32
+ pip install -e ".[dev]"
33
+
34
+ - name: Check code formatting with Black
35
+ run: |
36
+ black --check --diff marEx/
37
+
38
+ - name: Check import sorting with isort
39
+ run: |
40
+ isort --check-only --diff marEx/
41
+
42
+ - name: Lint with flake8
43
+ run: |
44
+ flake8 marEx/
45
+
46
+ - name: Security check with bandit
47
+ run: |
48
+ bandit -r marEx/ -f json -o bandit-report.json || true
49
+
50
+ - name: Type checking with mypy
51
+ run: |
52
+ mypy marEx/ || true
53
+
54
+ - name: Upload bandit report
55
+ if: always()
56
+ uses: actions/upload-artifact@v4
57
+ with:
58
+ name: bandit-report
59
+ path: bandit-report.json
60
+ retention-days: 7
61
+
62
+ test:
63
+ name: Test Suite
64
+ runs-on: ${{ matrix.os }}
65
+ needs: code-quality
66
+ strategy:
67
+ fail-fast: false
68
+ matrix:
69
+ os: [ubuntu-latest, windows-latest, macos-latest]
70
+ python-version: ['3.10', '3.11', '3.12']
71
+ exclude:
72
+ # Reduce matrix size for faster CI
73
+ - os: windows-latest
74
+ python-version: '3.10'
75
+ - os: macos-latest
76
+ python-version: '3.10'
77
+
78
+ steps:
79
+ - name: Checkout code
80
+ uses: actions/checkout@v4
81
+
82
+ - name: Set up Python ${{ matrix.python-version }}
83
+ uses: actions/setup-python@v5
84
+ with:
85
+ python-version: ${{ matrix.python-version }}
86
+ cache: 'pip'
87
+ cache-dependency-path: 'pyproject.toml'
88
+
89
+ - name: Install system dependencies (Ubuntu)
90
+ if: matrix.os == 'ubuntu-latest'
91
+ run: |
92
+ sudo apt-get update
93
+ sudo apt-get install -y libhdf5-dev libnetcdf-dev libproj-dev proj-data proj-bin libgeos-dev
94
+
95
+ - name: Install system dependencies (macOS)
96
+ if: matrix.os == 'macos-latest'
97
+ run: |
98
+ brew install hdf5 netcdf proj geos
99
+
100
+ - name: Install system dependencies (Windows)
101
+ if: matrix.os == 'windows-latest'
102
+ run: |
103
+ # Windows dependencies are handled by conda-forge packages
104
+ echo "Windows dependencies handled by pip packages"
105
+
106
+ - name: Install Python dependencies
107
+ run: |
108
+ python -m pip install --upgrade pip
109
+ pip install -e ".[dev,full]"
110
+
111
+ - name: Configure Dask for CI
112
+ run: |
113
+ mkdir -p ~/.dask
114
+ echo "distributed:" > ~/.dask/config.yaml
115
+ echo " worker:" >> ~/.dask/config.yaml
116
+ echo " memory:" >> ~/.dask/config.yaml
117
+ echo " target: 0.8" >> ~/.dask/config.yaml
118
+ echo " spill: 0.9" >> ~/.dask/config.yaml
119
+ echo " pause: 0.95" >> ~/.dask/config.yaml
120
+ echo " terminate: 0.98" >> ~/.dask/config.yaml
121
+ echo " admin:" >> ~/.dask/config.yaml
122
+ echo " log-format: '%(name)s - %(levelname)s - %(message)s'" >> ~/.dask/config.yaml
123
+ echo "array:" >> ~/.dask/config.yaml
124
+ echo " chunk-size: 64MiB" >> ~/.dask/config.yaml
125
+
126
+ - name: List installed packages
127
+ run: pip list
128
+
129
+ - name: Run unit tests
130
+ run: |
131
+ pytest tests/test_detect_helpers.py tests/test_track_helpers.py -v --tb=short
132
+
133
+ - name: Run error handling tests
134
+ run: |
135
+ pytest tests/test_error_handling.py -v --tb=short
136
+
137
+ - name: Run exception tests
138
+ run: |
139
+ pytest tests/test_exceptions.py -v --tb=short
140
+
141
+ - name: Run logging system tests
142
+ run: |
143
+ pytest tests/test_logging_system.py -v --tb=short
144
+
145
+ - name: Run preprocessing tests (gridded)
146
+ run: |
147
+ pytest tests/test_gridded_preprocessing.py -v --tb=short
148
+
149
+ - name: Run preprocessing tests (unstructured)
150
+ run: |
151
+ pytest tests/test_unstructured_preprocessing.py -v --tb=short
152
+
153
+ - name: Run tracking tests (gridded)
154
+ run: |
155
+ pytest tests/test_gridded_tracking.py -v --tb=short
156
+
157
+ - name: Run tracking tests (unstructured)
158
+ run: |
159
+ pytest tests/test_unstructured_tracking.py -v --tb=short
160
+
161
+ - name: Run plotting tests
162
+ run: |
163
+ pytest tests/test_plotx.py -v --tb=short
164
+
165
+ - name: Run integration tests
166
+ run: |
167
+ pytest tests/test_integration.py -v --tb=short -m "not slow"
168
+
169
+ coverage:
170
+ name: Coverage Report
171
+ runs-on: ubuntu-latest
172
+ needs: test
173
+ if: always()
174
+ timeout-minutes: 60
175
+
176
+ steps:
177
+ - name: Checkout code
178
+ uses: actions/checkout@v4
179
+
180
+ - name: Set up Python
181
+ uses: actions/setup-python@v5
182
+ with:
183
+ python-version: '3.11'
184
+ cache: 'pip'
185
+ cache-dependency-path: 'pyproject.toml'
186
+
187
+ - name: Install system dependencies
188
+ run: |
189
+ sudo apt-get update
190
+ sudo apt-get install -y libhdf5-dev libnetcdf-dev libproj-dev proj-data proj-bin libgeos-dev
191
+
192
+ - name: Install dependencies
193
+ run: |
194
+ python -m pip install --upgrade pip
195
+ pip install -e ".[dev,full]"
196
+
197
+ - name: Configure Dask for Coverage (Conservative)
198
+ run: |
199
+ mkdir -p ~/.dask
200
+ echo "distributed:" > ~/.dask/config.yaml
201
+ echo " worker:" >> ~/.dask/config.yaml
202
+ echo " memory:" >> ~/.dask/config.yaml
203
+ echo " target: 0.5" >> ~/.dask/config.yaml
204
+ echo " spill: 0.6" >> ~/.dask/config.yaml
205
+ echo " pause: 0.7" >> ~/.dask/config.yaml
206
+ echo " terminate: 0.8" >> ~/.dask/config.yaml
207
+ echo " recent-to-old-time: 15s" >> ~/.dask/config.yaml
208
+ echo " daemon: false" >> ~/.dask/config.yaml
209
+ echo " scheduler:" >> ~/.dask/config.yaml
210
+ echo " allowed-failures: 100" >> ~/.dask/config.yaml
211
+ echo " work-stealing: false" >> ~/.dask/config.yaml
212
+ echo " worker-ttl: 600s" >> ~/.dask/config.yaml
213
+ echo " comm:" >> ~/.dask/config.yaml
214
+ echo " timeouts:" >> ~/.dask/config.yaml
215
+ echo " connect: 600s" >> ~/.dask/config.yaml
216
+ echo " tcp: 600s" >> ~/.dask/config.yaml
217
+ echo " retry:" >> ~/.dask/config.yaml
218
+ echo " count: 20" >> ~/.dask/config.yaml
219
+ echo " delay:" >> ~/.dask/config.yaml
220
+ echo " min: 3s" >> ~/.dask/config.yaml
221
+ echo " max: 60s" >> ~/.dask/config.yaml
222
+ echo " admin:" >> ~/.dask/config.yaml
223
+ echo " log-format: '%(name)s - %(levelname)s - %(message)s'" >> ~/.dask/config.yaml
224
+ echo "array:" >> ~/.dask/config.yaml
225
+ echo " chunk-size: 24MiB" >> ~/.dask/config.yaml
226
+ echo " slicing:" >> ~/.dask/config.yaml
227
+ echo " split-large-chunks: false" >> ~/.dask/config.yaml
228
+
229
+ - name: Set environment for conservative execution
230
+ run: |
231
+ echo "DASK_NUM_WORKERS=1" >> $GITHUB_ENV
232
+ echo "OMP_NUM_THREADS=1" >> $GITHUB_ENV
233
+ echo "MKL_NUM_THREADS=1" >> $GITHUB_ENV
234
+ echo "NUMBA_NUM_THREADS=1" >> $GITHUB_ENV
235
+ echo "PYTHONHASHSEED=42" >> $GITHUB_ENV
236
+ echo "PYTEST_COVERAGE=true" >> $GITHUB_ENV
237
+
238
+ - name: Generate coverage report
239
+ timeout-minutes: 45
240
+ run: |
241
+ # Run with parallel mode and multiprocessing support
242
+ coverage run --parallel-mode --rcfile=.coveragerc -m pytest tests/ --tb=short -m "not nocov" -x --maxfail=3
243
+ # Combine all coverage data files from subprocesses
244
+ coverage combine
245
+ coverage report -m
246
+ coverage html
247
+ coverage xml
248
+
249
+ - name: Upload coverage to Codecov
250
+ uses: codecov/codecov-action@v4
251
+ with:
252
+ token: ${{ secrets.CODECOV_TOKEN }}
253
+ files: ./coverage.xml
254
+ fail_ci_if_error: false
255
+ verbose: true
256
+
257
+ - name: Upload coverage HTML report
258
+ uses: actions/upload-artifact@v4
259
+ with:
260
+ name: coverage-report
261
+ path: htmlcov/
262
+ retention-days: 90
263
+
264
+
265
+ build-test:
266
+ name: Build and Test Package
267
+ runs-on: ubuntu-latest
268
+ needs: test
269
+
270
+ steps:
271
+ - name: Checkout code
272
+ uses: actions/checkout@v4
273
+
274
+ - name: Set up Python
275
+ uses: actions/setup-python@v5
276
+ with:
277
+ python-version: '3.11'
278
+ cache: 'pip'
279
+ cache-dependency-path: 'pyproject.toml'
280
+
281
+ - name: Install build dependencies
282
+ run: |
283
+ python -m pip install --upgrade pip
284
+ pip install build twine
285
+
286
+ - name: Build package
287
+ run: |
288
+ python -m build
289
+
290
+ - name: Check package integrity
291
+ run: |
292
+ twine check dist/*
293
+
294
+ - name: Test package installation
295
+ shell: bash
296
+ run: |
297
+ pip install dist/*.whl
298
+ python -c "import marEx; print(f'marEx version: {marEx.__version__}')"
299
+
300
+ - name: Upload build artifacts
301
+ uses: actions/upload-artifact@v4
302
+ with:
303
+ name: dist-packages
304
+ path: dist/
305
+ retention-days: 7
306
+
307
+ all-checks-passed:
308
+ name: All Checks Passed
309
+ runs-on: ubuntu-latest
310
+ needs: [code-quality, test, coverage, build-test]
311
+ if: always()
312
+
313
+ steps:
314
+ - name: Check all jobs status
315
+ run: |
316
+ if [[ "${{ needs.code-quality.result }}" == "success" &&
317
+ "${{ needs.test.result }}" == "success" &&
318
+ "${{ needs.coverage.result }}" == "success" &&
319
+ "${{ needs.build-test.result }}" == "success" ]]; then
320
+ echo "All checks passed!"
321
+ else
322
+ echo "Some checks failed:"
323
+ echo "Code Quality: ${{ needs.code-quality.result }}"
324
+ echo "Tests: ${{ needs.test.result }}"
325
+ echo "Coverage: ${{ needs.coverage.result }}"
326
+ echo "Build Test: ${{ needs.build-test.result }}"
327
+ exit 1
328
+ fi