Dependency maintenance (drop Py3.8, add Py3.11/3.12/3.13, update numpy/pandas to 2.0) #4955
This file contains hidden or 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
| # This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
| # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
| name: Run tests on all platforms | |
| on: | |
| # Trigger the workflow on push but only for the master branch | |
| push: | |
| branches: | |
| - master | |
| paths-ignore: | |
| - '**.md' | |
| - '**.rst' | |
| - '**.bib' | |
| - '.github/**' | |
| - '!.github/workflows/run_tests.yml' | |
| - 'dev/**' | |
| - 'docs/**' | |
| - 'images/**' | |
| - '.gitignore' | |
| - '.pre-commit-config.yaml' | |
| - '.readthedocs.yml' | |
| # Trigger the workflow on pull requests, but reveal no secrets, do not use pull_request_target, see: | |
| # https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request_target | |
| pull_request: | |
| paths-ignore: | |
| - '**.md' | |
| - '**.rst' | |
| - '**.bib' | |
| - '.github/**' | |
| - '!.github/workflows/run_tests.yml' | |
| - 'dev/**' | |
| - 'docs/**' | |
| - 'images/**' | |
| - '.gitignore' | |
| - '.pre-commit-config.yaml' | |
| - '.readthedocs.yml' | |
| env: | |
| # Even when given -y, apt will still sometimes hang at a prompt if a package | |
| # has clarifications to ask; DEBIAN_FRONTEND=noninteractive prevents that, | |
| # This will be defined for non-debian platforms below too, but there's no harm in that. | |
| # (TravisCI quietly defined this on all their platforms, but we have to give it manually on GithubCI.) | |
| DEBIAN_FRONTEND: 'noninteractive' | |
| HDF5_USE_FILE_LOCKING: 'FALSE' | |
| # Skip to the headless matplotlib renderer, which is less | |
| # bug-prone in the constrained environment of CI | |
| # Tip from a matplotlib dev: https://github.com/spinalcordtoolbox/spinalcordtoolbox/issues/3388#issuecomment-846091012 | |
| # Ref: https://matplotlib.org/stable/users/explain/backends.html | |
| MPLBACKEND: 'Agg' | |
| jobs: | |
| ultra_matrix_test: | |
| name: Matrix Test of Python ${{ matrix.python-version }} on ${{ matrix.os }} | |
| # Default shell for ALL subsequent steps. | |
| defaults: | |
| run: | |
| shell: bash | |
| # Defining matrix for OS and Python | |
| strategy: | |
| # Ensure exhaustive testing of all scenarios to gather maximum amount of information | |
| fail-fast: false | |
| matrix: | |
| os: [ "macos-latest", "windows-latest", "ubuntu-latest" ] | |
| python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13' ] | |
| test-name: | |
| - integration-test | |
| # Matrix driven OS | |
| runs-on: ${{ matrix.os }} | |
| # Main steps for the test to be reproduced across OS x Python | |
| steps: | |
| # Step 0: Checkout code. | |
| - uses: actions/checkout@v3 | |
| # Step 1: Setup python version | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # Step 2: Install dependencies | |
| - name: Install ivadomed | |
| run: | | |
| pip install -e .[dev] | |
| # Step 3: List installed packages | |
| - name: List installed packages | |
| run: | | |
| pip list | |
| # Step 4: Lint. | |
| - name: Lint with flake8 | |
| run: | | |
| # stop the build if there are Python syntax errors or undefined names | |
| #flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
| # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
| flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
| # Step 5: Full Pytest | |
| - name: Test with pytest | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| COVERALLS_FLAG_NAME: ${{ matrix.test-name }} | |
| COVERALLS_PARALLEL: true | |
| run: | | |
| pytest . -v --cov ivadomed/ --cov-report term-missing | |
| coveralls --service=github | |
| # This step is MANDATORY and used to indicate matrix completion to coveralls.io | |
| # See here: https://coveralls-python.readthedocs.io/en/latest/usage/configuration.html#github-actions-support | |
| coveralls: | |
| needs: ultra_matrix_test | |
| runs-on: ubuntu-latest | |
| container: python:3-slim | |
| steps: | |
| - name: Finished | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| pip3 install --upgrade coveralls | |
| coveralls --finish | |