diff --git a/.github/workflows/pdoc.yml b/.github/workflows/pdoc.yml new file mode 100644 index 000000000..03dd1bb34 --- /dev/null +++ b/.github/workflows/pdoc.yml @@ -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/checkout@v4.1.6 + with: + submodules: recursive + persist-credentials: false + - uses: actions/setup-python@v5.0.0 + with: + python-version: "3.12" + - run: | + pip install pdoc nbformat + pip install -e . + pip install -e examples + + python - <&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/setup-python@v5.0.0 + 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 diff --git a/.github/workflows/tests+artifacts+pypi.yml b/.github/workflows/tests.yml similarity index 73% rename from .github/workflows/tests+artifacts+pypi.yml rename to .github/workflows/tests.yml index f4e3ba599..7d7376f3b 100644 --- a/.github/workflows/tests+artifacts+pypi.yml +++ b/.github/workflows/tests.yml @@ -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/checkout@v4.1.6 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@v5.0.0 - 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/codecov-action@v4.5.0 - 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/checkout@v4.1.6 - with: - submodules: recursive - persist-credentials: false - - uses: actions/setup-python@v5.0.0 - with: - python-version: "3.12" - - run: | - pip install pdoc nbformat - pip install -e . - pip install -e examples - - python - <&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/setup-python@v5.0.0 - 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 diff --git a/tests/examples_tests/test_tests_completeness.py b/tests/examples_tests/test_tests_completeness.py index 82d397e9e..a7b66b4a0 100644 --- a/tests/examples_tests/test_tests_completeness.py +++ b/tests/examples_tests/test_tests_completeness.py @@ -45,7 +45,7 @@ def test_all_test_suites_are_on_ci(): .parent.parent.parent.absolute() .joinpath(".github") .joinpath("workflows") - .joinpath("tests+artifacts+pypi.yml") + .joinpath("tests.yml") ) with open(workflow_file_path, "r", encoding="utf8") as workflow_file: d = yaml.safe_load(workflow_file)