Skip to content

Commit

Permalink
add macOS (incl. amd64) and Windows readme code CI checks (#1306)
Browse files Browse the repository at this point in the history
  • Loading branch information
slayoo authored Apr 17, 2024
1 parent c38c81f commit f23c6b8
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 19 deletions.
42 changes: 30 additions & 12 deletions .github/workflows/readme_snippets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,40 @@ on:

jobs:
python:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [ubuntu-latest, macos-12, macos-14, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
- if: matrix.platform != 'macos-14'
uses: actions/[email protected]
with:
python-version: 3.9
- run: pip install -e .[tests]
- run: pip install pytest-codeblocks pytest
- run: pip install "pyparsing<3.0.0" # https://github.com/matplotlib/matplotlib/issues/25204
- run: python -c "import pytest_codeblocks; code=pytest_codeblocks.extract_from_file('README.md'); f=open('readme.py', 'w'); f.writelines(block.code for block in code if block.syntax=='Python'); f.close()"
- run: python -We readme.py
- run: sed -i 's/CPU/GPU/g' readme.py
- run: python -We readme.py
- if: matrix.platform == 'macos-14'
run: |
sudo ln -s `which python3` /usr/local/bin/python
echo "PIP_INSTALL_ARGS=--break-system-packages" >> $GITHUB_ENV
python -m pip install --break-system-packages setuptools # Python 3.12 workaround
- run: python -m pip install $PIP_INSTALL_ARGS -e .
- run: python -m pip install $PIP_INSTALL_ARGS pytest-codeblocks pytest
- run: python -m pip install $PIP_INSTALL_ARGS "pyparsing<3.0.0" # https://github.com/matplotlib/matplotlib/issues/25204
- run: |
python -c "import os,pytest_codeblocks; code=pytest_codeblocks.extract_from_file('README.md'); f=open('readme.py', 'w', encoding='utf-8'); f.write('# coding: utf-8'+os.linesep); f.writelines(block.code for block in code if block.syntax=='Python'); f.close()"
- run: cat -n readme.py
- if: matrix.platform == 'macos-14'
run: |
python readme.py
sed -i -e 's/CPU/GPU/g' readme.py
python readme.py
- if: matrix.platform != 'macos-14'
run: |
python -We readme.py
sed -i -e 's/CPU/GPU/g' readme.py
python -We readme.py
- name: artefacts
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main' && matrix.platform == 'macos-14'
uses: eine/tip@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -49,7 +67,7 @@ jobs:
- uses: julia-actions/[email protected]
- run: cat -n readme.jl
- run: julia readme.jl
- run: sed -i 's/CPU/GPU/g' readme.jl
- run: sed -i -e 's/CPU/GPU/g' readme.jl
- run: julia readme.jl

matlab:
Expand All @@ -69,7 +87,7 @@ jobs:
- uses: matlab-actions/[email protected]
with:
command: readme
- run: sed -i 's/CPU/GPU/g' readme.m
- run: sed -i -e 's/CPU/GPU/g' readme.m
- uses: matlab-actions/[email protected]
with:
command: readme
Expand Down
28 changes: 23 additions & 5 deletions .github/workflows/tests+artifacts+pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ jobs:
key: examples_pip_cache-${{ matrix.platform }}-${{ matrix.python-version }}-${{ env.toml_ci_md5 }}
- if: steps.cache.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade --user pip
python -m pip uninstall -y jupyterlab-server # https://github.com/pypa/pip/issues/6275
python -m pip install -e . ./examples
python -m pip install -r tests/devops_tests/requirements.txt
- if: steps.cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -302,19 +302,37 @@ jobs:
pkg_install_check:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.11"]
platform: [ubuntu-latest, macos-12, macos-14, windows-latest]
python-version: ["3.8", "3.11", "system"]
exclude:
- platform: ubuntu-latest
python-version: system
- platform: macos-12
python-version: system
- platform: windows-latest
python-version: system
- platform: macos-14
python-version: "3.8"
- platform: macos-14
python-version: "3.11"
runs-on: ${{ matrix.platform }}
needs: [package]
steps:
- uses: actions/[email protected]
- if: matrix.platform != 'macos-14'
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- if: matrix.platform == 'macos-14'
run: |
sudo ln -s `which python3` /usr/local/bin/python
echo "PIP_INSTALL_ARGS=--break-system-packages" >> $GITHUB_ENV
# Python 3.12 workaround
python -m pip install --break-system-packages setuptools
- uses: actions/download-artifact@v3
with:
name: dist
path: dist
- run: pip install dist/*.whl
- run: python -m pip install $PIP_INSTALL_ARGS dist/*.whl
- run: python -c "import PySDM; print(PySDM.__version__)"
- run: python -c "import PySDM_examples; print(PySDM_examples.__version__)"

Expand Down
27 changes: 25 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import os
import platform
import sys

from setuptools import find_packages, setup

Expand All @@ -26,11 +27,33 @@ def get_long_description():
install_requires=[
"ThrustRTC==0.3.20",
"CURandRTC" + ("==0.1.6" if CI else ">=0.1.2"),
"numba" + ("==0.58.1" if CI and not _32bit else ">=0.51.2"),
"numba"
+ (
{
8: "==0.58.1",
9: "==0.58.1",
10: "==0.58.1",
11: "==0.58.1",
12: "==0.59.1",
}[sys.version_info.minor]
if CI and not _32bit
else ">=0.51.2"
),
"numpy" + ("==1.24.4" if CI else ""),
"Pint" + ("==0.21.1" if CI else ""),
"chempy" + ("==0.8.3" if CI else ""),
"scipy" + ("==1.10.1" if CI and not _32bit else ""),
"scipy"
+ (
{
8: "==1.10.1",
9: "==1.10.1",
10: "==1.10.1",
11: "==1.10.1",
12: "==1.13.0",
}[sys.version_info.minor]
if CI and not _32bit
else ""
),
"pyevtk" + ("==1.2.0" if CI else ""),
],
extras_require={
Expand Down

0 comments on commit f23c6b8

Please sign in to comment.