Skip to content

Commit

Permalink
Merge branch 'master' into fixes_issue_22448
Browse files Browse the repository at this point in the history
  • Loading branch information
dalthviz authored Oct 19, 2024
2 parents f8dcf69 + f9dfab7 commit 27326ce
Show file tree
Hide file tree
Showing 52 changed files with 1,354 additions and 249 deletions.
55 changes: 30 additions & 25 deletions .github/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,35 +64,40 @@ fi
# Install subrepos from source
python -bb -X dev install_dev_repos.py --not-editable --no-install spyder

# Install boilerplate plugin
pushd spyder/app/tests/spyder-boilerplate
pip install --no-deps -q -e .
popd

# Install Spyder to test it as if it was properly installed.
python -bb -X dev -m build
python -bb -X dev -m pip install --no-deps dist/spyder*.whl

# Adjust PATH on Windows so that we can use conda below. This needs to be done
# at this point or the pip slots fail.
if [ "$OS" = "win" ]; then
PATH=/c/Miniconda/Scripts/:$PATH
fi
if [ "$SPYDER_TEST_REMOTE_CLIENT" = "true" ]; then
pip install pytest-docker
else

# Install boilerplate plugin
pushd spyder/app/tests/spyder-boilerplate
pip install --no-deps -q -e .
popd

# Adjust PATH on Windows so that we can use conda below. This needs to be done
# at this point or the pip slots fail.
if [ "$OS" = "win" ]; then
PATH=/c/Miniconda/Scripts/:$PATH
fi

# Create environment for Jedi environment tests
conda create -n jedi-test-env -q -y python=3.9 flask
install_spyder_kernels jedi-test-env
conda list -n jedi-test-env

# Create environment to test conda env activation before launching a kernel
conda create -n spytest-ž -q -y -c conda-forge python=3.9
install_spyder_kernels spytest-ž
conda list -n spytest-ž

# Install pyenv on Linux systems
if [ "$RUN_SLOW" = "false" ]; then
if [ "$OS" = "linux" ]; then
curl https://pyenv.run | bash
$HOME/.pyenv/bin/pyenv install 3.8.1
# Create environment for Jedi environment tests
conda create -n jedi-test-env -q -y python=3.9 flask
install_spyder_kernels jedi-test-env
conda list -n jedi-test-env

# Create environment to test conda env activation before launching a kernel
conda create -n spytest-ž -q -y -c conda-forge python=3.9
install_spyder_kernels spytest-ž
conda list -n spytest-ž

# Install pyenv on Linux systems
if [ "$RUN_SLOW" = "false" ]; then
if [ "$OS" = "linux" ]; then
curl https://pyenv.run | bash
$HOME/.pyenv/bin/pyenv install 3.8.1
fi
fi
fi
10 changes: 7 additions & 3 deletions .github/scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ else
fi

# Run tests
if [ "$OS" = "linux" ]; then
xvfb-run --auto-servernum python runtests.py --color=yes | tee -a pytest_log.txt
if [ "$SPYDER_TEST_REMOTE_CLIENT" = "true" ]; then
xvfb-run --auto-servernum python runtests.py --color=yes --remote-client | tee -a pytest_log.txt
else
python runtests.py --color=yes | tee -a pytest_log.txt
if [ "$OS" = "linux" ]; then
xvfb-run --auto-servernum python runtests.py --color=yes | tee -a pytest_log.txt
else
python runtests.py --color=yes | tee -a pytest_log.txt
fi
fi
58 changes: 58 additions & 0 deletions .github/workflows/purge-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Purge caches
on:
schedule:
# 4:10 UTC Sunday
- cron: "10 4 * * 0"

workflow_dispatch:

jobs:
cleanup:
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Purge Cache
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
REPO=${{ github.repository }}
gh cache list --repo $REPO
## Setting this to not fail the workflow while deleting cache keys.
set +e
gh cache delete --repo $REPO --all
# Last command must be successful so that workflow step does not fail
echo Purging cache is complete.
run-test-files:
name: Run test-files
needs:
- cleanup
uses: ./.github/workflows/test-files.yml

