find_best_match was using extractOne (which maximises its scorer) with Levenshtein distance (lower = better), so it returned the worst match instead of the best. Switch to extract+min to correctly minimise distance. Fixes 6 failing tests in test_text_correction.py. CI: run pytest under `coverage run` so coverage.xml has data to report; drop deprecated use-only-tar-bz2 flag from setup-miniconda steps. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
99 lines
2.9 KiB
YAML
99 lines
2.9 KiB
YAML
name: Botty - CI
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [main, mine]
|
|
release:
|
|
types: [published]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Miniconda Python 3.10
|
|
uses: conda-incubator/setup-miniconda@v3
|
|
with:
|
|
python-version: '3.10'
|
|
activate-environment: botty
|
|
channel-priority: strict
|
|
environment-file: environment.yml
|
|
use-only-tar-bz2: false
|
|
|
|
- name: Download test assets
|
|
shell: powershell
|
|
env:
|
|
PYTHONPATH: ./src
|
|
run: |
|
|
C:\Miniconda\condabin\conda.bat activate botty
|
|
python -c "import utils.download_test_assets"
|
|
|
|
- name: Pytest
|
|
shell: powershell
|
|
env:
|
|
PYTHONPATH: ./src
|
|
run: |
|
|
C:\Miniconda\condabin\conda.bat activate botty
|
|
python -c "import sys; print(sys.version)"
|
|
coverage run -m pytest test/smoke_test.py test/nip/ test/game_stats_test.py test/closest_non_hud_test.py test/transmute/ -v -s
|
|
|
|
- name: Coverage
|
|
shell: powershell
|
|
env:
|
|
PYTHONPATH: ./src
|
|
run: |
|
|
C:\Miniconda\condabin\conda.bat activate botty
|
|
coverage xml
|
|
|
|
build:
|
|
needs: test
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Miniconda Python 3.10
|
|
uses: conda-incubator/setup-miniconda@v3
|
|
with:
|
|
python-version: '3.10'
|
|
activate-environment: botty
|
|
channel-priority: strict
|
|
environment-file: environment.yml
|
|
use-only-tar-bz2: false
|
|
|
|
- name: Build exe
|
|
shell: powershell
|
|
env:
|
|
BOTTY_NO_RENAME: '1'
|
|
PYTHONPATH: ./src
|
|
run: |
|
|
C:\Miniconda\condabin\conda.bat activate botty
|
|
python build.py --conda_path C:\Miniconda
|
|
|
|
- name: Prepare release zip
|
|
shell: powershell
|
|
run: |
|
|
$BOTTY_DIR = Get-ChildItem -Directory -Name | Where-Object { $_ -match '^botty_v' } | Select-Object -First 1
|
|
Write-Host "Botty dir: $BOTTY_DIR"
|
|
Get-ChildItem -Path $BOTTY_DIR -Recurse | Select-Object -Property FullName, Length
|
|
$ZIP = "${BOTTY_DIR}.zip"
|
|
Compress-Archive -Path "${BOTTY_DIR}\*" -DestinationPath $ZIP -Force
|
|
Write-Host "Release zip: $ZIP"
|
|
Get-Item $ZIP | Select-Object -Property FullName, Length
|
|
|
|
- name: Upload build artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: botty-build
|
|
path: botty_v*/
|
|
retention-days: 7
|
|
|
|
- name: Upload to Release
|
|
if: github.event_name == 'release'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
shell: bash
|
|
run: |
|
|
BOTTY_DIR=$(ls -d botty_v* | head -1)
|
|
gh release upload "${{ github.event.release.tag_name }}" "${BOTTY_DIR}.zip" --clobber
|