Skip to content

Commit b62a005

Browse files
Fix github action
1 parent d870497 commit b62a005

File tree

2 files changed

+35
-8
lines changed

2 files changed

+35
-8
lines changed

.github/workflows/python-package-conda.yml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,50 @@ jobs:
1010

1111
steps:
1212
- uses: actions/checkout@v4
13+
- name: Install OS dependencies (Node.js, Tkinter, Xvfb)
14+
run: |
15+
apt-get update -y && \
16+
apt-get install -y nodejs npm tk-dev tcl-dev xvfb
1317
- name: Set up Python 3.10
1418
uses: actions/setup-python@v3
1519
with:
1620
python-version: '3.10'
21+
- name: Install test dependencies (pytest, pytest-xdist)
22+
run: |
23+
echo "Pip for pytest install: $(which pip)"
24+
pip install pytest pytest-xdist
1725
- name: Add conda to system path
1826
run: |
1927
# $CONDA is an environment variable pointing to the root of the miniconda directory
28+
echo "CONDA PATH: $CONDA/bin" # Debugging $CONDA
2029
echo $CONDA/bin >> $GITHUB_PATH
21-
- name: Install dependencies
30+
- name: Install Conda dependencies
2231
run: |
2332
conda env update --file environment.yml --name base
33+
echo "Python from Conda env update: $(which python)" # Debug which python conda uses
34+
echo "Pip from Conda env update: $(which pip)" # Debug which pip conda uses
35+
- name: Install project
36+
run: |
37+
echo "Python for pip install -e: $(which python)" # Debug which python is used for editable install
38+
pip install -e . -v
39+
echo "--- Installed packages after pip install -e . ---"
40+
pip list
41+
echo "--- PYTHONPATH after pip install -e . ---"
42+
echo "PYTHONPATH IS: $PYTHONPATH"
43+
- name: Test import before pytest
44+
run: |
45+
echo "Python for direct import test: $(which python)"
46+
# Test basic Tkinter functionality with Xvfb for early feedback
47+
xvfb-run python -c "import sys; print(f'Python sys.path: {sys.path}'); import editor; print('Successfully imported editor module'); import tkinter; root = tkinter.Tk(); print(f'Tkinter root: {root}'); root.destroy(); print('Successfully imported and initialized/destroyed tkinter root')"
2448
- name: Lint with flake8
2549
run: |
26-
conda install flake8
27-
# stop the build if there are Python syntax errors or undefined names
50+
# flake8 should be available from the conda env
51+
echo "Flake8 from: $(which flake8)"
2852
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
29-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
3053
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
3154
- name: Test with pytest
3255
run: |
33-
conda install pytest
34-
pytest
56+
echo "Pytest from module path: $(python -m pytest --version)" # Check if pytest module is found by this python
57+
echo "Python for pytest step: ${{ env.pythonLocation }}/bin/python"
58+
# Run pytest under Xvfb
59+
xvfb-run ${{ env.pythonLocation }}/bin/python -m pytest

environment.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ channels:
44
- defaults
55
dependencies:
66
- python=3.10
7-
- pytest
7+
# pytest and pytest-xdist will be installed via pip in the GitHub Action
88
- flake8
99
- black
1010
- pyyaml
1111
- tomli # For pyproject.toml parsing on Python < 3.11
12-
- pre-commit
12+
- pre-commit
13+
- pytest
14+
- pytest-xdist

0 commit comments

Comments
 (0)