chore(deps): update github artifact actions (major) #322
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: Python checks | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| tags: [v*] | |
| pull_request: | |
| merge_group: | |
| env: | |
| FORCE_COLOR: 1 | |
| permissions: | |
| contents: read | |
| jobs: | |
| linting: | |
| runs-on: ubuntu-latest | |
| name: "Python linting" | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@2ddd2b9cb38ad8efd50337e8ab201519a34c9f24 # v7.1.1 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Set up Python π | |
| uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | |
| with: | |
| python-version-file: "pyproject.toml" | |
| - name: Check lock is up-to-date | |
| run: | | |
| uv lock --check | |
| - name: Install dependencies | |
| run: | | |
| uv sync | |
| echo "$PWD/.venv/bin" >> $GITHUB_PATH | |
| - name: Check file formatting | |
| uses: astral-sh/ruff-action@57714a7c8a2e59f32539362ba31877a1957dded1 # v3.5.1 | |
| with: | |
| args: "format --check" | |
| - name: Lint with ruff | |
| env: | |
| RUFF_OUTPUT_FORMAT: github | |
| run: | | |
| ruff check | |
| - name: Typecheck with pyright | |
| uses: jakebailey/pyright-action@6cabc0f01c4994be48fd45cd9dbacdd6e1ee6e5e # v2.3.3 | |
| with: | |
| version: PATH | |
| tests: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: ["ubuntu-latest", "windows-latest", "macos-latest"] | |
| python-version: ["3.11", "3.12", "3.13"] | |
| include: | |
| - extras_best_effort: false # If True, try to install each extra separately and skip those that fail to install | |
| skip_extras: '' # JSON array of extras not to install | |
| - os: macos-latest | |
| python-version: 3.13 | |
| extras_best_effort: true | |
| - os: windows-latest | |
| extras_best_effort: true | |
| - os: ubuntu-latest | |
| python-version: 3.13 | |
| # cvxopt wheel for 3.13 is bundled with GLPK 4.65, which has a known bug, see | |
| # https://github.com/cvxopt/cvxopt-wheels/issues/8 | |
| skip_extras: '["glpk-mi"]' | |
| name: Python tests (${{ matrix.python-version }}, ${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@2ddd2b9cb38ad8efd50337e8ab201519a34c9f24 # v7.1.1 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| python-version: ${{ matrix.python-version }} | |
| - name: Set up Python ${{ matrix.python-version }} π | |
| uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: uv sync | |
| - name: Install additional backends | |
| if: ${{ ! matrix.extras_best_effort && matrix.skip_extras == '' }} | |
| run: uv sync --all-extras | |
| - name: Install additional backends (best effort) | |
| if: ${{ matrix.extras_best_effort || matrix.skip_extras != '' }} | |
| env: | |
| NO_COLOR: 1 | |
| shell: bash | |
| run: | | |
| while read -r -a extra_deps; do | |
| extra_name="${extra_deps[0]}" | |
| if jq --exit-status --null-input --arg extra "${extra_name}" \ | |
| '${{ matrix.skip_extras && matrix.skip_extras || '[]' }} | contains([$extra])' > /dev/null; | |
| then | |
| echo "NOT installing $extra_name backend" | |
| continue | |
| fi | |
| deps=("${extra_deps[@]:1}") | |
| echo "::group::Installing $extra_name backend" | |
| uv pip install "${deps[@]}" \ | |
| || IFS=' ' echo "::warning title=Could not install $extra_name solver backend::Failed to install ${deps[*]}" | |
| echo "::endgroup::" | |
| done < <( | |
| # for each extra, output the extra name followed by the listed dependencies, space-separated | |
| uvx hatch project metadata \ | |
| | jq --raw-output '."optional-dependencies" | to_entries[] | "\(.key) \(.value | join(" "))"' | |
| ) | |
| - name: Test with pytest | |
| run: | | |
| # codecov requires that the test results are shared in xunit1 / legacy format. | |
| uv run pytest -v --junitxml=junit.xml -o junit_family=legacy | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Upload test results to Codecov | |
| if: ${{ !cancelled() }} | |
| uses: codecov/test-results-action@47f89e9acb64b76debcd5ea40642d25a4adced9f # v1.1.1 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| test-summary: | |
| name: Test matrix status | |
| runs-on: ubuntu-latest | |
| needs: | |
| - linting | |
| - tests | |
| if: always() | |
| steps: | |
| - name: Decide whether the needed jobs succeeded or failed | |
| uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2 | |
| with: | |
| jobs: ${{ toJSON(needs) }} | |
| build: | |
| name: Build distribution π¦ | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
| needs: | |
| - test-summary | |
| outputs: | |
| version: ${{ steps.note.outputs.version }} | |
| prerelease: ${{ steps.note.outputs.prerelease }} | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@2ddd2b9cb38ad8efd50337e8ab201519a34c9f24 # v7.1.1 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Set up Python π | |
| uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | |
| with: | |
| python-version-file: "pyproject.toml" | |
| - name: Install dependencies | |
| run: | | |
| uv sync | |
| - name: Build the Python π binary wheel and source tarball π¦ | |
| id: build-dist | |
| run: | | |
| uv build | |
| rm -f dist/.gitignore # get-releasenotes can't handle non-dist files here | |
| echo "version=$(uvx hatch version)" >> $GITHUB_OUTPUT | |
| - name: Check build | |
| run: uvx twine check --strict dist/* | |
| - name: Prepare Release Note | |
| id: note | |
| uses: aio-libs/get-releasenote@b0fcc7f3e5f5cc7c8b01e2f75516b1732f6bd8b2 # v1.4.5 | |
| with: | |
| changes_file: CHANGELOG.md | |
| output_file: release_notes.md | |
| version: ${{ steps.build-dist.outputs.version }} | |
| start_line: '<!-- changes go below this line -->' | |
| head_line: '## \[{version}\] - {date}' | |
| name: Rummikub Solver library | |
| dist_dir: dist | |
| - name: Store the Python π distribution π¦ | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: python-package-distributions | |
| path: | | |
| dist/ | |
| release_notes.md | |
| pypi-publish: | |
| name: Upload release to PyPI | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
| needs: | |
| - build | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/rummikub-solver | |
| permissions: | |
| id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
| contents: write # required for creating GH releases | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Download Python π distribution π¦ | |
| uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 | |
| with: | |
| name: python-package-distributions | |
| - name: Publish Python π distribution π¦ to PyPI | |
| uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 | |
| - name: GitHub release | |
| uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b # v1.20.0 | |
| with: | |
| name: Rummikub Solver library ${{ needs.build.outputs.version }} | |
| bodyFile: release_notes.md | |
| artifacts: dist/* | |
| prerelease: ${{ needs.build.outputs.prerelease }} |