Skip to content

use PyMieScatt from repo instead of PyPI; add P3.13 to macOS CI #813

use PyMieScatt from repo instead of PyPI; add P3.13 to macOS CI

use PyMieScatt from repo instead of PyPI; add P3.13 to macOS CI #813

Workflow file for this run

name: tests+pypi
defaults:
run:
shell: bash
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 13 * * 4'
release:
types: [published]
jobs:
debug_build_ok:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0 # https://github.com/pypa/setuptools_scm/issues/480
- run: DEBUG=1 VERBOSE=1 pip install --verbose -e .[tests]
- run: pytest -v -s -We -p no:unraisableexception tests
zenodo_json:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: notiz-dev/github-action-json-property@release
with:
path: '.zenodo.json'
prop_path: 'creators'
build:
needs: [debug_build_ok, zenodo_json]
strategy:
matrix:
include:
- platform: windows-latest
python-version: "3.8"
- platform: windows-latest
python-version: "3.9"
- platform: windows-latest
python-version: "3.10"
- platform: windows-latest
python-version: "3.11"
- platform: windows-latest
python-version: "3.12"
- platform: macos-13
python-version: "3.8"
- platform: macos-13
python-version: "3.9"
- platform: macos-13
python-version: "3.10"
- platform: macos-13
python-version: "3.11"
- platform: macos-13
python-version: "3.12"
- platform: macos-13
python-version: "3.13"
- platform: macos-14
python-version: "3.10"
- platform: macos-14
python-version: "3.11"
- platform: macos-14
python-version: "3.12"
- platform: macos-14
python-version: "3.13"
- manylinux: "manylinux2010_x86_64"
platform: ubuntu-latest
python-version: "3.8"
- manylinux: "manylinux2010_x86_64"
platform: ubuntu-latest
python-version: "3.9"
- manylinux: "manylinux2010_x86_64"
platform: ubuntu-latest
python-version: "3.10"
- manylinux: "manylinux_2_24_x86_64"
platform: ubuntu-latest
python-version: "3.8"
- manylinux: "manylinux_2_24_x86_64"
platform: ubuntu-latest
python-version: "3.9"
- manylinux: "manylinux_2_24_x86_64"
platform: ubuntu-latest
python-version: "3.10"
- manylinux: "manylinux_2_24_x86_64"
platform: ubuntu-latest
python-version: "3.11"
fail-fast: false
runs-on: ${{ matrix.platform }}
steps:
- if: startsWith(matrix.platform, 'macos-')
run: |
brew reinstall gcc
for i in /Applications/Xcode_*.app; do sudo xcode-select -s "$i"; break; done;
echo MACOSX_DEPLOYMENT_TARGET=`sw_vers -productVersion` >> $GITHUB_ENV
echo ARCHFLAGS="-arch `uname -m`" >> $GITHUB_ENV # this seems to have no effect on whl name on Python 3.11!
- if: matrix.platform == 'windows-latest'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: false
install: >-
mingw-w64-x86_64-gcc-fortran
mingw-w64-x86_64-ninja
m4
- if: matrix.platform == 'windows-latest'
run: |
echo CMAKE_ARGS="-DCMAKE_MAKE_PROGRAM=D:/a/_temp/msys64/mingw64/bin/ninja.exe" >> $GITHUB_ENV
echo CMAKE_PROGRAM_PATH="D:/a/_temp/msys64/usr/bin" >> $GITHUB_ENV
echo CMAKE_GENERATOR="Ninja" >> $GITHUB_ENV
echo TEMP="D:/a/_temp/" >> $GITHUB_ENV
- uses: jwlawson/[email protected]
with:
cmake-version: '3.26.x'
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0 # https://github.com/pypa/setuptools_scm/issues/480
- uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- run: python -m pip install --upgrade pip==24.3.1
- run: python -m pip install $PIP_INSTALL_OPTS "build<1.1" wheel
- run: cmake --version
- run: |
unset CI
python -m build 2>&1 | tee build.log
exit `fgrep -i warning build.log | grep -v "WARNING setuptools_scm" | grep -v "-warnings" | grep -v "All Warnings are enabled" | wc -l`
- if: ${{ (matrix.platform == 'macos-13' && matrix.python-version == '3.11') || matrix.platform == 'macos-14' }}
run: |
# workaround for buggy universal2 wheel names (contain single arch binary only!)
for whl in dist/*_universal2.whl; do
export arch=`python -c 'import platform; print(platform.machine())'`;
export whl_new=${whl/_universal2/_$arch};
mv $whl $whl_new;
python -m wheel unpack $whl_new;
export whl_new_unpacked=`basename $whl_new | cut -d- -f-2`;
sed -i '' 's/_universal2/_$arch/g' $whl_new_unpacked/$whl_new_unpacked.dist-info/WHEEL;
python -m wheel pack $whl_new_unpacked;
done
- if: matrix.platform == 'ubuntu-latest'
run: rm dist/*
- if: matrix.platform == 'ubuntu-latest'
run: |
python -c "import sys; vi=sys.version_info; abitag='m' if vi.minor<8 else ''; print(f'PV=cp{vi.major}{vi.minor}-cp{vi.major}{vi.minor}{abitag}')" >> $GITHUB_ENV
- if: ${{ matrix.platform == 'ubuntu-latest' && matrix.manylinux == 'manylinux2010_x86_64' }}
uses: RalfG/[email protected]_x86_64
with:
python-versions: ${{ env.PV }}
build-requirements: 'setuptools_scm'
pre-build-command: 'git config --global --add safe.directory "*"'
- if: ${{ matrix.platform == 'ubuntu-latest' && matrix.manylinux == 'manylinux_2_24_x86_64' }}
uses: RalfG/[email protected]_2_24_x86_64
with:
python-versions: ${{ env.PV }}
build-requirements: 'setuptools_scm'
pre-build-command: 'git config --global --add safe.directory "*"'
- if: matrix.platform == 'ubuntu-latest'
run: rm dist/*-linux_*
# case sensitivity issue - avoid coexisting PyPartMC-... and pypartmc-... files
# https://github.com/pypi/warehouse/issues/15824
- run: rm -f dist/pypartmc*.tar.gz
- uses: actions/upload-artifact@v4
with:
name: dist-${{matrix.platform}}-${{matrix.manylinux}}-${{matrix.python-version}}
path: dist
- env:
SYSTEM_VERSION_COMPAT: 0
run: |
python -m pip debug --verbose
for i in dist/*.whl; do python -m pip install $PIP_INSTALL_OPTS $i[tests]; done;
python -m pip show --verbose PyPartMC
### make sure PyPartMC is not picked up from a local folder
- run: |
cd tests
python -c "import PyPartMC"
python -m pytest --durations=10 -v -s -We -p no:unraisableexception .
cd ..
- run: |
python -m pip install $PIP_INSTALL_OPTS -r gitmodules/devops_tests/requirements.txt
ex -sc 'g/^PyPartMC/d' -cx .binder/requirements.txt
python -m pip install $PIP_INSTALL_OPTS -r .binder/requirements.txt
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} python -m pytest --durations=10 -v -s -We -p no:unraisableexception gitmodules/devops_tests
### uncomment to gain ssh access in case of failure
# - if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: true
dist_check:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/[email protected]
with:
python-version: "3.11"
- run: pip install twine auditwheel
- uses: actions/download-artifact@v4
with:
pattern: dist-*
merge-multiple: true
path: dist
- run: twine check --strict dist/*
- run: for i in dist/*-manylinux*.whl; do auditwheel show $i; done;
dist_upload:
runs-on: ubuntu-latest
needs: [dist_check]
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: dist-*
merge-multiple: true
path: dist
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: pypa/gh-action-pypi-publish@release/v1.12
with:
repository_url: https://test.pypi.org/legacy/
attestations: false
- run: |
echo "github.event_name:" ${{ github.event_name }}
echo "github.event.action:" ${{ github.event.action }}
echo "github.event.prerelease:" ${{ github.event.prerelease }}
echo "env.GITHUB_REF:" ${{ env.GITHUB_REF }}
echo "env.GITHUB_REF:" ${{ env.GITHUB_REF_NAME }}
- if: github.event_name == 'release' && github.event.prerelease == false
uses: pypa/gh-action-pypi-publish@release/v1.12
with:
attestations: false