Skip to content

Commit d893887

Browse files
committed
CI: actually run with Cygwin Python
Cygwin was installed but the regular Python interpreter was actually used to run the test. Fix this. Also merge Cygwin tests setup definition with the one for other environments. The Python distributed by Cygwin is broken and requires some peculiar maneuvers to make it suitable to create virtual environments. Address that in the CI configuration.
1 parent d582d46 commit d893887

File tree

2 files changed

+83
-54
lines changed

2 files changed

+83
-54
lines changed

.github/workflows/tests-cygwin.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,89 @@ jobs:
6161
env_vars: PYTHON
6262
name: ${{ matrix.python }}
6363

64+
cygwin:
65+
runs-on: windows-latest
66+
env:
67+
FORCE_COLOR: true
68+
strategy:
69+
fail-fast: false
70+
matrix:
71+
python:
72+
- '3.9'
73+
74+
steps:
75+
- name: Checkout
76+
uses: actions/checkout@v2
77+
78+
- name: Setup Cygwin
79+
uses: cygwin/cygwin-install-action@v2
80+
with:
81+
packages: >-
82+
python39
83+
python39-devel
84+
python39-pip
85+
python39-setuptools
86+
cmake
87+
gcc-core
88+
gcc-g++
89+
git
90+
make
91+
ninja
92+
93+
- name: Fix git dubious ownership
94+
# This addresses the "fatal: detected dubious ownership in
95+
# repository" and "fatal: not in a git directory" errors
96+
# encountered when trying to run Cygwin git in a directory not
97+
# owned by the current user. This happens when the tests run
98+
# Cygwin git in a directory outside the Cygwin filesystem.
99+
run: git config --global --add safe.directory '*'
100+
shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -leo pipefail -o igncr {0}
101+
102+
- name: Get pip cache path
103+
id: pip-cache-path
104+
run: echo "path=$(cygpath -w $(python -m pip cache dir))" >> $GITHUB_OUTPUT
105+
shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -leo pipefail -o igncr {0}
106+
107+
- name: Restore cache
108+
# Cygwin Python cannot use binary wheels from PyPI. Building
109+
# some dependencies takes considerable time. Caching the built
110+
# wheels speeds up the CI job quite a bit.
111+
uses: actions/cache@v3
112+
with:
113+
path: ${{ steps.pip-cache-path.outputs.path }}
114+
key: cygwin-pip-${{ github.sha }}
115+
restore-keys: cygwin-pip-
116+
117+
- name: Install
118+
# Cygwin patches Python's ensurepip module to look for the
119+
# wheels needed to initialize a new virtual environment in
120+
# /usr/share/python-wheels/ but nothing in Cygwin actually
121+
# puts the setuptools and pip wheels there. Fix this.
122+
run: |
123+
mkdir /usr/share/python-wheels/
124+
pushd /usr/share/python-wheels/
125+
python -m pip --disable-pip-version-check download setuptools pip
126+
popd
127+
python -m pip --disable-pip-version-check install .[test]
128+
shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -leo pipefail -o igncr {0}
129+
130+
- name: Run tests
131+
run: >-
132+
python -m pytest --showlocals -vv --cov
133+
--cov-config setup.cfg
134+
--cov-report=xml:coverage-${{ matrix.python }}.xml
135+
shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -leo pipefail -o igncr {0}
136+
137+
- name: Send coverage report
138+
uses: codecov/codecov-action@v1
139+
if: ${{ always() }}
140+
env:
141+
PYTHON: cygwin-${{ matrix.python }}
142+
with:
143+
flags: tests
144+
env_vars: PYTHON
145+
name: cygwin-${{ matrix.python }}
146+
64147
pyston:
65148
runs-on: ubuntu-20.04
66149
env:

0 commit comments

Comments
 (0)