From 251bee8b0d0355c3e2fdab4363edf328c20e648f Mon Sep 17 00:00:00 2001 From: Jitse Niesen Date: Thu, 18 Apr 2024 20:58:01 +0100 Subject: [PATCH] CI: Put Spyder source tree outside the plugin source tree Before, the Spyder source tree was nested inside the plugin source tree which was messy and may have generated errors. --- .github/scripts/generate-without-spyder.py | 10 +++++++--- .github/workflows/run-tests.yml | 18 ++++++++++-------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.github/scripts/generate-without-spyder.py b/.github/scripts/generate-without-spyder.py index 26a94a6..491ce99 100644 --- a/.github/scripts/generate-without-spyder.py +++ b/.github/scripts/generate-without-spyder.py @@ -7,11 +7,15 @@ """Script to generate requirements/without-spyder.txt""" import re +from pathlib import Path -with open('requirements/conda.txt') as infile: - with open('requirements/without-spyder.txt', 'w') as outfile: +rootdir = Path(__file__).parents[2] +input_filename = rootdir / 'requirements' / 'conda.txt' +output_filename = rootdir / 'requirements' / 'without-spyder.txt' + +with open(input_filename) as infile: + with open(output_filename, '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/run-tests.yml b/.github/workflows/run-tests.yml index 7665d59..c95bf7a 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -27,6 +27,8 @@ jobs: steps: - name: Checkout branch uses: actions/checkout@v4 + with: + path: 'spyder-unittest' - name: Install System Packages if: matrix.OS == 'ubuntu' run: | @@ -64,20 +66,20 @@ jobs: 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 + python spyder-unittest/.github/scripts/generate-without-spyder.py + mamba install --file spyder-unittest/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 + run: mamba install --file spyder-unittest/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 + mamba install --file spyder-unittest/requirements/tests.txt -y - name: Install plugin shell: bash -l {0} - run: pip install --no-deps -e . + run: pip install --no-deps -e spyder-unittest - name: Show environment information shell: bash -l {0} run: | @@ -92,7 +94,7 @@ jobs: shell: bash command: | . ~/.profile - xvfb-run --auto-servernum pytest spyder_unittest -vv + xvfb-run --auto-servernum pytest spyder-unittest/spyder_unittest -vv - name: Run tests (MacOS) if: matrix.OS == 'macos' uses: nick-fields/retry@v3 @@ -102,11 +104,11 @@ jobs: shell: bash command: | . ~/.profile - pytest spyder_unittest -vv + pytest spyder-unittest/spyder_unittest -vv - name: Run tests (Windows) if: matrix.OS == 'windows' uses: nick-fields/retry@v3 with: timeout_minutes: 10 max_attempts: 3 - command: pytest spyder_unittest -vv + command: pytest spyder-unittest/spyder_unittest -vv