Skip to content

Commit

Permalink
Update tooling (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
mondeja authored May 1, 2024
1 parent ec8b0a8 commit 4e3d009
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 62 deletions.
77 changes: 35 additions & 42 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5.0.0
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
Expand All @@ -30,41 +30,34 @@ jobs:
strategy:
fail-fast: false
matrix:
include:
- platform: ubuntu-latest
python-version: 3.8
py: py38
- platform: ubuntu-latest
python-version: 3.9
py: py39
- platform: ubuntu-latest
python-version: "3.10"
py: py310
- platform: ubuntu-latest
python-version: "3.11"
py: py311
- platform: macos-latest
python-version: 3.9
py: py39
- platform: macos-latest
python-version: "3.11"
py: py311
- platform: windows-latest
python-version: 3.8
py: py38
- platform: windows-latest
python-version: "3.11"
py: py311
py:
- 3.8
- 3.9
- "3.10"
- "3.11"
platform:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5.0.0
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: ${{ matrix.py }}
- name: Pick environment to run
id: env
shell: python
run: |
import codecs, os, sys
env = f"py=py3{sys.version_info[1]}\n"
print(f"Picked {env.split('=')[1].strip()} for {sys.version}")
with codecs.open(os.environ["GITHUB_OUTPUT"], "a", "utf-8") as file_handler:
file_handler.write(env)
- name: Install Hatch
run: pip install -U hatch
- name: Run tests
run: hatch run +py=${{ matrix.py }} tests:all
run: hatch run +py=${{ steps.env.outputs.py }} tests:all
- name: Convert coverage to XML
run: |
pip install coverage covdefaults
Expand All @@ -78,9 +71,9 @@ jobs:
name: Build documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5.0.0
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
Expand All @@ -89,7 +82,7 @@ jobs:
run: hatch run docs:build
env:
SPHINX_GITHUB_CHANGELOG_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v4.0.0
- uses: actions/upload-artifact@v4
with:
path: docs/_build/html/*

Expand All @@ -102,16 +95,16 @@ jobs:
name: Build package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/setup-python@v5.0.0
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Setup Python
with:
python-version: "3.11"
- name: Install dependencies
run: pip install -U hatch
- name: Build package
run: hatch build
- uses: actions/upload-artifact@v4.0.0
- uses: actions/upload-artifact@v4
with:
path: dist/*
name: distribution
Expand All @@ -121,7 +114,7 @@ jobs:
needs: build-dist
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4.1.0
- uses: actions/download-artifact@v4
with:
name: distribution
path: dist
Expand All @@ -137,7 +130,7 @@ jobs:
needs: build-dist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4
- name: Get tag metadata
id: tag
run: |
Expand All @@ -152,20 +145,20 @@ jobs:
TAG_BODY="${TAG_BODY//$'\r'/'%0D'}"
echo "body=$TAG_BODY" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v0.1.15
uses: softprops/action-gh-release@v2
id: create-release
with:
name: ${{ steps.tag.outputs.title }}
tag_name: ${{ steps.tag.outputs.title }}
body: ${{ steps.tag.outputs.body }}
draft: false
prerelease: false
- uses: actions/download-artifact@v4.1.0
- uses: actions/download-artifact@v4
name: Download builds
with:
name: distribution
path: dist
- uses: shogo82148/actions-upload-release-asset@v1.7.2
- uses: shogo82148/actions-upload-release-asset@v1
name: Upload release assets
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5.0.0
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
Expand All @@ -30,7 +30,7 @@ jobs:
id: get-version
run: echo "version=$(cat pyproject.toml | grep "version = " -m 1 | cut -d' ' -f3 | cut -c 2- | rev | cut -c 2- | rev)" >> $GITHUB_OUTPUT
- name: Deploy documentation
uses: peaceiris/actions-gh-pages@v3.9.3
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html
Expand All @@ -41,9 +41,9 @@ jobs:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5.0.0
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
Expand All @@ -53,7 +53,7 @@ jobs:
env:
SPHINX_GITHUB_CHANGELOG_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy documentation
uses: peaceiris/actions-gh-pages@v3.9.3
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pre-commit-autoupdate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ jobs:
autoupdate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5.0.0
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit autoupdate
run: pre-commit autoupdate
- name: Open pull request
uses: peter-evans/create-pull-request@v5.0.2
uses: peter-evans/create-pull-request@v5
with:
branch: pre-commit-autoupdate
title: Upgrade pre-commit hooks revisions
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update-copyright-years.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
update-license-year:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: FantasticFiasco/action-update-license-year@v3.0.2
- uses: FantasticFiasco/action-update-license-year@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .github/workflows/update-gh-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4
with:
token: ${{ secrets.UPDATE_GH_ACTIONS_TOKEN }}

- name: Run GitHub Actions Version Updater
uses: saadmk11/github-actions-version-updater@v0.8.1
with:
token: ${{ secrets.UPDATE_GH_ACTIONS_TOKEN }}
release_types: major
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ repos:
- id: check-useless-excludes
name: check-useless-excludes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
name: trailing-whitespace
Expand All @@ -40,7 +40,7 @@ repos:
files: \.bat$
name: "*.bat end of lines"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.0
rev: v0.4.2
hooks:
- id: ruff
args:
Expand All @@ -61,13 +61,13 @@ repos:
name: editorconfig-checker
alias: ec
- repo: https://github.com/tcort/markdown-link-check
rev: v3.11.2
rev: v3.12.1
hooks:
- id: markdown-link-check
name: markdown-link-check
files: ^README\.md$
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.12.1
rev: v0.13.0
hooks:
- id: markdownlint-cli2
name: markdownlint-po2md-tests
Expand Down
11 changes: 7 additions & 4 deletions src/mdpo/md2po/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,10 +870,13 @@ def text(self, block, text):
self.code_start_string,
text,
) - 1
self.current_msgid = '{}{}{}'.format(
self.current_msgid[:self._codespan_start_index],
self._codespan_backticks * self.code_start_string,
self.current_msgid[self._codespan_start_index:],
backticks = (
self._codespan_backticks * self.code_start_string
)
self.current_msgid = (
f'{self.current_msgid[:self._codespan_start_index]}'
f'{backticks}'
f'{self.current_msgid[self._codespan_start_index:]}'
)
if self._inside_aspan:
self._current_aspan_text += text
Expand Down

0 comments on commit 4e3d009

Please sign in to comment.