diff --git a/.github/scripts/generate-without-spyder.py b/.github/scripts/generate-without-spyder.py new file mode 100644 index 00000000..26a94a63 --- /dev/null +++ b/.github/scripts/generate-without-spyder.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +# +# Copyright (c) Spyder Project Contributors +# Licensed under the terms of the MIT License +# (see LICENSE.txt for details) + +"""Script to generate requirements/without-spyder.txt""" + +import re + +with open('requirements/conda.txt') as infile: + with open('requirements/without-spyder.txt', 'w') as outfile: + for line in infile: + package_name = re.match('[-a-z0-9_]*', line).group(0) + if package_name != 'spyder': + outfile.write(line) + diff --git a/.github/workflows/linux-tests.yml b/.github/workflows/linux-tests.yml deleted file mode 100644 index dc7b3ee8..00000000 --- a/.github/workflows/linux-tests.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: Linux tests - -on: - push: - branches: - - master - - '0.*' - pull_request: - branches: - - master - - '0.*' - -jobs: - linux: - name: Linux Py${{ matrix.PYTHON_VERSION }} - runs-on: ubuntu-latest - env: - CI: True - PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }} - RUNNER_OS: 'ubuntu' - strategy: - fail-fast: false - matrix: - PYTHON_VERSION: ['3.8', '3.9', '3.10'] - steps: - - name: Checkout branch - uses: actions/checkout@v3 - - name: Install System Packages - run: | - sudo apt-get update --fix-missing - sudo apt-get install -qq pyqt5-dev-tools libxcb-xinerama0 --fix-missing - - name: Install Conda - uses: conda-incubator/setup-miniconda@v2 - with: - activate-environment: test - auto-update-conda: true - auto-activate-base: false - python-version: ${{ matrix.PYTHON_VERSION }} - channels: conda-forge - channel-priority: strict - miniforge-variant: Mambaforge - - name: Install node.js - shell: bash -l {0} - run: mamba install nodejs -y - - name: Install package dependencies - shell: bash -l {0} - run: mamba install --file requirements/conda.txt -y - - name: Install test dependencies - shell: bash -l {0} - run: mamba install --file requirements/tests.txt -y - - name: Install Jupyter Notebook using pip - shell: bash -l {0} - run: python -m pip install notebook==7.0.0a15 jupyterlab==4.0.0a34 --pre - - name: Build JavaScript - shell: bash -l {0} - run: | - cd spyder_notebook/server - jlpm install - jlpm build - - name: Install Package - shell: bash -l {0} - run: pip install --no-deps -e . - - name: Show environment information - shell: bash -l {0} - run: | - conda info - conda list - - name: Run tests - shell: bash -l {0} - run: xvfb-run --auto-servernum pytest spyder_notebook --cov=spyder_notebook --color=yes -x -vv - timeout-minutes: 10 - - name: Upload coverage to Codecov - if: matrix.PYTHON_VERSION == '3.8' - shell: bash -l {0} - run: codecov -t dd249610-b0a4-42f6-bcfa-e7968f836790 diff --git a/.github/workflows/macos-tests.yml b/.github/workflows/macos-tests.yml deleted file mode 100644 index fe3daf3b..00000000 --- a/.github/workflows/macos-tests.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Macos tests - -on: - push: - branches: - - master - - '0.*' - pull_request: - branches: - - master - - '0.*' - -jobs: - macos: - name: Mac Py${{ matrix.PYTHON_VERSION }} - runs-on: macos-10.15 - env: - CI: True - PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }} - RUNNER_OS: 'macos' - strategy: - fail-fast: false - matrix: - PYTHON_VERSION: ['3.8', '3.9', '3.10'] - steps: - - name: Checkout branch - uses: actions/checkout@v3 - - name: Install Conda - uses: conda-incubator/setup-miniconda@v2 - with: - activate-environment: test - auto-update-conda: true - auto-activate-base: false - python-version: ${{ matrix.PYTHON_VERSION }} - channels: conda-forge - channel-priority: strict - miniforge-variant: Mambaforge - - name: Install node.js - shell: bash -l {0} - run: mamba install nodejs -y - - name: Install package dependencies - shell: bash -l {0} - run: mamba install --file requirements/conda.txt -y - - name: Install test dependencies - shell: bash -l {0} - run: mamba install --file requirements/tests.txt -y - - name: Install Jupyter Notebook using pip - shell: bash -l {0} - run: python -m pip install notebook==7.0.0a15 jupyterlab==4.0.0a34 --pre - - name: Build JavaScript - shell: bash -l {0} - run: | - cd spyder_notebook/server - jlpm install - jlpm build - - name: Install Package - shell: bash -l {0} - run: pip install --no-deps -e . - - name: Show environment information - shell: bash -l {0} - run: | - conda info - conda list - - name: Run tests - shell: bash -l {0} - run: pytest spyder_notebook --cov=spyder_notebook --color=yes -x -vv - timeout-minutes: 10 diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 00000000..4c530cbc --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,126 @@ +name: Run tests + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + main: + strategy: + fail-fast: false + matrix: + OS: ['ubuntu', 'macos', 'windows'] + PYTHON_VERSION: ['3.8', '3.9', '3.10'] + SPYDER_SOURCE: ['conda'] + name: ${{ matrix.OS }} py${{ matrix.PYTHON_VERSION }} spyder-from-${{ matrix.SPYDER_SOURCE }} + runs-on: ${{ matrix.OS }}-latest + env: + CI: True + PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }} + steps: + - name: Checkout branch + uses: actions/checkout@v3 + - name: Install System Packages + if: matrix.OS == 'ubuntu' + run: | + sudo apt-get update --fix-missing + sudo apt-get install -qq pyqt5-dev-tools libxcb-xinerama0 xterm --fix-missing + - name: Install Conda + uses: conda-incubator/setup-miniconda@v2 + with: + miniforge-variant: Mambaforge + auto-update-conda: true + python-version: ${{ matrix.PYTHON_VERSION }} + - name: Checkout Spyder from git + if: matrix.SPYDER_SOURCE == 'git' + uses: actions/checkout@v3 + with: + repository: 'spyder-ide/spyder' + path: 'spyder' + - name: Install Spyder's dependencies (main) + if: matrix.SPYDER_SOURCE == 'git' + shell: bash -l {0} + run: mamba env update --file spyder/requirements/main.yml + - name: Install Spyder's dependencies (Linux) + if: matrix.SPYDER_SOURCE == 'git' && matrix.OS == 'ubuntu' + shell: bash -l {0} + run: mamba env update --file spyder/requirements/linux.yml + - name: Install Spyder's dependencies (Mac / Windows) + if: matrix.SPYDER_SOURCE == 'git' && matrix.OS != 'ubuntu' + shell: bash -l {0} + run: mamba env update --file spyder/requirements/${{ matrix.OS }}.yml + - name: Install Spyder from source + if: matrix.SPYDER_SOURCE == 'git' + shell: bash -l {0} + run: pip install --no-deps -e spyder + - name: Install node.js + shell: bash -l {0} + run: mamba install nodejs -y + - name: Install plugin dependencies (without Spyder) + if: matrix.SPYDER_SOURCE == 'git' + shell: bash -l {0} + run: | + python .github/scripts/generate-without-spyder.py + mamba install --file requirements/without-spyder.txt -y + - name: Install plugin dependencies + if: matrix.SPYDER_SOURCE == 'conda' + shell: bash -l {0} + run: mamba install --file requirements/conda.txt -y + - name: Install test dependencies + shell: bash -l {0} + run: | + mamba install nomkl -y -q + mamba install --file requirements/tests.txt -y + - name: Install Jupyter Notebook using pip + shell: bash -l {0} + run: python -m pip install notebook==7.0.0a15 jupyterlab==4.0.0a34 --pre + - name: Build JavaScript + shell: bash -l {0} + run: | + cd spyder_notebook/server + jlpm install + jlpm build + - name: Install plugin + shell: bash -l {0} + run: pip install --no-deps -e . + - name: Show environment information + shell: bash -l {0} + run: | + mamba info + mamba list + - name: Run tests (Linux) + if: matrix.OS == 'ubuntu' + uses: nick-fields/retry@v2 + with: + timeout_minutes: 10 + max_attempts: 3 + shell: bash + command: | + . ~/.profile + xvfb-run --auto-servernum pytest spyder_notebook --cov=spyder_notebook --cov-report=xml -vv + - name: Run tests (MacOS) + if: matrix.OS == 'macos' + uses: nick-fields/retry@v2 + with: + timeout_minutes: 10 + max_attempts: 3 + shell: bash + command: | + . ~/.profile + pytest spyder_notebook -vv + - name: Run tests (Windows) + if: matrix.OS == 'windows' + uses: nick-fields/retry@v2 + with: + timeout_minutes: 10 + max_attempts: 3 + command: pytest spyder_notebook -vv + - name: Upload coverage to Codecov + if: matrix.OS == 'ubuntu' && matrix.PYTHON_VERSION == '3.10' + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/windows-tests.yml b/.github/workflows/windows-tests.yml deleted file mode 100644 index f573f0d1..00000000 --- a/.github/workflows/windows-tests.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Windows tests - -on: - push: - branches: - - master - - '0.*' - pull_request: - branches: - - master - - '0.*' - -jobs: - windows: - name: Windows Py${{ matrix.PYTHON_VERSION }} - runs-on: windows-latest - env: - CI: True - PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }} - RUNNER_OS: 'windows' - strategy: - fail-fast: false - matrix: - PYTHON_VERSION: ['3.8', '3.9', '3.10'] - steps: - - name: Checkout branch - uses: actions/checkout@v3 - - name: Install Conda - uses: conda-incubator/setup-miniconda@v2 - with: - activate-environment: test - auto-update-conda: true - auto-activate-base: false - python-version: ${{ matrix.PYTHON_VERSION }} - channels: conda-forge - channel-priority: strict - miniforge-variant: Mambaforge - - name: Install node.js - shell: bash -l {0} - run: mamba install nodejs -y - - name: Install package dependencies - shell: bash -l {0} - run: mamba install --file requirements/conda.txt -y - - name: Install test dependencies - shell: bash -l {0} - run: mamba install --file requirements/tests.txt -y - - name: Install Jupyter Notebook using pip - shell: bash -l {0} - run: python -m pip install notebook==7.0.0a15 jupyterlab==4.0.0a34 --pre - - name: Build JavaScript - shell: bash -l {0} - run: | - cd spyder_notebook/server - jlpm install - jlpm build - - name: Install Package - shell: bash -l {0} - run: pip install --no-deps -e . - - name: Show environment information - shell: bash -l {0} - run: | - conda info - conda list - - name: Run tests - shell: bash -l {0} - run: pytest spyder_notebook --cov=spyder_notebook --color=yes -x -vv - timeout-minutes: 10 diff --git a/requirements/tests.txt b/requirements/tests.txt index 3f94fce0..23ac7daa 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -1,4 +1,3 @@ -codecov flaky pytest pytest-cov