| 1 |
name: Code testing |
| 2 |
|
| 3 |
on: [push, pull_request] |
| 4 |
|
| 5 |
jobs: |
| 6 |
Tests: |
| 7 |
|
| 8 |
runs-on: ubuntu-latest |
| 9 |
permissions: |
| 10 |
checks: write |
| 11 |
pull-requests: write |
| 12 |
strategy: |
| 13 |
matrix: |
| 14 |
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] |
| 15 |
|
| 16 |
steps: |
| 17 |
- uses: actions/checkout@v6 |
| 18 |
- name: Set up Python ${{ matrix.python-version }} |
| 19 |
uses: actions/setup-python@v5 |
| 20 |
with: |
| 21 |
python-version: ${{ matrix.python-version }} |
| 22 |
- uses: astral-sh/setup-uv@v7 |
| 23 |
|
| 24 |
- name: Install minimal dependencies |
| 25 |
run: | |
| 26 |
uv venv |
| 27 |
uv pip install -e . |
| 28 |
. .venv/bin/activate |
| 29 |
python -c "import skrf; print(skrf.__version__)" # Test import with minimal dependencies |
| 30 |
|
| 31 |
|
| 32 |
- name: Test the code, tutorials and examples |
| 33 |
if: ${{ always() }} |
| 34 |
run: | |
| 35 |
uv pip install -e .[test,visa,netw,xlsx,plot,docs,testspice] --compile |
| 36 |
. .venv/bin/activate |
| 37 |
python -m pytest -n auto --junitxml=test-results/junit-${{ matrix.python-version }}.xml --junit-prefix=${{ matrix.python-version }} |
| 38 |
|
| 39 |
- name: Upload Test Results |
| 40 |
if: always() |
| 41 |
uses: actions/upload-artifact@v6 |
| 42 |
with: |
| 43 |
name: Test Results (Python ${{ matrix.python-version }}) |
| 44 |
path: test-results/*.xml |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
- name: Upload coverage data to coveralls.io |
| 49 |
continue-on-error: true |
| 50 |
if: ${{ always() }} |
| 51 |
env: |
| 52 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 53 |
COVERALLS_FLAG_NAME: ${{ matrix.test-name }} |
| 54 |
COVERALLS_PARALLEL: true |
| 55 |
run: | |
| 56 |
pip install coveralls |
| 57 |
coveralls --service=github |
| 58 |
|
| 59 |
coveralls: |
| 60 |
name: Indicate completion to coveralls.io (Finish) |
| 61 |
continue-on-error: true |
| 62 |
if: ${{ always() }} |
| 63 |
needs: Tests |
| 64 |
runs-on: ubuntu-latest |
| 65 |
container: python:3-slim |
| 66 |
steps: |
| 67 |
- name: Finished |
| 68 |
run: | |
| 69 |
pip3 install --upgrade coveralls |
| 70 |
coveralls --finish |
| 71 |
env: |
| 72 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 73 |
|
| 74 |
|
| 75 |
publish-test-results: |
| 76 |
name: "Publish Tests Results" |
| 77 |
needs: Tests |
| 78 |
runs-on: ubuntu-latest |
| 79 |
permissions: |
| 80 |
checks: write |
| 81 |
|
| 82 |
|
| 83 |
pull-requests: write |
| 84 |
|
| 85 |
if: always() |
| 86 |
|
| 87 |
steps: |
| 88 |
- name: Download Artifacts |
| 89 |
uses: actions/download-artifact@v6 |
| 90 |
with: |
| 91 |
path: artifacts |
| 92 |
|
| 93 |
- name: Publish Test Results |
| 94 |
uses: EnricoMi/publish-unit-test-result-action@v2 |
| 95 |
with: |
| 96 |
files: "artifacts/**/*.xml" |