diff --git a/.ci-ignore b/.ci-ignore index e9eda387..af48dbd7 100644 --- a/.ci-ignore +++ b/.ci-ignore @@ -2,6 +2,5 @@ docs setup.py .pre-commit-config.yaml -.travis.yml readthedocs.yml tests diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..eb6fff60 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,100 @@ +name: CI + +on: [push, pull_request] + +jobs: + + build: + runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.experimental }} + strategy: + matrix: + os: [windows-latest, macOS-latest, ubuntu-latest] + python-version: [3.6, 3.7] + experimental: [false] + include: + - os: windows-latest + python-version: 3.8 + experimental: true + - os: macOS-latest + python-version: 3.8 + experimental: false + - os: ubuntu-latest + python-version: 3.8 + experimental: false + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install openslide + id: system-dependencies + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + sudo apt install openslide-tools + elif [ "$RUNNER_OS" == "macOS" ]; then + brew install openslide + elif [ "$RUNNER_OS" == "Windows" ]; then + choco install wget + choco install 7zip-zstd + wget https://github.com/openslide/openslide-winbuild/releases/download/v20171122/openslide-win64-20171122.zip -P /c/downloads + 7z e /c/downloads/openslide-win64-20171122.zip -aoa + export "PATH=C:/downloads/openslide-win64-20171122/bin:$PATH" + else + echo "$RUNNER_OS not supported" + exit 1 + fi + shell: bash + - name: Install dependencies + id: python-dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -e .[testing] + python -m pip install flake8 + python -m pip install pooch + - name: Lint with flake8 + id: flake8 + run: | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics + - name: Test with pytest + id: tests + run: | + python -m pytest --ignore=tests/benchmarks + - name: Slack Notification + uses: act10ns/slack@v1 + with: + status: ${{ job.status }} + steps: ${{ toJson(steps) }} + if: failure() + + coveralls: + needs: build + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.7 + uses: actions/setup-python@v2 + with: + python-version: 3.7 + - name: Install openslide + run: sudo apt install openslide-tools + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -e .[testing] + python -m pip install flake8 + python -m pip install pooch + - name: Test with pytest + run: python -m pytest --ignore=tests/benchmarks --cov=histolab + - name: Coveralls + run: coveralls + + + + + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 92f3515a..00000000 --- a/.travis.yml +++ /dev/null @@ -1,100 +0,0 @@ -# Wire up travis - -language: python # this works for Linux but is an error on macOS or Windows -env: - - CAN_FAIL=false -jobs: - include: - - name: "Python 3.6 on Xenial Linux" - python: 3.6 # this works for Linux but is ignored on macOS or Windows - - name: "Python 3.7 on Xenial Linux" - python: 3.7 # this works for Linux but is ignored on macOS or Windows - - name: "Python 3.8 on Xenial Linux" - python: 3.8 # this works for Linux but is ignored on macOS or Windows - - name: "Python 3.6.8 on macOS" - os: osx - osx_image: xcode10.2 - language: shell # 'language: python' is an error on Travis CI macOS - before_install: - - brew install openslide - - export PATH=/Users/travis/.pyenv/shims:$PATH PYENV_VERSION=3.6.8 - - CFLAGS="-I$(xcrun --show-sdk-path)/usr/include" pyenv install $PYENV_VERSION - env: CAN_FAIL=true - - name: "Python 3.7.6 on macOS" - os: osx - osx_image: xcode10.2 - language: shell # 'language: python' is an error on Travis CI macOS - before_install: - - brew install openslide - - export PATH=/Users/travis/.pyenv/shims:$PATH PYENV_VERSION=3.7.6 - - travis_wait brew upgrade pyenv && pyenv install $PYENV_VERSION - - name: "Python 3.8.1 on macOS" - os: osx - osx_image: xcode10.2 - language: shell # 'language: python' is an error on Travis CI macOS - before_install: - - brew install openslide - - export PATH=/Users/travis/.pyenv/shims:$PATH PYENV_VERSION=3.8.1 - - travis_wait brew upgrade pyenv && pyenv install $PYENV_VERSION - - name: "Python 3.6.8 on Windows" - os: windows # Windows 10.0.17134 N/A Build 17134 - language: shell # 'language: python' is an error on Travis CI Windows - before_install: - - choco install python --version 3.6.8 - - export "PATH=/c/Python36:$PATH" - - python -m pip install --upgrade pip - - wget https://github.com/openslide/openslide-winbuild/releases/download/v20171122/openslide-win64-20171122.zip -P /c/downloads - - 7z e /c/downloads/openslide-win64-20171122.zip -aoa - - export "PATH=/c/Python36/Scripts:/c/downloads/openslide-win64-20171122/bin:$PATH" - - name: "Python 3.7 on Windows" - os: windows # Windows 10.0.17134 N/A Build 17134 - language: shell # 'language: python' is an error on Travis CI Windows - before_install: - - choco install python --version 3.7 - - export "PATH=/c/Python37:$PATH" - - python -m pip install --upgrade pip - - wget https://github.com/openslide/openslide-winbuild/releases/download/v20171122/openslide-win64-20171122.zip -P /c/downloads - - 7z e /c/downloads/openslide-win64-20171122.zip -aoa - - export "PATH=/c/Python37/Scripts:/c/downloads/openslide-win64-20171122/bin:$PATH" - - name: "Python 3.8.0 on Windows" - os: windows # Windows 10.0.17134 N/A Build 17134 - language: shell # 'language: python' is an error on Travis CI Windows - before_install: - - choco install python --version 3.8.0 - - export "PATH=/c/Python38:$PATH" - - python -m pip install --upgrade pip - - wget https://github.com/openslide/openslide-winbuild/releases/download/v20171122/openslide-win64-20171122.zip -P /c/downloads - - 7z e /c/downloads/openslide-win64-20171122.zip -aoa - - export "PATH=/c/Python38/Scripts:/c/downloads/openslide-win64-20171122/bin:$PATH" - env: CAN_FAIL=true - allow_failures: - - env: CAN_FAIL=true - fast_finish: true - -# command to install dependencies -install: - - python -m pip install -e .[testing] - - python -m pip install flake8 - - python -m pip install pooch - -services: - - xvfb - -before_script: - - export DISPLAY=:99.0 - - sleep 3 # give xvfb some time to start - -# command to run tests -script: - - python -m flake8 . - - python -m pytest --ignore=tests/benchmarks --cov=histolab # benchmarks must be in a separate pipeline - not on travis - -after_success: - - coveralls - -notifications: - slack: mpba:fBrjUWlUSa3XKeCA8zFsTFu2 - -addons: - apt: - packages: openslide-tools \ No newline at end of file