run-test-linux:
name: Run test-linux
needs:
- cleanup
uses: ./.github/workflows/test-linux.yml

run-test-mac:
name: Run test-mac
needs:
- cleanup
uses: ./.github/workflows/test-mac.yml

run-test-remoteclient:
name: Run test-remoteclient
needs:
- cleanup
uses: ./.github/workflows/test-remoteclient.yml

run-test-win:
name: Run test-win
needs:
- cleanup
uses: ./.github/workflows/test-win.yml
4 changes: 4 additions & 0 deletions .github/workflows/test-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
- '!installers-conda/**'
- '!.github/workflows/installers-conda.yml'
- '!.github/workflows/build-subrepos.yml'
- '!.github/workflows/purge-cache.yml'

pull_request:
branches:
Expand All @@ -34,6 +35,9 @@ on:
- '!installers-conda/**'
- '!.github/workflows/installers-conda.yml'
- '!.github/workflows/build-subrepos.yml'
- '!.github/workflows/purge-cache.yml'

workflow_call:

workflow_dispatch:

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
- '!installers-conda/**'
- '!.github/workflows/installers-conda.yml'
- '!.github/workflows/build-subrepos.yml'
- '!.github/workflows/purge-cache.yml'

pull_request:
branches:
Expand All @@ -34,6 +35,9 @@ on:
- '!installers-conda/**'
- '!.github/workflows/installers-conda.yml'
- '!.github/workflows/build-subrepos.yml'
- '!.github/workflows/purge-cache.yml'

workflow_call:

workflow_dispatch:
inputs:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
- '!installers-conda/**'
- '!.github/workflows/installers-conda.yml'
- '!.github/workflows/build-subrepos.yml'
- '!.github/workflows/purge-cache.yml'

pull_request:
branches:
Expand All @@ -34,6 +35,9 @@ on:
- '!installers-conda/**'
- '!.github/workflows/installers-conda.yml'
- '!.github/workflows/build-subrepos.yml'
- '!.github/workflows/purge-cache.yml'

workflow_call:

workflow_dispatch:
inputs:
Expand Down
164 changes: 164 additions & 0 deletions .github/workflows/test-remoteclient.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
name: Remote Client Tests

on:
push:
branches:
- master
- 6.*
paths:
- '.github/scripts/*.sh'
- '.github/workflows/*.yml'
- 'requirements/*.yml'
- '**.bat'
- '**.py'
- '**.sh'
- '!installers-conda/**'
- '!.github/workflows/installers-conda.yml'
- '!.github/workflows/build-subrepos.yml'
- '!.github/workflows/purge-cache.yml'

pull_request:
branches:
- master
- 6.*
paths:
- '.github/scripts/*.sh'
- '.github/workflows/*.yml'
- 'requirements/*.yml'
- '**.bat'
- '**.py'
- '**.sh'
- '!installers-conda/**'
- '!.github/workflows/installers-conda.yml'
- '!.github/workflows/build-subrepos.yml'
- '!.github/workflows/purge-cache.yml'

workflow_call:

workflow_dispatch:
inputs:
ssh:
# github_cli: gh workflow run test-remoteclient.yml --ref <branch> -f ssh=true
description: 'Enable ssh debugging'
required: false
default: false
type: boolean

concurrency:
group: test-remoteclient-${{ github.ref }}
cancel-in-progress: true

env:
ENABLE_SSH: ${{ github.event_name == 'workflow_dispatch' && inputs.ssh }}

