diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8eba091..ff12459 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,8 +10,12 @@ - docs/* workflow_dispatch: +# https://github.com/softprops/action-gh-release/issues/236 +permissions: + contents: write + env: - files: dist/* + PYTHONUTF8: "1" python-version: 3.x cache: pip @@ -40,10 +44,6 @@ jobs: - name: Test run: | pytest --cov - - name: Test for macOS and Linux - if: runner.os != 'Windows' - run: | - pre-commit run -a - uses: codecov/codecov-action@v3 build: needs: test @@ -74,13 +74,13 @@ jobs: if: ${{ ! startsWith(github.ref, 'refs/tags/') }} with: path: | - ${{ env.files }} + dist/* - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') with: + body_path: build/CHANGELOG.md files: | - ${{ env.files }} + dist/* - uses: pypa/gh-action-pypi-publish@release/v1 - if: startsWith(github.ref, 'refs/tags/') && runner.os == 'Linux' + if: runner.os == 'Linux' && startsWith(github.ref, 'refs/tags/') with: password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0c1bbcc..3608c77 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,23 +23,23 @@ repos: - id: check-toml - id: check-json - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.3.1 + rev: v1.4.2 hooks: - id: remove-crlf - repo: https://github.com/codespell-project/codespell - rev: v2.2.2 + rev: v2.2.4 hooks: - id: codespell additional_dependencies: - tomli - repo: https://github.com/jorisroovers/gitlint - rev: v0.18.0 + rev: v0.19.1 hooks: - id: gitlint args: - --msg-filename - repo: https://github.com/editorconfig-checker/editorconfig-checker.python - rev: 2.6.2 + rev: 2.7.1 hooks: - id: editorconfig-checker - repo: https://github.com/jumanjihouse/pre-commit-hooks @@ -47,7 +47,7 @@ repos: hooks: - id: check-mailmap - repo: https://github.com/adrienverge/yamllint - rev: v1.28.0 + rev: v1.30.0 hooks: - id: yamllint - repo: https://github.com/executablebooks/mdformat @@ -57,6 +57,7 @@ repos: args: - --number additional_dependencies: + - mdformat-gfm - mdformat-myst - mdformat-toc - mdformat-deflist @@ -69,32 +70,45 @@ repos: - id: markdownlint-cli2 additional_dependencies: - markdown-it-texmath@0.9.1 + - repo: https://github.com/Freed-Wu/pre-commit-hooks + rev: 0.0.10 + hooks: + - id: update-CITATION.cff + - id: update-pyproject.toml + - repo: https://github.com/perltidy/perltidy + rev: "20230309.02" + hooks: + - id: perltidy - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.1.0 hooks: - id: black - repo: https://github.com/PyCQA/isort - rev: 5.11.4 + rev: 5.12.0 hooks: - id: isort - repo: https://github.com/pycqa/pydocstyle - rev: 6.1.1 + rev: 6.3.0 hooks: - id: pydocstyle additional_dependencies: - - toml + - tomli - repo: https://github.com/kumaraditya303/mirrors-pyright - rev: v1.1.286 + rev: v1.1.300 hooks: - id: pyright - repo: https://github.com/PyCQA/bandit - rev: 1.7.4 + rev: 1.7.5 hooks: - id: bandit args: - -cpyproject.toml additional_dependencies: - - toml + - tomli + - repo: https://github.com/nix-community/nixpkgs-fmt + rev: v1.3.0 + hooks: + - id: nixpkgs-fmt ci: skip: diff --git a/pyproject.toml b/pyproject.toml index b0f7a7f..05d4286 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,9 +43,13 @@ write_to = "src/sphinxcontrib/eval/_version.py" [tool.setuptools.dynamic] dependencies = { file = "requirements.txt" } -[tool.setuptools.dynamic.optional-dependencies] -dev = { file = "requirements/dev.txt" } -myst = { file = "requirements/myst.txt" } +# begin: scripts/update-pyproject.toml.pl +[tool.setuptools.dynamic.optional-dependencies.dev] +file = "requirements/dev.txt" + +[tool.setuptools.dynamic.optional-dependencies.myst] +file = "requirements/myst.txt" +# end: scripts/update-pyproject.toml.pl [tool.black] line-length = 79 diff --git a/scripts/generate-CITATION.cff.pl b/scripts/generate-CITATION.cff.pl deleted file mode 100755 index 72017ce..0000000 --- a/scripts/generate-CITATION.cff.pl +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env -S perl -pi -unless ($#ARGV < 0) { - $name = $1 if /^name = "([^"]*+)"/; - $description = $1 if /^description = "([^"]*+)"/; - $url = $1 if /^Source = "([^"]*+)"/; - next; -}; -s/(?<=^title: ")([^"]*+)(?="$)/$name: $description/; -s/(?<=^url: ")([^"]*+)(?="$)/$url/; diff --git a/scripts/generate-api.md.pl b/scripts/generate-api.md.pl index c4cd780..f5a6281 100755 --- a/scripts/generate-api.md.pl +++ b/scripts/generate-api.md.pl @@ -1,5 +1,5 @@ #!/usr/bin/env -S perl -n -$. = 1 unless $#ARGV == $oldargc; +$. = 1 unless $#ARGV == $oldargc; $oldargc = $#ARGV; next unless $. == 1; $_ = $ARGV; diff --git a/scripts/generate-requirements.md.pl b/scripts/generate-requirements.md.pl deleted file mode 100755 index 95911f9..0000000 --- a/scripts/generate-requirements.md.pl +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env -S perl -p -$title = $ARGV; -$title =~ s=.*?requirements/(.*?)\.txt=$1=; -s`^([^#\n][^\s>=<^!^]*)`- [$1](https://pypi.org/project/$1)`; -s/^#\s*//; -s/^!.*/## $title/;