diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index af1efda5..049eb32b 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -2,7 +2,7 @@ name: Feature request about: Suggest an idea for this project title: "" -labels: "💡 Enhancement" +labels: "✨ Enhancement" assignees: "" --- diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index e79a4346..14b80852 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,5 +1,11 @@ - + - + diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index dfef8bc2..fdf67579 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -7,7 +7,7 @@ references: categories: - title: ✨ New features - label: 💡 Feature + label: ✨ Feature - title: ⚠️ Enhancements and optimizations label: ⚙️ Enhancement - title: ⚠️ API changes @@ -32,6 +32,8 @@ replacers: sort-direction: ascending template: | - _See all documentation for this version [here](https://pwa.rtfd.io)._ + _See all documentation for this version [here](https://PWA-pages.rtfd.io/en/$NEXT_PATCH_VERSION)._ $CHANGES + + _The full changelog as commits can be found [here](https://github.com/ComPWA/PWA-pages/compare/$PREVIOUS_TAG...$NEXT_PATCH_VERSION)._ diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 512f76ff..22fb1808 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -7,47 +7,12 @@ on: - released jobs: - push: - name: Push to version branches + milestone: if: startsWith(github.ref, 'refs/tags') - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - - name: Configure Git credentials - run: | - git config --global user.name "GitHub Action" - git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" - - name: Push to stable branch - run: | - git push origin HEAD:refs/heads/stable --force - - name: Push to matching minor version branch - env: - TAG: ${{ github.ref_name }} - run: | - re='^([0-9]+)\.([0-9]+)\.[0-9]+' - if [[ $TAG =~ $re ]]; then - MINOR_VERSION_BRANCH="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.x" - git push origin HEAD:refs/heads/$MINOR_VERSION_BRANCH --force - fi - + uses: ComPWA/actions/.github/workflows/close-milestone.yml@v1 pypi: - name: Publish to PyPI if: startsWith(github.ref, 'refs/tags') - needs: push - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build and publish - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - python setup.py sdist bdist_wheel - twine upload dist/* + uses: ComPWA/actions/.github/workflows/publish-to-pypi.yml@v1 + push: + if: startsWith(github.ref, 'refs/tags') && !github.event.release.prerelease + uses: ComPWA/actions/.github/workflows/push-to-version-branches.yml@v1 diff --git a/.github/workflows/ci-docs.yml b/.github/workflows/ci-docs.yml deleted file mode 100644 index 890a15c7..00000000 --- a/.github/workflows/ci-docs.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: CI-docs -env: - PYTHONHASHSEED: "0" - -on: - push: - branches: - - main - - epic/* - - "[0-9]+.[0-9]+.x" - pull_request: - branches: - - main - - epic/* - - "[0-9]+.[0-9]+.x" - workflow_dispatch: - -jobs: - documentation: - name: Build documentation and run notebooks - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - - uses: actions/cache@v3 - with: - key: | - ${{ github.workflow }}-${{ github.job }}-${{ runner.os }}-${{ hashFiles('.constraints/py3.*.txt', 'setup.cfg', 'src/**') }} - path: | - ./docs/_build - ~/.cache/pip/ - ~/.sympy-cache*/ - - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -c .constraints/py3.8.txt .[doc] tox - sudo apt-get -y install graphviz pandoc - - name: Build documentation and run notebooks - env: - GITHUB_REPO: ${{ github.event.pull_request.head.repo.full_name }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: tox -e docnb - - uses: actions/upload-artifact@v3 - if: ${{ always() }} - with: - name: html - path: docs/_build/html diff --git a/.github/workflows/ci-style.yml b/.github/workflows/ci-style.yml deleted file mode 100644 index f84fc691..00000000 --- a/.github/workflows/ci-style.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: pre-commit - -on: - push: - branches: - - main - - epic/* - - "[0-9]+.[0-9]+.x" - pull_request: - branches: - - main - - epic/* - - "[0-9]+.[0-9]+.x" - workflow_dispatch: - -jobs: - style: - name: Style checks - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - - uses: actions/cache@v3 - with: - key: | - ${{ github.workflow }}-${{ github.job }}-${{ runner.os }}-${{ hashFiles('.constraints/py3.*.txt', '.pre-commit-config.yaml') }} - path: | - .mypy_cache/ - ~/.cache/pip/ - ~/.cache/pre-commit/ - - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -c .constraints/py3.8.txt -e .[sty] - - name: Run non-local pre-commit hooks - run: |- - pre-commit run flake8 -a --color always - pre-commit run mypy -a --color always - pre-commit run pylint -a --color always - pre-commit run update-json-schema -a --color always - - name: Run pre-commit hooks that don't work on pre-commit.ci - run: |- - pre-commit run editorconfig-checker -a --color always - pre-commit run pyright -a --color always diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml deleted file mode 100644 index 2dc9535f..00000000 --- a/.github/workflows/ci-tests.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: pytest - -on: - push: - branches: - - main - - epic/* - pull_request: - branches: - - main - - epic/* - -jobs: - pytest: - name: Unit tests - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: - - ubuntu-20.04 - python-version: - - "3.7" - steps: - - uses: actions/checkout@v3 - - uses: actions/cache@v3 - with: - key: | - ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}-py${{ matrix.python-version }}-${{ hashFiles('.constraints/py3.*.txt', 'setup.cfg') }} - path: | - .pytest_cache - ~/.cache/pip/ - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -c .constraints/py${{ matrix.python-version }}.txt -e .[test] - - name: Run unit tests and doctests with pytest - run: pytest -n auto --cov=pwa_pages --cov-report=xml - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - if: matrix.python-version == '3.7' - uses: codecov/codecov-action@v3 - with: - file: ./coverage.xml - # cspell:ignore unittests - flags: unittests diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..5140f9bd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,39 @@ +name: CI + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + PYTHONHASHSEED: "0" + +on: + push: + branches: + - main + - epic/* + pull_request: + branches: + - main + - epic/* + workflow_dispatch: + inputs: + specific-pip-packages: + description: Run CI with specific pip packages + required: false + type: string + +jobs: + doc: + uses: ComPWA/actions/.github/workflows/ci-docs.yml@v1 + with: + specific-pip-packages: ${{ inputs.specific-pip-packages }} + pytest: + uses: ComPWA/actions/.github/workflows/pytest.yml@v1 + with: + coverage-target: pwa_pages + skipped-python-versions: all + specific-pip-packages: ${{ inputs.specific-pip-packages }} + style: + if: inputs.specific-pip-packages == '' + uses: ComPWA/actions/.github/workflows/pre-commit.yml@v1 diff --git a/.github/workflows/clean-caches.yml b/.github/workflows/clean-caches.yml new file mode 100644 index 00000000..a66c407b --- /dev/null +++ b/.github/workflows/clean-caches.yml @@ -0,0 +1,22 @@ +name: Clean caches + +on: + pull_request: + types: + - closed + workflow_dispatch: + inputs: + ref: + description: Clean caches for this branch name or ref + required: false + type: string + +jobs: + cleanup: + name: Remove caches + runs-on: ubuntu-22.04 + steps: + - uses: ComPWA/actions/clean-caches@v1 + with: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ref: ${{ inputs.ref }} diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml deleted file mode 100644 index 0617a4e0..00000000 --- a/.github/workflows/linkcheck.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Linkcheck - -on: - push: - branches: - - main - - epic/* - - "[0-9]+.[0-9]+.x" - pull_request: - branches: - - main - - epic/* - - "[0-9]+.[0-9]+.x" - workflow_dispatch: - -jobs: - check_links: - name: Check external links - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - - uses: actions/cache@v3 - with: - key: | - ${{ github.workflow }}-${{ github.job }}-${{ runner.os }}-${{ hashFiles('.constraints/py3.*.txt', 'setup.cfg') }} - path: | - ~/.cache/pip/ - - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -c .constraints/py3.8.txt -e .[doc] tox - sudo apt-get -y install graphviz pandoc - - name: Check external links - env: - GITHUB_REPO: ${{ github.event.pull_request.head.repo.full_name }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - BRANCH=main - if [[ "$GITHUB_HEAD_REF" != "" ]]; then - BRANCH=$GITHUB_HEAD_REF - fi - READTHEDOCS_VERSION=$BRANCH tox -e linkcheck diff --git a/.github/workflows/milestone.yml b/.github/workflows/milestone.yml deleted file mode 100644 index c83f13dc..00000000 --- a/.github/workflows/milestone.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Close Milestone on Release - -on: - release: - types: [published] - -jobs: - update-milestone: - runs-on: ubuntu-latest - steps: - # cspell:ignore mhutchie - - uses: mhutchie/update-milestone-on-release@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pr-linting.yml b/.github/workflows/pr-linting.yml index a8659294..9ee6fe93 100644 --- a/.github/workflows/pr-linting.yml +++ b/.github/workflows/pr-linting.yml @@ -19,7 +19,7 @@ jobs: - uses: docker://agilepathway/pull-request-label-checker:latest with: any_of: | - Bug,💡 Feature,⚠️ Interface,📝 Docs,🔨 Maintenance,🖱️ DX,📖 Analysis, + Bug,✨ Feature,⚠️ Interface,📝 Docs,🔨 Maintenance,🖱️ DX,📖 Analysis, 📖 Software,📖 Theory none_of: ❌ Won't fix,💫 Good first issue repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/requirements-cron.yml b/.github/workflows/requirements-cron.yml deleted file mode 100644 index dce0abb7..00000000 --- a/.github/workflows/requirements-cron.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: Requirements (scheduled) - -on: - schedule: - - cron: "0 3 7 */2 *" - workflow_dispatch: - -jobs: - pip-constraints: - name: Update pip constraints files - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: - python-version: - - "3.6" - - "3.7" - - "3.8" - - "3.9" - - "3.10" - steps: - - uses: actions/checkout@v3 - - uses: ComPWA/update-pip-constraints@main - with: - python-version: ${{ matrix.python-version }} - - pre-commit: - name: pre-commit autoupdate - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - - uses: ComPWA/update-pre-commit@main - - push: - name: Create PR - runs-on: ubuntu-20.04 - needs: - - pip-constraints - - pre-commit - steps: - - uses: actions/checkout@v3 - with: - token: ${{ secrets.PAT }} - # GITHUB_TOKEN will not rerun checks after pushing to a PR branch - - uses: actions/download-artifact@v3 - - run: ls -A - - name: Move artifacts to correct location - run: | - if [[ -d artifact ]]; then - cd artifact - ls -A - [[ -f .pre-commit-config.yaml ]] && mv -f .pre-commit-config.yaml .. - [[ "$(ls)" != "" ]] && mv -f * ../.constraints/ - fi - - run: git status -s - - name: Create Pull Request - uses: peter-evans/create-pull-request@v4 - with: - commit-message: "MAINT: update pip constraints and pre-commit" - committer: GitHub - author: GitHub - title: "MAINT: update pip constraints and pre-commit" - labels: | - 🔨 Maintenance - branch-suffix: timestamp - delete-branch: true - token: ${{ secrets.PAT }} - - name: Print PR info - run: | - echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" - echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" diff --git a/.github/workflows/requirements-pr.yml b/.github/workflows/requirements-pr.yml deleted file mode 100644 index 09663b9a..00000000 --- a/.github/workflows/requirements-pr.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Requirements (PR) - -on: - pull_request: - branches: - - main - - epic/* - - "[0-9]+.[0-9]+.x" - -jobs: - diff: - name: Check dependency changes - if: github.event.pull_request.head.repo.full_name == github.repository - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Determine dependency changes - run: | - echo 'diff<> $GITHUB_OUTPUT - git diff origin/main --color -- .constraints .pre-commit-config.yaml setup.cfg >> $GITHUB_OUTPUT - echo 'EOF' >> $GITHUB_OUTPUT - id: diff - outputs: - diff: ${{ steps.diff.outputs.diff }} - - pip-constraints: - name: Update pip constraints - needs: diff - if: > - github.event.pull_request.head.repo.full_name == github.repository && - needs.diff.outputs.diff != '' - # Only run if PR does not come from a fork - # https://docs.github.com/en/actions/security-guides/encrypted-secrets#using-encrypted-secrets-in-a-workflow - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: - python-version: - - "3.6" - - "3.7" - - "3.8" - - "3.9" - - "3.10" - steps: - - uses: actions/checkout@v3 - - uses: ComPWA/update-pip-constraints@main - with: - python-version: ${{ matrix.python-version }} - - pre-commit: - name: pre-commit autoupdate - needs: diff - if: > - github.event.pull_request.head.repo.full_name == github.repository && - needs.diff.outputs.diff != '' - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - - uses: ComPWA/update-pre-commit@main - - push: - name: Push changes - if: > - github.event.pull_request.head.repo.full_name == github.repository && - needs.diff.outputs.diff != '' - runs-on: ubuntu-20.04 - needs: - - diff - - pip-constraints - - pre-commit - steps: - - uses: actions/checkout@v3 - with: - token: ${{ secrets.PAT }} - # GITHUB_TOKEN will not rerun checks after pushing to a PR branch - - uses: actions/download-artifact@v3 - - name: Move artifacts to correct location - run: | - if [[ -d artifact ]]; then - cd artifact - ls -A - [[ -f .pre-commit-config.yaml ]] && mv -f .pre-commit-config.yaml .. - [[ "$(ls)" != "" ]] && mv -f * ../.constraints/ - fi - - run: git status -s - - name: Commit and push changes - run: | - git remote set-url origin https://x-access-token:${{ secrets.PAT }}@github.com/${{ github.repository }} - git config --global user.name "GitHub" - git config --global user.email "noreply@github.com" - git checkout -b ${GITHUB_HEAD_REF} - if [[ $(git status -s) ]]; then - git add -A - git commit -m "MAINT: update pip constraints and pre-commit" - git config pull.rebase true - git pull origin ${GITHUB_HEAD_REF} - git push origin HEAD:${GITHUB_HEAD_REF} - fi diff --git a/.github/workflows/requirements.yml b/.github/workflows/requirements.yml new file mode 100644 index 00000000..7f62c35a --- /dev/null +++ b/.github/workflows/requirements.yml @@ -0,0 +1,24 @@ +name: Requirements + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + pull_request: + branches: + - main + - epic/* + paths: + - .constraints/py3.*.txt + - .pre-commit-config.yaml + - setup.cfg + schedule: + - cron: "0 3 7 */2 *" + workflow_dispatch: + +jobs: + requirements: + uses: ComPWA/actions/.github/workflows/requirements.yml@v1 + secrets: + token: ${{ secrets.PAT }} diff --git a/.gitpod.yml b/.gitpod.yml index 3eed72fc..89406c3a 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -15,7 +15,6 @@ vscode: extensions: - bungcip.better-toml - christian-kohler.path-intellisense - - cschleiden.vscode-github-actions - davidanson.vscode-markdownlint - eamodio.gitlens - editorconfig.editorconfig diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 494c0ea2..4a72979f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,6 @@ ci: - pylint - update-json-schema # hooks that don't work on pre-commit.ci - - editorconfig-checker - pyright repos: @@ -42,32 +41,29 @@ repos: - id: trailing-whitespace - repo: https://github.com/ComPWA/repo-maintenance - rev: 0.0.159 + rev: 0.0.166 hooks: - id: check-dev-files args: + - --ci-skipped-tests=all + - --no-macos - --pin-requirements=bimonthly + - --repo-name=PWA-pages + - --repo-title=PWA Pages - id: fix-nbformat-version - id: format-setup-cfg - - repo: https://github.com/sirosen/check-jsonschema - rev: 0.19.2 - hooks: - - id: check-jsonschema - name: Check project inventory YAML files - language: python - files: docs/software/.*\.yml - types: [yaml] - args: ["--schemafile", "./docs/software/project-inventory-schema.json"] - - - repo: local + - repo: https://github.com/nbQA-dev/nbQA + rev: 1.5.3 hooks: - - id: update-json-schema - name: Update JSON schemas for project inventories - entry: export-json-schema - language: system - pass_filenames: false - files: (docs/software/.*\.json|src/pwa_pages/project_inventory.py) + - id: nbqa-black + additional_dependencies: + - black>=22.1.0 + - id: nbqa-flake8 + - id: nbqa-isort + - id: nbqa-pyupgrade + args: + - --py36-plus - repo: https://github.com/psf/black rev: 22.10.0 @@ -79,6 +75,16 @@ repos: hooks: - id: blacken-docs + - repo: https://github.com/sirosen/check-jsonschema + rev: 0.19.2 + hooks: + - id: check-jsonschema + name: Check project inventory YAML files + language: python + files: docs/software/.*\.yml + types: [yaml] + args: ["--schemafile", "./docs/software/project-inventory-schema.json"] + - repo: https://github.com/streetsidesoftware/cspell-cli rev: v6.14.1 hooks: @@ -135,18 +141,6 @@ repos: types: - python - - repo: https://github.com/nbQA-dev/nbQA - rev: 1.5.3 - hooks: - - id: nbqa-black - additional_dependencies: - - black>=22.1.0 - - id: nbqa-flake8 - - id: nbqa-isort - - id: nbqa-pyupgrade - args: - - --py36-plus - - repo: https://github.com/kynan/nbstripout rev: 0.6.1 hooks: @@ -202,3 +196,12 @@ repos: - id: pyupgrade args: - --py36-plus + + - repo: local + hooks: + - id: update-json-schema + name: Update JSON schemas for project inventories + entry: export-json-schema + language: system + pass_filenames: false + files: (docs/software/.*\.json|src/pwa_pages/project_inventory.py) diff --git a/.prettierrc b/.prettierrc index ebfaf680..ca09957f 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,2 +1 @@ printWidth: 88 -proseWrap: always diff --git a/.vscode/extensions.json b/.vscode/extensions.json index b45e7348..1c05e18c 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -2,7 +2,6 @@ "recommendations": [ "bungcip.better-toml", "christian-kohler.path-intellisense", - "cschleiden.vscode-github-actions", "davidanson.vscode-markdownlint", "eamodio.gitlens", "editorconfig.editorconfig", diff --git a/.vscode/settings.json b/.vscode/settings.json index 85f95c39..27cb996a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -75,6 +75,7 @@ }, "telemetry.telemetryLevel": "off", "yaml.schemas": { - "./docs/software/project-inventory-schema.json": ["docs/software/*.yml"] + "./docs/software/project-inventory-schema.json": ["docs/software/*.yml"], + "https://json.schemastore.org/github-workflow.json": "./.github/workflows/requirements.yml" } } diff --git a/docs/conf.py b/docs/conf.py index 7e940db0..21d35bbc 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -238,6 +238,7 @@ def get_minor_version(package_name: str) -> str: linkcheck_anchors = False linkcheck_ignore = [ "http://127.0.0.1:8000", + "http://cgl.soic.indiana.edu/jpac/References.html", "https://doi.org/10.1093/ptep/ptaa104", "https://home.fnal.gov/~kutschke/Angdist/angdist.ps", "https://physique.cuso.ch", @@ -247,6 +248,7 @@ def get_minor_version(package_name: str) -> str: # Settings for myst_nb nb_execution_timeout = -1 nb_output_stderr = "remove" +nb_execution_show_tb = True nb_execution_mode = "off" if "EXECUTE_NB" in os.environ: