-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI workflows: do not run tests/examples on release (run only before a…
…nd after merging); move pdoc and pypi workflows to separate .yml files (#1461) Co-authored-by: Agnieszka Żaba <[email protected]>
- Loading branch information
1 parent
e82edae
commit 2329e47
Showing
4 changed files
with
185 additions
and
157 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: pdoc | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
schedule: | ||
- cron: '0 13 * * 4' | ||
|
||
jobs: | ||
pdoc: | ||
strategy: | ||
matrix: | ||
platform: [ ubuntu-latest, macos-13, windows-latest ] | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
submodules: recursive | ||
persist-credentials: false | ||
- uses: actions/[email protected] | ||
with: | ||
python-version: "3.12" | ||
- run: | | ||
pip install pdoc nbformat | ||
pip install -e . | ||
pip install -e examples | ||
python - <<EOF | ||
import glob, nbformat | ||
for notebook_path in glob.glob('examples/PySDM_examples/*/*.ipynb'): | ||
with open(notebook_path, encoding="utf8") as fin: | ||
with open(notebook_path + ".badges.md", 'w') as fout: | ||
fout.write(nbformat.read(fin, nbformat.NO_CONVERT).cells[0].source) | ||
EOF | ||
PDOC_ALLOW_EXEC=1 python -We -m pdoc -o html PySDM examples/PySDM_examples -t docs/templates --math --mermaid | ||
- if: ${{ github.ref == 'refs/heads/main' && matrix.platform == 'ubuntu-latest' }} | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: pdoc | ||
folder: html | ||
clean: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
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 | ||
|
||
- run: | | ||
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` | ||
twine check --strict dist/* | ||
- 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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: tests+artifacts+pypi | ||
name: tests | ||
|
||
defaults: | ||
run: | ||
|
@@ -11,8 +11,6 @@ on: | |
branches: [ main ] | ||
schedule: | ||
- cron: '0 13 * * 4' | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
precommit: | ||
|
@@ -30,64 +28,6 @@ jobs: | |
- if: ${{ failure() }} | ||
run: git diff | ||
|
||
nojit_and_codecov: | ||
needs: [precommit, pylint, devops] | ||
runs-on: ubuntu-latest | ||
env: | ||
NUMBA_DISABLE_JIT: 1 | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
submodules: recursive | ||
fetch-depth: 0 | ||
- uses: actions/[email protected] | ||
with: | ||
python-version: 3.9 | ||
- name: Generate coverage report | ||
run: | | ||
pip install -e .[tests] | ||
pip install -e ./examples | ||
pip install pytest-cov | ||
pytest --durations=10 -We tests/unit_tests --cov-report=xml --cov=PySDM | ||
- uses: codecov/[email protected] | ||
with: | ||
fail_ci_if_error: true | ||
verbose: true | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
pdoc: | ||
strategy: | ||
matrix: | ||
platform: [ubuntu-latest, macos-13, windows-latest] | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
submodules: recursive | ||
persist-credentials: false | ||
- uses: actions/[email protected] | ||
with: | ||
python-version: "3.12" | ||
- run: | | ||
pip install pdoc nbformat | ||
pip install -e . | ||
pip install -e examples | ||
python - <<EOF | ||
import glob, nbformat | ||
for notebook_path in glob.glob('examples/PySDM_examples/*/*.ipynb'): | ||
with open(notebook_path, encoding="utf8") as fin: | ||
with open(notebook_path + ".badges.md", 'w') as fout: | ||
fout.write(nbformat.read(fin, nbformat.NO_CONVERT).cells[0].source) | ||
EOF | ||
PDOC_ALLOW_EXEC=1 python -We -m pdoc -o html PySDM examples/PySDM_examples -t docs/templates --math --mermaid | ||
- if: ${{ github.ref == 'refs/heads/main' && matrix.platform == 'ubuntu-latest' }} | ||
uses: JamesIves/[email protected] | ||
with: | ||
BRANCH: pdoc | ||
FOLDER: html | ||
CLEAN: true | ||
|
||
pylint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
@@ -117,6 +57,18 @@ jobs: | |
# TODO #682 | ||
nbqa pylint --unsafe-load-any-extension=y --disable=fixme,duplicate-code,invalid-name,trailing-whitespace,line-too-long,missing-function-docstring,wrong-import-position,missing-module-docstring,wrong-import-order,ungrouped-imports,no-member,too-many-locals,unnecessary-lambda-assignment $(git ls-files '*.ipynb') | ||
devops: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
submodules: recursive | ||
fetch-depth: 0 # https://github.com/pypa/setuptools_scm/issues/480 | ||
- run: pip install -r tests/devops_tests/requirements.txt | ||
- env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: pytest --durations=10 -v -s -We -p no:unraisableexception -k "not test_run_notebooks" tests/devops_tests | ||
|
||
zenodo_json: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
@@ -126,8 +78,33 @@ jobs: | |
path: '.zenodo.json' | ||
prop_path: 'creators' | ||
|
||
nojit_and_codecov: | ||
needs: [precommit, pylint, devops, zenodo_json] | ||
runs-on: ubuntu-latest | ||
env: | ||
NUMBA_DISABLE_JIT: 1 | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
submodules: recursive | ||
fetch-depth: 0 | ||
- uses: actions/[email protected] | ||
with: | ||
python-version: 3.9 | ||
- name: Generate coverage report | ||
run: | | ||
pip install -e .[tests] | ||
pip install -e ./examples | ||
pip install pytest-cov | ||
pytest --durations=10 -We tests/unit_tests --cov-report=xml --cov=PySDM | ||
- uses: codecov/[email protected] | ||
with: | ||
fail_ci_if_error: true | ||
verbose: true | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
tests: | ||
needs: [pdoc, nojit_and_codecov, zenodo_json] | ||
needs: [nojit_and_codecov] | ||
strategy: | ||
matrix: | ||
platform: [ubuntu-latest, macos-13, macos-14, windows-latest] | ||
|
@@ -149,7 +126,7 @@ jobs: | |
test-suite: "unit_tests/!(dynamics)" | ||
fail-fast: false | ||
runs-on: ${{ matrix.platform }} | ||
timeout-minutes: ${{ startsWith(matrix.platform, 'windows-') && 40 || 25 }} | ||
timeout-minutes: ${{ startsWith(matrix.platform, 'windows-') && 40 || 40 }} | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
|
@@ -292,96 +269,3 @@ jobs: | |
run: | | ||
python -m pytest --durations=10 -v -p no:unraisableexception -We tests/examples_tests/test_tests_completeness.py | ||
python -m pytest --durations=10 -v -p no:unraisableexception -We tests/examples_tests/test_run* --suite ${{ matrix.test-suite }} | ||
devops: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
submodules: recursive | ||
fetch-depth: 0 # https://github.com/pypa/setuptools_scm/issues/480 | ||
- run: pip install -r tests/devops_tests/requirements.txt | ||
- env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: pytest --durations=10 -v -s -We -p no:unraisableexception -k "not test_run_notebooks" tests/devops_tests | ||
|
||
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 | ||
|
||
- run: | | ||
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` | ||
twine check --strict dist/* | ||
- 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: [tests, examples, 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 |
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