jobs:
build:
# Use this to disable the workflow
# if: false
name: Linux - Py${{ matrix.PYTHON_VERSION }}, ${{ matrix.INSTALL_TYPE }}
runs-on: ubuntu-20.04
env:
CI: 'true'
QTCONSOLE_TESTING: 'true'
CODECOV_TOKEN: "56731c25-9b1f-4340-8b58-35739bfbc52d"
OS: 'linux'
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
USE_CONDA: ${{ matrix.INSTALL_TYPE == 'conda' }}
SPYDER_TEST_REMOTE_CLIENT: 'true'
strategy:
fail-fast: false
matrix:
INSTALL_TYPE: ['pip', 'conda']
PYTHON_VERSION: ['3.8', '3.12']
exclude:
# Only test Python 3.8 with pip because Conda-forge will drop it soon
- INSTALL_TYPE: 'conda'
PYTHON_VERSION: '3.8'
timeout-minutes: 90
steps:
- name: Setup Remote SSH Connection
if: env.ENABLE_SSH == 'true'
uses: mxschmitt/action-tmate@v3
timeout-minutes: 60
with:
detached: true
- name: Checkout Pull Requests
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout Push
if: github.event_name != 'pull_request'
uses: actions/checkout@v4
- name: Fetch branches
run: git fetch --prune --unshallow
- name: Install dependencies
shell: bash
run: |
sudo apt-get update --fix-missing
sudo apt-get install -qq pyqt5-dev-tools libxcb-xinerama0 xterm --fix-missing
- name: Cache conda
uses: actions/cache@v4
env:
# Increase this value to reset cache if requirements/*.txt has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-cacheconda-install${{ matrix.INSTALL_TYPE }}-${{ matrix.PYTHON_VERSION }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('requirements/*.yml') }}
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-cachepip-install${{ matrix.INSTALL_TYPE }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('setup.py') }}
- name: Create conda test environment
if: env.USE_CONDA == 'true'
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: '1.5.10-0'
environment-file: requirements/main.yml
environment-name: test
cache-downloads: true
create-args: python=${{ matrix.PYTHON_VERSION }}
- name: Create pip test environment
if: env.USE_CONDA != 'true'
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: '1.5.10-0'
environment-name: test
cache-downloads: true
create-args: python=${{ matrix.PYTHON_VERSION }}
condarc: |
channels:
- conda-forge
- name: Install additional dependencies
shell: bash -l {0}
run: bash -l .github/scripts/install.sh
- name: Show conda test environment
if: env.USE_CONDA == 'true'
shell: bash -l {0}
run: |
micromamba info
micromamba list
- name: Show pip test environment
if: env.USE_CONDA != 'true'
shell: bash -l {0}
run: |
micromamba info
micromamba list
pip list
- name: Run tests
shell: bash -l {0}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
rm -f pytest_log.txt
rm -f pytest_log.txt # Must remove any log file from a previous run
.github/scripts/run_tests.sh || \
.github/scripts/run_tests.sh || \
.github/scripts/run_tests.sh || \
.github/scripts/run_tests.sh
- name: Coverage
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
verbose: true
4 changes: 4 additions & 0 deletions .github/workflows/test-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
- '!installers-conda/**'
- '!.github/workflows/installers-conda.yml'
- '!.github/workflows/build-subrepos.yml'
- '!.github/workflows/purge-cache.yml'

pull_request:
branches:
Expand All @@ -34,6 +35,9 @@ on:
- '!installers-conda/**'
- '!.github/workflows/installers-conda.yml'
- '!.github/workflows/build-subrepos.yml'
- '!.github/workflows/purge-cache.yml'

workflow_call:

workflow_dispatch:
inputs:
Expand Down
8 changes: 4 additions & 4 deletions MAINTENANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ These are some instructions meant for maintainers of this repo.
* If `meeseeksdev` fails to do the backport, you need to manually open a PR against the stable branch to do it with the following actions:

- `git checkout 6.x`
- `git checkout -b backport-of-pr-<number>`
- `git cherry-pick <commit that was merged to master for that PR>`
- `git checkout -b backport-pr-<number>`
- `git cherry-pick -m 1 <commit that was merged to master for that PR>`
- Solve conflicts

* If a PR that involved updating our spyder-kernels subrepo and needs to be included in the stable branch (e.g. `6.x`), you need to manually create a PR against it with the following actions:

- `git checkout 6.x`
- `git checkout -b backport-of-pr-<number>`
- `git cherry-pick <commit that was merged to master>`
- `git checkout -b backport-pr-<number>`
- `git cherry-pick -m 1 <commit that was merged to master for that PR>`
- `git reset -- external-deps/spyder-kernels`
- `git checkout -- external-deps/spyder-kernels`
- `git commit` with the files left
Expand Down
Loading

0 comments on commit 27326ce

Please sign in to comment.