feat: python scripts (#2) #5
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 | |
| permissions: {} | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| concurrency: | |
| group: "${{ github.workflow }}-${{ github.ref }}" | |
| cancel-in-progress: true | |
| env: | |
| PYTHON_VERSION: '3.14' | |
| jobs: | |
| release-setup: | |
| name: Release Setup | |
| outputs: | |
| publish_release: ${{ steps.release-setup.outputs.publish_release }} | |
| release_body: ${{ steps.release-setup.outputs.release_body }} | |
| release_commit: ${{ steps.release-setup.outputs.release_commit }} | |
| release_generate_release_notes: ${{ steps.release-setup.outputs.release_generate_release_notes }} | |
| release_tag: ${{ steps.release-setup.outputs.release_tag }} | |
| release_version: ${{ steps.release-setup.outputs.release_version }} | |
| permissions: | |
| contents: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Release Setup | |
| id: release-setup | |
| uses: LizardByte/actions/actions/release_setup@25babf9f2e9f088145ba488339c78c4df9394fc7 # v2026.524.145234 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| pytest: | |
| name: Pytest (${{ matrix.os }}) | |
| needs: | |
| - release-setup | |
| permissions: | |
| contents: read | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - macos-latest | |
| - ubuntu-latest | |
| - windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Set up Python | |
| id: setup-python | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 | |
| with: | |
| enable-cache: true | |
| - name: Sync Python tools | |
| env: | |
| UV_PYTHON: ${{ steps.setup-python.outputs.python-path }} | |
| run: uv sync --locked | |
| - name: Test with pytest | |
| id: test | |
| run: uv run --locked pytest | |
| - name: Upload test coverage | |
| # any except canceled or skipped | |
| if: >- | |
| always() && | |
| (steps.test.outcome == 'success' || steps.test.outcome == 'failure') && | |
| startsWith(github.repository, 'LizardByte/') | |
| uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1 | |
| with: | |
| disable_search: true | |
| fail_ci_if_error: true | |
| files: ./coverage/python-coverage.xml | |
| flags: ${{ runner.os }} | |
| report_type: coverage | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| verbose: true | |
| - name: Upload test results | |
| # any except canceled or skipped | |
| if: >- | |
| always() && | |
| (steps.test.outcome == 'success' || steps.test.outcome == 'failure') && | |
| startsWith(github.repository, 'LizardByte/') | |
| uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1 | |
| with: | |
| disable_search: true | |
| fail_ci_if_error: true | |
| files: ./junit-python.xml | |
| flags: ${{ runner.os }} | |
| report_type: test_results | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| verbose: true | |
| create-release: | |
| name: Create Release | |
| if: >- | |
| (github.event_name == 'push' && github.ref == 'refs/heads/master') && | |
| needs.release-setup.outputs.publish_release == 'true' | |
| needs: | |
| - release-setup | |
| - pytest | |
| permissions: {} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Create/Update GitHub Release | |
| uses: LizardByte/actions/actions/release_create@25babf9f2e9f088145ba488339c78c4df9394fc7 # v2026.524.145234 | |
| with: | |
| allowUpdates: true | |
| artifacts: '' | |
| body: ${{ needs.release-setup.outputs.release_body }} | |
| draft: true | |
| generateReleaseNotes: ${{ needs.release-setup.outputs.release_generate_release_notes }} | |
| name: ${{ needs.release-setup.outputs.release_tag }} | |
| prerelease: true | |
| tag: ${{ needs.release-setup.outputs.release_tag }} | |
| token: ${{ secrets.GH_BOT_TOKEN }} |