|
| 1 | +# Multi-platform CI workflow for Software X publication requirements |
| 2 | +# Tests on Windows, Linux, and macOS with smoke tests |
| 3 | + |
| 4 | +name: Multi-Platform Tests |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - "main" |
| 10 | + - "develop" |
| 11 | + - "feature/**" |
| 12 | + pull_request: |
| 13 | + branches: [ "main" ] |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | + |
| 18 | +jobs: |
| 19 | + test: |
| 20 | + name: Test on ${{ matrix.os }} with Python ${{ matrix.python-version }} |
| 21 | + runs-on: ${{ matrix.os }} |
| 22 | + strategy: |
| 23 | + fail-fast: false |
| 24 | + matrix: |
| 25 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 26 | + python-version: ["3.10", "3.11", "3.12"] |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Checkout code |
| 30 | + uses: actions/checkout@v4 |
| 31 | + |
| 32 | + - name: Install uv |
| 33 | + uses: astral-sh/setup-uv@v4 |
| 34 | + with: |
| 35 | + version: "latest" |
| 36 | + |
| 37 | + - name: Set up Python ${{ matrix.python-version }} |
| 38 | + uses: actions/setup-python@v5 |
| 39 | + with: |
| 40 | + python-version: ${{ matrix.python-version }} |
| 41 | + |
| 42 | + - name: Install dependencies |
| 43 | + run: | |
| 44 | + uv pip install --system -e .[test,html] |
| 45 | +
|
| 46 | + - name: Run unit tests with coverage |
| 47 | + run: | |
| 48 | + coverage run -m unittest discover tests |
| 49 | + coverage report |
| 50 | + coverage xml |
| 51 | +
|
| 52 | + - name: Upload coverage to artifact |
| 53 | + uses: actions/upload-artifact@v4 |
| 54 | + if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' |
| 55 | + with: |
| 56 | + name: coverage-report |
| 57 | + path: coverage.xml |
| 58 | + |
| 59 | + smoke-tests: |
| 60 | + name: Smoke Tests on ${{ matrix.os }} |
| 61 | + runs-on: ${{ matrix.os }} |
| 62 | + strategy: |
| 63 | + fail-fast: false |
| 64 | + matrix: |
| 65 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 66 | + |
| 67 | + steps: |
| 68 | + - name: Checkout code |
| 69 | + uses: actions/checkout@v4 |
| 70 | + |
| 71 | + - name: Install uv |
| 72 | + uses: astral-sh/setup-uv@v4 |
| 73 | + with: |
| 74 | + version: "latest" |
| 75 | + |
| 76 | + - name: Set up Python |
| 77 | + uses: actions/setup-python@v5 |
| 78 | + with: |
| 79 | + python-version: "3.10" |
| 80 | + |
| 81 | + - name: Install SAES |
| 82 | + run: | |
| 83 | + uv pip install --system -e .[test] |
| 84 | +
|
| 85 | + - name: Smoke test - Import package |
| 86 | + run: | |
| 87 | + python -c "import SAES; print('SAES version:', SAES.__version__)" |
| 88 | +
|
| 89 | + - name: Smoke test - Command line help |
| 90 | + run: | |
| 91 | + python -m SAES -h |
| 92 | +
|
| 93 | + - name: Smoke test - LaTeX table generation (Unix) |
| 94 | + if: runner.os != 'Windows' |
| 95 | + run: | |
| 96 | + python -m SAES -ls -ds tests/test_data/swarmIntelligence.csv -ms tests/test_data/multiobjectiveMetrics.csv -m HV -s mean_median -op /tmp/test_output.tex |
| 97 | +
|
| 98 | + - name: Smoke test - LaTeX table generation (Windows) |
| 99 | + if: runner.os == 'Windows' |
| 100 | + shell: pwsh |
| 101 | + run: | |
| 102 | + python -m SAES -ls -ds tests/test_data/swarmIntelligence.csv -ms tests/test_data/multiobjectiveMetrics.csv -m HV -s mean_median -op $env:TEMP/test_output.tex |
| 103 | +
|
| 104 | + - name: Smoke test - Boxplot generation (Unix) |
| 105 | + if: runner.os != 'Windows' |
| 106 | + run: | |
| 107 | + python -m SAES -bp -ds tests/test_data/swarmIntelligence.csv -ms tests/test_data/multiobjectiveMetrics.csv -m HV -i DTLZ1 -op /tmp/test_boxplot.png |
| 108 | +
|
| 109 | + - name: Smoke test - Boxplot generation (Windows) |
| 110 | + if: runner.os == 'Windows' |
| 111 | + shell: pwsh |
| 112 | + run: | |
| 113 | + python -m SAES -bp -ds tests/test_data/swarmIntelligence.csv -ms tests/test_data/multiobjectiveMetrics.csv -m HV -i DTLZ1 -op $env:TEMP/test_boxplot.png |
| 114 | +
|
| 115 | + - name: Smoke test - Critical distance plot (Unix) |
| 116 | + if: runner.os != 'Windows' |
| 117 | + run: | |
| 118 | + python -m SAES -cdp -ds tests/test_data/swarmIntelligence.csv -ms tests/test_data/multiobjectiveMetrics.csv -m HV -op /tmp/test_cdplot.png |
| 119 | +
|
| 120 | + - name: Smoke test - Critical distance plot (Windows) |
| 121 | + if: runner.os == 'Windows' |
| 122 | + shell: pwsh |
| 123 | + run: | |
| 124 | + python -m SAES -cdp -ds tests/test_data/swarmIntelligence.csv -ms tests/test_data/multiobjectiveMetrics.csv -m HV -op $env:TEMP/test_cdplot.png |
| 125 | +
|
| 126 | + - name: Smoke test - Statistical tests with seed (reproducibility) |
| 127 | + run: | |
| 128 | + python -c " |
| 129 | + from SAES.statistical_tests.bayesian import bayesian_sign_test |
| 130 | + import pandas as pd |
| 131 | + import numpy as np |
| 132 | + |
| 133 | + data = pd.DataFrame({ |
| 134 | + 'Algorithm_A': [0.9, 0.85, 0.95, 0.9, 0.92], |
| 135 | + 'Algorithm_B': [0.5, 0.6, 0.55, 0.58, 0.52] |
| 136 | + }) |
| 137 | + |
| 138 | + # Test reproducibility with seed |
| 139 | + result1, _ = bayesian_sign_test(data, sample_size=1000, seed=42) |
| 140 | + result2, _ = bayesian_sign_test(data, sample_size=1000, seed=42) |
| 141 | + |
| 142 | + np.testing.assert_array_almost_equal(result1, result2, decimal=10) |
| 143 | + print('✓ Reproducibility test passed: Results are identical with seed=42') |
| 144 | + " |
| 145 | +
|
| 146 | + - name: Smoke test - Histoplot with seed (reproducibility) |
| 147 | + run: | |
| 148 | + python -c " |
| 149 | + from SAES.plots.histoplot import HistoPlot |
| 150 | + import pandas as pd |
| 151 | + |
| 152 | + data = pd.read_csv('tests/test_data/swarmIntelligence.csv') |
| 153 | + metrics = pd.read_csv('tests/test_data/multiobjectiveMetrics.csv') |
| 154 | + |
| 155 | + # Test that histoplot can be initialized with seed |
| 156 | + histoplot = HistoPlot(data, metrics, 'HV', seed=42) |
| 157 | + print('✓ HistoPlot initialization with seed successful') |
| 158 | + " |
| 159 | +
|
0 commit comments