better error recovery for file encoding and bad json #1234
This file contains hidden or 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: | |
| push: | |
| branches: [main, beta] | |
| pull_request: | |
| branches: [main, beta] | |
| env: | |
| PACKAGES: | | |
| . | |
| packages/lectern | |
| packages/mecha | |
| packages/bolt | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Install dependencies | |
| run: uv sync --all-packages --locked --all-extras --dev | |
| - name: Tests | |
| run: | | |
| status=0 | |
| for p in $PACKAGES; do | |
| if ! (uv run --directory "$p" pytest -v); then | |
| status=1 | |
| fi | |
| done | |
| exit $status | |
| - name: Pyright | |
| run: uv run basedpyright --level error | |
| - name: Ruff | |
| run: uv run ruff check | |
| - name: Ruff format | |
| run: uv run ruff format --check --diff | |
| release: | |
| if: github.event_name == 'push' && github.repository == 'mcbeet/beet' | |
| needs: check | |
| concurrency: | |
| group: ${{ github.workflow }}-release-${{ github.ref_name }} | |
| cancel-in-progress: false | |
| environment: | |
| name: pypi | |
| permissions: | |
| id-token: write | |
| contents: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ github.ref_name }} | |
| fetch-depth: 0 | |
| - name: Reset workflow sha | |
| run: git reset --hard ${{ github.sha }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Install dependencies | |
| run: uv sync --all-packages --locked --all-extras --dev | |
| - name: Release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| for p in $PACKAGES; do | |
| uv run --directory "$p" bash -e <<"EOF" | |
| if semantic-release --strict version --no-commit --no-tag; then | |
| uv lock --upgrade-package $(uv version | cut -d " " -f1) | |
| git add "$GITHUB_WORKSPACE/uv.lock" | |
| grep "{ workspace = true }" pyproject.toml | { | |
| while read dep _; do | |
| uv add "$dep>=$(uv version --package $dep --short)" | |
| done | |
| } | |
| git add pyproject.toml | |
| uv build -o dist | |
| semantic-release --strict version | |
| uv publish dist/* | |
| semantic-release publish | |
| fi | |
| EOF | |
| done |