Add --no-fuzzy
flag
#970
Workflow file for this run
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
name: CI | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: pip install -U hatch | |
- name: Lint | |
run: hatch run style:lint | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
test: | |
name: Test | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
fail-fast: false | |
matrix: | |
py: | |
- 3.8 | |
- 3.9 | |
- "3.10" | |
- "3.11" | |
platform: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
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=${{ steps.env.outputs.py }} tests:all | |
- name: Convert coverage to XML | |
# not currently installable on Python 3.9 | |
if: matrix.py != '3.9' | |
run: | | |
pip install coverage covdefaults | |
coverage xml | |
- name: Upload coverage | |
if: matrix.py != '3.9' | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
test-docs: | |
name: Build documentation | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: pip install -U hatch | |
- name: Build documentation | |
run: hatch run docs:build | |
env: | |
SPHINX_GITHUB_CHANGELOG_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: docs/_build/html/* | |
name: docs | |
build-wheel-sdist: | |
needs: | |
- test | |
- test-docs | |
name: Build package | |
runs-on: ubuntu-latest | |
steps: | |
- 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 | |
with: | |
path: dist/* | |
name: wheel-sdist | |
build-standalone-dist: | |
name: Build standalone | |
needs: | |
- test | |
- test-docs | |
runs-on: ${{ matrix.runs-on }} | |
strategy: | |
fail-fast: false | |
matrix: | |
runs-on: | |
- ubuntu-latest | |
# ARM | |
- macos-14 | |
# X86_64 | |
- macos-13 | |
- windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install PyInstaller | |
run: pip install -U pyinstaller | |
- name: Install UPX | |
if: matrix.runs-on == 'windows-latest' | |
shell: bash | |
run: choco install -y upx | |
- name: Install UPX | |
if: matrix.runs-on == 'ubuntu-latest' | |
run: sudo apt-get install -y upx-ucl | |
- name: Install package | |
run: pip install . | |
- name: Build standalone distribution | |
shell: bash | |
run: sh scripts/build.sh | |
- name: Compress with UPX | |
if: matrix.runs-on != 'macos-13' && matrix.runs-on != 'macos-14' | |
run: upx -f --best -9 dist/* | |
- if: matrix.runs-on == 'windows-latest' | |
run: | | |
mv dist/md2po.exe dist/md2po | |
mv dist/po2md.exe dist/po2md | |
mv dist/md2po2md.exe dist/md2po2md | |
mv dist/mdpo2html.exe dist/mdpo2html | |
- name: Prepare upload | |
run: | | |
mv dist/md2po dist/md2po-${{ matrix.runs-on }} | |
mv dist/po2md dist/po2md-${{ matrix.runs-on }} | |
mv dist/md2po2md dist/md2po2md-${{ matrix.runs-on }} | |
mv dist/mdpo2html dist/mdpo2html-${{ matrix.runs-on }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: dist/* | |
name: ${{ matrix.runs-on }}-build | |
if-no-files-found: error | |
overwrite: true | |
build-dist: | |
name: Build final distribution | |
runs-on: ubuntu-latest | |
needs: | |
- lint | |
- build-wheel-sdist | |
- build-standalone-dist | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: wheel-sdist | |
path: dist | |
- name: Download MacOS ARM artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: macos-14-build | |
path: ./build/mac-arm64 | |
- name: Download MacOS X86 artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: macos-13-build | |
path: ./build/mac-x86_64 | |
- name: Download Linux artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ubuntu-latest-build | |
path: ./build/linux | |
- name: Download Windows artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: windows-latest-build | |
path: ./build/windows | |
- name: Create Linux tarball | |
run: | | |
cd build/linux | |
mv md2po-ubuntu-latest md2po | |
mv po2md-ubuntu-latest po2md | |
mv md2po2md-ubuntu-latest md2po2md | |
mv mdpo2html-ubuntu-latest mdpo2html | |
cd ../.. | |
tar -czf dist/mdpo-linux-x86_64.tar.gz -C build/linux \ | |
md2po po2md md2po2md mdpo2html | |
- name: Create MacOS tarballs | |
run: | | |
cd build | |
mv mac-x86_64/md2po-macos-13 mac-x86_64/md2po | |
mv mac-arm64/md2po-macos-14 mac-arm64/md2po | |
mv mac-x86_64/po2md-macos-13 mac-x86_64/po2md | |
mv mac-arm64/po2md-macos-14 mac-arm64/po2md | |
mv mac-x86_64/md2po2md-macos-13 mac-x86_64/md2po2md | |
mv mac-arm64/md2po2md-macos-14 mac-arm64/md2po2md | |
mv mac-x86_64/mdpo2html-macos-13 mac-x86_64/mdpo2html | |
mv mac-arm64/mdpo2html-macos-14 mac-arm64/mdpo2html | |
tar -czf ../dist/mdpo-mac-x86_64.tar.gz -C mac-x86_64 \ | |
md2po po2md md2po2md mdpo2html | |
tar -czf ../dist/mdpo-mac-arm64.tar.gz -C mac-arm64 \ | |
md2po po2md md2po2md mdpo2html | |
- name: Create Windows zip | |
run: | | |
cd build/windows | |
mv md2po-windows-latest md2po.exe | |
mv po2md-windows-latest po2md.exe | |
mv md2po2md-windows-latest md2po2md.exe | |
mv mdpo2html-windows-latest mdpo2html.exe | |
7z a -tzip ../../dist/mdpo-windows-x86_64.zip \ | |
md2po.exe po2md.exe md2po2md.exe mdpo2html.exe | |
- name: Remove build directories | |
run: rm -rf build | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: ./dist | |
pypi-upload: | |
if: startsWith(github.ref, 'refs/tags/') | |
name: Upload to PyPI | |
needs: build-dist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
name: wheel-sdist | |
- uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
skip-existing: true | |
release: | |
if: startsWith(github.ref, 'refs/tags/') | |
name: Release | |
needs: build-dist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get tag metadata | |
id: tag | |
run: | | |
TAG_TITLE=${GITHUB_REF#refs/*/} | |
echo "title=$TAG_TITLE" >> $GITHUB_OUTPUT | |
git -c protocol.version=2 fetch --prune --progress \ | |
--no-recurse-submodules origin \ | |
+refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/* | |
TAG_BODY="$(git tag -l --format='%(contents)' $TAG_TITLE)" | |
TAG_BODY="${TAG_BODY//'%'/'%25'}" | |
TAG_BODY="${TAG_BODY//$'\n'/'%0A'}" | |
TAG_BODY="${TAG_BODY//$'\r'/'%0D'}" | |
echo "body=$TAG_BODY" >> $GITHUB_OUTPUT | |
- uses: actions/download-artifact@v4 | |
name: Download builds | |
with: | |
name: dist | |
path: ./dist | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: ${{ steps.tag.outputs.title }} | |
tag_name: ${{ steps.tag.outputs.title }} | |
body: ${{ steps.tag.outputs.body }} | |
draft: false | |
prerelease: false | |
files: | | |
dist/* |