|
| 1 | +name: Tests |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + test: |
| 7 | + name: (${{ matrix.os }}, Py${{ matrix.python-version }}, sk${{ matrix.scikit-learn }}, sk-only:${{ matrix.sklearn-only }}) |
| 8 | + runs-on: ${{ matrix.os }} |
| 9 | + strategy: |
| 10 | + matrix: |
| 11 | + python-version: [3.7, 3.8] |
| 12 | + scikit-learn: [0.21.2, 0.22.2, 0.23.1, 0.24] |
| 13 | + os: [ubuntu-latest] |
| 14 | + sklearn-only: ['true'] |
| 15 | + exclude: # no scikit-learn 0.21.2 release for Python 3.8 |
| 16 | + - python-version: 3.8 |
| 17 | + scikit-learn: 0.21.2 |
| 18 | + include: |
| 19 | + - python-version: 3.6 |
| 20 | + scikit-learn: 0.18.2 |
| 21 | + scipy: 1.2.0 |
| 22 | + os: ubuntu-20.04 |
| 23 | + sklearn-only: 'true' |
| 24 | + - python-version: 3.6 |
| 25 | + scikit-learn: 0.19.2 |
| 26 | + os: ubuntu-20.04 |
| 27 | + sklearn-only: 'true' |
| 28 | + - python-version: 3.6 |
| 29 | + scikit-learn: 0.20.2 |
| 30 | + os: ubuntu-20.04 |
| 31 | + sklearn-only: 'true' |
| 32 | + - python-version: 3.6 |
| 33 | + scikit-learn: 0.21.2 |
| 34 | + os: ubuntu-20.04 |
| 35 | + sklearn-only: 'true' |
| 36 | + - python-version: 3.6 |
| 37 | + scikit-learn: 0.22.2 |
| 38 | + os: ubuntu-20.04 |
| 39 | + sklearn-only: 'true' |
| 40 | + - python-version: 3.6 |
| 41 | + scikit-learn: 0.23.1 |
| 42 | + os: ubuntu-20.04 |
| 43 | + sklearn-only: 'true' |
| 44 | + - python-version: 3.6 |
| 45 | + scikit-learn: 0.24 |
| 46 | + os: ubuntu-20.04 |
| 47 | + sklearn-only: 'true' |
| 48 | + - python-version: 3.8 |
| 49 | + scikit-learn: 0.23.1 |
| 50 | + code-cov: true |
| 51 | + sklearn-only: 'false' |
| 52 | + os: ubuntu-latest |
| 53 | + - os: windows-latest |
| 54 | + sklearn-only: 'false' |
| 55 | + scikit-learn: 0.24.* |
| 56 | + fail-fast: false |
| 57 | + max-parallel: 4 |
| 58 | + |
| 59 | + steps: |
| 60 | + - uses: actions/checkout@v3 |
| 61 | + with: |
| 62 | + fetch-depth: 2 |
| 63 | + - name: Setup Python ${{ matrix.python-version }} |
| 64 | + if: matrix.os != 'windows-latest' # windows-latest only uses preinstalled Python (3.7.9) |
| 65 | + uses: actions/setup-python@v4 |
| 66 | + with: |
| 67 | + python-version: ${{ matrix.python-version }} |
| 68 | + - name: Install test dependencies |
| 69 | + run: | |
| 70 | + python -m pip install --upgrade pip |
| 71 | + pip install -e .[test] |
| 72 | + - name: Install scikit-learn ${{ matrix.scikit-learn }} |
| 73 | + run: | |
| 74 | + pip install scikit-learn==${{ matrix.scikit-learn }} |
| 75 | + - name: Install numpy for Python 3.8 |
| 76 | + # Python 3.8 & scikit-learn<0.24 requires numpy<=1.23.5 |
| 77 | + if: ${{ matrix.python-version == '3.8' && contains(fromJSON('["0.23.1", "0.22.2", "0.21.2"]'), matrix.scikit-learn) }} |
| 78 | + run: | |
| 79 | + pip install numpy==1.23.5 |
| 80 | + - name: Install scipy ${{ matrix.scipy }} |
| 81 | + if: ${{ matrix.scipy }} |
| 82 | + run: | |
| 83 | + pip install scipy==${{ matrix.scipy }} |
| 84 | + - name: Store repository status |
| 85 | + id: status-before |
| 86 | + run: | |
| 87 | + echo "::set-output name=BEFORE::$(git status --porcelain -b)" |
| 88 | + - name: Run tests on Ubuntu |
| 89 | + if: matrix.os == 'ubuntu-latest' |
| 90 | + run: | |
| 91 | + if [ ${{ matrix.code-cov }} ]; then codecov='--cov=openml --long --cov-report=xml'; fi |
| 92 | + # Most of the time, running only the scikit-learn tests is sufficient |
| 93 | + if [ ${{ matrix.sklearn-only }} = 'true' ]; then sklearn='-m sklearn'; fi |
| 94 | + echo pytest -n 4 --durations=20 --timeout=600 --timeout-method=thread --dist load -sv $codecov $sklearn --reruns 5 --reruns-delay 1 -o log_cli=true |
| 95 | + pytest -n 4 --durations=20 --timeout=600 --timeout-method=thread --dist load -sv $codecov $sklearn --reruns 5 --reruns-delay 1 -o log_cli=true |
| 96 | + - name: Run tests on Windows |
| 97 | + if: matrix.os == 'windows-latest' |
| 98 | + run: | # we need a separate step because of the bash-specific if-statement in the previous one. |
| 99 | + pytest -n 4 --durations=20 --timeout=600 --timeout-method=thread --dist load -sv --reruns 5 --reruns-delay 1 |
| 100 | + - name: Check for files left behind by test |
| 101 | + if: matrix.os != 'windows-latest' && always() |
| 102 | + run: | |
| 103 | + before="${{ steps.status-before.outputs.BEFORE }}" |
| 104 | + after="$(git status --porcelain -b)" |
| 105 | + if [[ "$before" != "$after" ]]; then |
| 106 | + echo "git status from before: $before" |
| 107 | + echo "git status from after: $after" |
| 108 | + echo "Not all generated files have been deleted!" |
| 109 | + exit 1 |
| 110 | + fi |
| 111 | + - name: Upload coverage |
| 112 | + if: matrix.code-cov && always() |
| 113 | + uses: codecov/codecov-action@v3 |
| 114 | + with: |
| 115 | + files: coverage.xml |
| 116 | + fail_ci_if_error: true |
| 117 | + verbose: true |
0 commit comments