make ty happy #86
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: Main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*.*.*' | |
| jobs: | |
| checks: | |
| name: ${{ matrix.task.name }} - py${{ matrix.python}} | |
| runs-on: [ubuntu-latest] | |
| timeout-minutes: 5 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ['3.10', '3.12'] | |
| task: | |
| - name: Style | |
| run: | | |
| make style | |
| - name: Lint | |
| run: | | |
| make lint | |
| - name: Test | |
| run: | | |
| make test | |
| include: | |
| - python: '3.12' | |
| task: | |
| name: Build | |
| run: | | |
| make build | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: true | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Setup env | |
| run: | | |
| uv pip install --system --break-system-packages -e .[dev] | |
| - name: Show environment info | |
| shell: bash | |
| run: | | |
| # Show environment info. | |
| echo "✓ Using $(python --version) @ $(which python)" | |
| pip freeze | |
| - name: ${{ matrix.task.name }} | |
| run: | | |
| ${{ matrix.task.run }} | |
| - name: Upload package distribution files | |
| if: matrix.task.name == 'Build' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: package | |
| path: dist | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| needs: [checks] | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Dev install | |
| run: | | |
| make dev-install | |
| - name: Prepare environment | |
| run: | | |
| echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | |
| echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
| - name: Download package distribution files | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: package | |
| path: dist | |
| - name: Generate release notes | |
| run: | | |
| python src/scripts/release/release_notes.py > ${{ github.workspace }}-RELEASE_NOTES.md | |
| - name: Publish package to PyPI | |
| run: | | |
| twine upload -u __token__ -p '${{ secrets.PYPI_TOKEN }}' dist/* | |
| - name: Publish GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| body_path: ${{ github.workspace }}-RELEASE_NOTES.md | |
| prerelease: ${{ contains(env.TAG, 'rc') }} | |
| files: | | |
| dist/* |