Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: determine wheel tags by Python interpreter introspection & tests and CI improvements #202

Merged
merged 12 commits into from
Nov 16, 2022
Merged
12 changes: 6 additions & 6 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ jobs:
env:
FORCE_COLOR: true
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.7

- name: Install nox
run: python -m pip install nox
- name: Install mypy
run: python -m pip --disable-pip-version-check install mypy==0.981

- name: Run check for type
run: nox -s mypy
- name: Run mypy
run: mypy -p mesonpy
2 changes: 1 addition & 1 deletion .github/workflows/ci-sage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out ${{ env.SPKG }}
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: build/pkgs/${{ env.SPKG }}/src
- name: Install prerequisites
Expand Down
54 changes: 0 additions & 54 deletions .github/workflows/tests-cygwin.yml

This file was deleted.

181 changes: 178 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:
cancel-in-progress: true

jobs:
pytest:
test:
runs-on: ${{ matrix.os }}-latest
env:
FORCE_COLOR: true
Expand All @@ -35,10 +35,10 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up target Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

Expand All @@ -60,3 +60,178 @@ jobs:
flags: tests
env_vars: PYTHON
name: ${{ matrix.python }}

cygwin:
runs-on: windows-latest
env:
FORCE_COLOR: true
strategy:
fail-fast: false
matrix:
python:
- '3.9'

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Cygwin
uses: cygwin/cygwin-install-action@v2
with:
packages: >-
python39
python39-devel
python39-pip
dnicolodi marked this conversation as resolved.
Show resolved Hide resolved
python39-setuptools
cmake
gcc-core
gcc-g++
git
make
ninja

- name: Fix git dubious ownership
# This addresses the "fatal: detected dubious ownership in
# repository" and "fatal: not in a git directory" errors
# encountered when trying to run Cygwin git in a directory not
# owned by the current user. This happens when the tests run
# Cygwin git in a directory outside the Cygwin filesystem.
run: git config --global --add safe.directory '*'
shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -leo pipefail -o igncr {0}

- name: Get pip cache path
id: pip-cache-path
run: echo "path=$(cygpath -w $(python -m pip cache dir))" >> $GITHUB_OUTPUT
shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -leo pipefail -o igncr {0}

- name: Restore cache
# Cygwin Python cannot use binary wheels from PyPI. Building
# some dependencies takes considerable time. Caching the built
# wheels speeds up the CI job quite a bit.
dnicolodi marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache-path.outputs.path }}
key: cygwin-pip-${{ github.sha }}
restore-keys: cygwin-pip-

- name: Install
# Cygwin patches Python's ensurepip module to look for the
# wheels needed to initialize a new virtual environment in
# /usr/share/python-wheels/ but nothing in Cygwin actually
# puts the setuptools and pip wheels there. Fix this.
run: |
mkdir /usr/share/python-wheels/
pushd /usr/share/python-wheels/
python -m pip --disable-pip-version-check download setuptools pip
popd
python -m pip --disable-pip-version-check install .[test]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the nox configuration would also install pytest-github-actions-annotate-failures; do you want to install that as well?

shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -leo pipefail -o igncr {0}

- name: Run tests
run: >-
python -m pytest --showlocals -vv --cov
--cov-config setup.cfg
--cov-report=xml:coverage-${{ matrix.python }}.xml
shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -leo pipefail -o igncr {0}

- name: Send coverage report
uses: codecov/codecov-action@v1
if: ${{ always() }}
env:
PYTHON: cygwin-${{ matrix.python }}
with:
flags: tests
env_vars: PYTHON
name: cygwin-${{ matrix.python }}

pyston:
runs-on: ubuntu-20.04
env:
FORCE_COLOR: true
strategy:
fail-fast: false
matrix:
python:
- '3.8'

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install pyston
run: |
wget https://github.com/pyston/pyston/releases/download/pyston_2.3.5/pyston_2.3.5_20.04_amd64.deb
sudo apt install $(pwd)/pyston_2.3.5_20.04_amd64.deb

- name: Install
run: pyston -m pip --disable-pip-version-check install .[test]

- name: Run tests
run: >-
pyston -m pytest --showlocals -vv --cov
--cov-config setup.cfg
--cov-report=xml:coverage-pyston.xml

- name: Send coverage report
uses: codecov/codecov-action@v1
if: ${{ always() }}
env:
PYTHON: pyston
with:
flags: tests
env_vars: PYTHON
name: pyston

homebrew:
runs-on: macos-latest
env:
FORCE_COLOR: true
strategy:
fail-fast: false
matrix:
python:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Homebrew Python
run: |
brew install --overwrite python@${{ matrix.python }}
echo /usr/local/opt/python@${{ matrix.python }}/libexec/bin/ >> $GITHUB_PATH

- name: Patch pip
# Patch https://github.com/pypa/pip/issues/11539
run: |
cat >>/usr/local/lib/python${{ matrix.python }}/site-packages/pip/_internal/locations/_sysconfig.py <<EOF
def get_prefixed_libs(prefix: str) -> typing.Tuple[str, str]:
if "venv" in sysconfig.get_scheme_names():
paths = sysconfig.get_paths(vars={"base": prefix, "platbase": prefix}, scheme="venv")
else:
paths = sysconfig.get_paths(vars={"base": prefix, "platbase": prefix})
return (paths["purelib"], paths["platlib"])
EOF

- name: Install
run: python -m pip --disable-pip-version-check install .[test]

- name: Run tests
run: >-
python -m pytest --showlocals -vv --cov
--cov-config setup.cfg
--cov-report=xml:coverage-homebrew-${{ matrix.python }}.xml

- name: Send coverage report
uses: codecov/codecov-action@v1
if: ${{ always() }}
env:
PYTHON: homebrew-${{ matrix.python }}
with:
flags: tests
env_vars: PYTHON
name: homebrew-${{ matrix.python }}
Loading