forked from spyder-ide/spyder
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport PR spyder-ide#22527 on branch 6.x: (PR: Add initial tests fo…
…r the remote client)
- Loading branch information
1 parent
cfa51ff
commit e7e9cfd
Showing
13 changed files
with
798 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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 file contains 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 file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
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' | ||
|
||
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' | ||
|
||
workflow_dispatch: | ||
inputs: | ||
ssh: | ||
# github_cli: gh workflow run test-linux.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 |
This file contains 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 file contains 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 file contains 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 file contains 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 file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
FROM ubuntu:focal AS ubuntu-base | ||
ENV DEBIAN_FRONTEND noninteractive | ||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
# Setup the default user. | ||
RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo ubuntu | ||
RUN echo 'ubuntu:ubuntu' | chpasswd | ||
|
||
# Install required tools. | ||
RUN apt-get -qq update \ | ||
&& apt-get -qq --no-install-recommends install curl \ | ||
&& apt-get -qq --no-install-recommends install ca-certificates \ | ||
&& apt-get -qq --no-install-recommends install vim-tiny \ | ||
&& apt-get -qq --no-install-recommends install sudo \ | ||
&& apt-get -qq --no-install-recommends install openssh-server \ | ||
&& apt-get -qq clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Configure SSHD. | ||
# SSH login fix. Otherwise user is kicked off after login | ||
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd | ||
RUN mkdir /var/run/sshd | ||
RUN bash -c 'install -m755 <(printf "#!/bin/sh\nexit 0") /usr/sbin/policy-rc.d' | ||
RUN ex +'%s/^#\zeListenAddress/\1/g' -scwq /etc/ssh/sshd_config | ||
RUN ex +'%s/^#\zeHostKey .*ssh_host_.*_key/\1/g' -scwq /etc/ssh/sshd_config | ||
RUN RUNLEVEL=1 dpkg-reconfigure openssh-server | ||
RUN ssh-keygen -A -v | ||
RUN update-rc.d ssh defaults | ||
|
||
# Configure sudo. | ||
RUN ex +"%s/^%sudo.*$/%sudo ALL=(ALL:ALL) NOPASSWD:ALL/g" -scwq! /etc/sudoers | ||
|
||
# Generate and configure user keys. | ||
USER ubuntu | ||
RUN ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 | ||
|
||
CMD ["/usr/bin/sudo", "/usr/sbin/sshd", "-D", "-o", "ListenAddress=172.16.128.2"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright © Spyder Project Contributors | ||
# Licensed under the terms of the MIT License | ||
# (see spyder/__init__.py for details) | ||
|
||
"""Spyder Remote Client Tests""" |
Oops, something went wrong.