Fix unit test. #329
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Code testing | |
on: [push, pull_request] | |
jobs: | |
Tests: | |
runs-on: ubuntu-latest | |
permissions: | |
checks: write | |
pull-requests: write | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: yezz123/setup-uv@v4 | |
- name: Install minimal dependencies | |
run: | | |
uv venv | |
uv pip install -e . | |
. .venv/bin/activate | |
python -c "import skrf; print(skrf.__version__)" # Test import with minimal dependencies | |
# run the tests located in skrf/ | |
- name: Test the code, tutorials and examples | |
if: ${{ always() }} | |
run: | | |
uv pip install -e .[test,visa,netw,xlsx,plot,docs,testspice] --compile | |
. .venv/bin/activate | |
python -m pytest -n auto --junitxml=test-results/junit-${{ matrix.python-version }}.xml --junit-prefix=${{ matrix.python-version }} | |
- name: Upload Test Results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Test Results (Python ${{ matrix.python-version }}) | |
path: test-results/*.xml | |
# Upload coverage data to coveralls.io | |
- name: Upload coverage data to coveralls.io | |
continue-on-error: true | |
if: ${{ always() }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_FLAG_NAME: ${{ matrix.test-name }} | |
COVERALLS_PARALLEL: true | |
run: | | |
pip install coveralls | |
coveralls --service=github | |
coveralls: | |
name: Indicate completion to coveralls.io (Finish) | |
continue-on-error: true | |
if: ${{ always() }} | |
needs: Tests | |
runs-on: ubuntu-latest | |
container: python:3-slim | |
steps: | |
- name: Finished | |
run: | | |
pip3 install --upgrade coveralls | |
coveralls --finish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish-test-results: | |
name: "Publish Tests Results" | |
needs: Tests | |
runs-on: ubuntu-latest | |
permissions: | |
checks: write | |
# only needed unless run with comment_mode: off | |
pull-requests: write | |
if: always() | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
with: | |
files: "artifacts/**/*.xml" |