Scaffold Docverse server and client packages #438
Workflow file for this run
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": | |
| merge_group: {} | |
| pull_request: {} | |
| push: | |
| branches-ignore: | |
| - "dependabot/**" | |
| - "renovate/**" | |
| - "u/**" | |
| tags: | |
| - "[0-9]*" | |
| - "client/[0-9]*" | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version-file: ".python-version" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Run linters | |
| run: uv run --only-group=lint pre-commit run --all-files | |
| test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version-file: ".python-version" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Run typing | |
| run: uv run --only-group=nox nox -s typing | |
| - name: Run tests | |
| run: uv run --only-group=nox nox -s test | |
| client-test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: | | |
| 3.12 | |
| 3.13 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Run client tests | |
| run: >- | |
| uv run --only-group=nox nox -s | |
| client_test | |
| client_test_compat | |
| client_test_oldest | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: [test, client-test] | |
| timeout-minutes: 15 | |
| # Build on server tags and ticket branch PRs (exclude client tags) | |
| if: > | |
| (startsWith(github.ref, 'refs/tags/') | |
| && !startsWith(github.ref, 'refs/tags/client/')) | |
| || github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Define the Docker tag | |
| id: vars | |
| run: | | |
| if [[ "$GITHUB_REF" == refs/tags/* ]]; then | |
| echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT" | |
| elif [[ "$GITHUB_HEAD_REF" != "" ]]; then | |
| echo "tag=${GITHUB_HEAD_REF}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "tag=${GITHUB_REF#refs/heads/}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| tags: | | |
| ghcr.io/lsst-sqre/docverse:${{ steps.vars.outputs.tag }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| client-publish: | |
| runs-on: ubuntu-latest | |
| needs: [test, client-test] | |
| timeout-minutes: 10 | |
| if: startsWith(github.ref, 'refs/tags/client/') | |
| environment: pypi | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version-file: ".python-version" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Build client package | |
| working-directory: client | |
| run: uv build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: client/dist/ |