add docs-generating script that allows for specifying input and outpu… #100
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: pypi | |
defaults: | |
run: | |
shell: bash | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
schedule: | |
- cron: '0 13 * * 4' | |
release: | |
types: [published] | |
jobs: | |
package: | |
strategy: | |
matrix: | |
packages-dir: [ ".", "examples" ] | |
fail-fast: false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
with: | |
submodules: recursive | |
fetch-depth: 0 # https://github.com/pypa/setuptools_scm/issues/480 | |
- uses: actions/[email protected] | |
with: | |
python-version: "3.12" | |
- run: pip install twine build | |
- name: run python -m build to generate wheel files, check for warnings | |
run: | | |
set -x | |
unset CI | |
cd ${{ matrix.packages-dir }} | |
python -m build 2>&1 | tee build.log | |
exit `fgrep -i warning build.log | grep -v impl_numba/warnings.py \ | |
| grep -v "no previously-included files matching" \ | |
| grep -v "version of {dist_name} already set" \ | |
| grep -v -E "UserWarning: version of PySDM(-examples)? already set" \ | |
| wc -l` | |
- run: twine check --strict ${{ matrix.packages-dir }}/dist/* | |
- name: check if version string does not contain PyPI-incompatible + char | |
run: | | |
set -x | |
[ `ls ${{ matrix.packages-dir }}/dist | fgrep + | tee /dev/stderr | wc -l` -ne 0 ] && exit 1 || echo OK | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ matrix.packages-dir }}/dist | |
name: dist-${{ matrix.packages-dir }} | |
pkg_install_check: | |
strategy: | |
matrix: | |
platform: [ ubuntu-latest, macos-13, macos-14, windows-latest ] | |
python-version: [ "3.9", "3.12" ] | |
exclude: | |
- platform: macos-14 | |
python-version: "3.9" | |
runs-on: ${{ matrix.platform }} | |
needs: [ package ] | |
steps: | |
- uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: dist-* | |
merge-multiple: true | |
path: dist | |
- 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__)" | |
publish: | |
runs-on: ubuntu-latest | |
needs: [ package, pkg_install_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: | |
attestations: false | |
repository_url: https://test.pypi.org/legacy/ | |
packages-dir: dist | |
- if: startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1.12 | |
with: | |
attestations: false | |
packages-dir: dist |