feat: get topology #237
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
| # This workflow runs for releasing the package to PyPI. | |
| # It triggers on workflow dispatch or when a tag matching 'v*.*.*' is pushed. | |
| name: release | |
| permissions: | |
| actions: read | |
| contents: write | |
| id-token: write | |
| pull-requests: read | |
| defaults: | |
| run: | |
| shell: bash | |
| on: | |
| workflow_dispatch: {} | |
| push: | |
| branches: | |
| - "main" | |
| - "v*-dev" | |
| tags: | |
| - "v*.*.*" | |
| paths-ignore: | |
| - "!.github/workflows/release.yml" | |
| - "deploy/**" | |
| - "docs/**" | |
| - "pack/**" | |
| - "**.md" | |
| - "**.mdx" | |
| - "**.png" | |
| - "**.jpg" | |
| - "**.jpeg" | |
| - "**.gif" | |
| - "**.webp" | |
| env: | |
| INPUT_PYTHON_VERSION: 3.11 | |
| INPUT_PROJECT: gpustack-runtime | |
| jobs: | |
| # Build wheel and source distributions, and upload them to PyPI and GitHub Releases. | |
| release: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| persist-credentials: false | |
| - name: Setup UV | |
| continue-on-error: true | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "0.8.24" | |
| enable-cache: true | |
| python-version: ${{ env.INPUT_PYTHON_VERSION }} | |
| - name: Build | |
| run: | | |
| make build | |
| - name: Release Assets | |
| if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| fail_on_unmatched_files: true | |
| prerelease: ${{ contains(github.ref, 'rc') }} | |
| files: | | |
| dist/*.gz | |
| dist/*.whl | |
| - name: Publish | |
| continue-on-error: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
| env: | |
| INPUT_TOKEN: ${{ startsWith(github.ref, 'refs/tags/') && secrets.CI_PYPI_API_TOKEN || secrets.CI_TEST_PYPI_API_TOKEN }} | |
| INPUT_INDEX: ${{ startsWith(github.ref, 'refs/tags/') && 'pypi' || 'testpypi' }} | |
| INPUT_WORKSPACE: ${{ github.workspace }}/gpustack_runtime | |
| INPUT_TEMPDIR: ${{ runner.temp }} | |
| run: | | |
| #!/usr/bin/env bash | |
| set -eo pipefail | |
| uv publish \ | |
| --index ${INPUT_INDEX} \ | |
| --token ${INPUT_TOKEN} || ${{ !startsWith(github.ref, 'refs/tags/') }} | |
| set -x | |
| cat ${INPUT_WORKSPACE}/_version.py | |
| cat ${INPUT_WORKSPACE}/_version_appendix.py | |
| set +x | |
| mkdir -p ${INPUT_TEMPDIR}/verify | |
| cat <<EOF > ${INPUT_TEMPDIR}/verify/verify.py | |
| import gpustack_runtime as runtime | |
| print(f"version = {runtime.version}") | |
| print(f"commit_id = {runtime.commit_id}") | |
| EOF | |
| sleep 30 | |
| EXTRA_ARGS=() | |
| if [[ "${INPUT_INDEX}" == "testpypi" ]]; then | |
| EXTRA_ARGS+=( | |
| "--index" "https://test.pypi.org/simple/" | |
| "--index-strategy" "unsafe-best-match" | |
| ) | |
| fi | |
| set -x | |
| uv run \ | |
| --index https://pypi.org/simple/ \ | |
| "${EXTRA_ARGS[@]}" \ | |
| --with ${INPUT_PROJECT} \ | |
| --isolated \ | |
| --no-project \ | |
| --active \ | |
| --verbose \ | |
| --script ${INPUT_TEMPDIR}/verify/verify.py |