[PLT-0] Improve Overall Dev-X By Using Rye #1
Workflow file for this run
This file contains 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: Labelbox Python SDK Staging (Develop) | |
on: | |
push: | |
branches: [develop] | |
pull_request: | |
branches: [develop] | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- python-version: 3.8 | |
api-key: STAGING_LABELBOX_API_KEY_2 | |
da-test-key: DA_GCP_LABELBOX_API_KEY | |
- python-version: 3.9 | |
api-key: STAGING_LABELBOX_API_KEY_3 | |
da-test-key: DA_GCP_LABELBOX_API_KEY | |
- python-version: "3.10" | |
api-key: STAGING_LABELBOX_API_KEY_4 | |
da-test-key: DA_GCP_LABELBOX_API_KEY | |
- python-version: 3.11 | |
api-key: STAGING_LABELBOX_API_KEY | |
da-test-key: DA_GCP_LABELBOX_API_KEY | |
- python-version: 3.12 | |
api-key: STAGING_LABELBOX_API_KEY_5 | |
da-test-key: DA_GCP_LABELBOX_API_KEY | |
uses: ./.github/workflows/python-package-shared.yml | |
with: | |
python-version: ${{ matrix.python-version }} | |
api-key: ${{ matrix.api-key }} | |
da-test-key: ${{ matrix.da-test-key }} | |
fixture-profile: true | |
test-env: 'staging' | |
secrets: inherit | |
test-pypi: | |
runs-on: ubuntu-latest | |
if: github.event == 'push' | |
needs: ['build'] | |
environment: | |
name: Test-PyPI | |
url: 'https://test.pypi.org/p/labelbox-test' | |
permissions: | |
# IMPORTANT: this permission is mandatory for trusted publishing | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.ACTIONS_ACCESS_TOKEN }} | |
ref: ${{ github.head_ref }} | |
- name: Install the latest version of rye | |
uses: eifinger/setup-rye@v2 | |
with: | |
version: '0.29.0' | |
enable-cache: true | |
- name: Rye Setup | |
run: | | |
rye config --set-bool behavior.use-uv=true | |
- name: Create build | |
id: create-build | |
working-directory: libs/labelbox | |
run: | | |
VERSION=$(date +"%Y.%m.%d.%H.%M") | |
echo "pip install --index-url https://test.pypi.org/simple/ labelbox-test@$VERSION" >> "$GITHUB_STEP_SUMMARY" | |
rye sync | |
rye version "$VERSION" | |
rye run toml set --toml-path pyproject.toml project.name labelbox-test | |
rye build | |
- name: Publish package distributions to Test PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages-dir: dist/ | |
repository-url: https://test.pypi.org/legacy/ | |
test-container: | |
runs-on: ubuntu-latest | |
if: github.event == 'push' | |
needs: ['build'] | |
env: | |
CONTAINER_IMAGE: "ghcr.io/${{ github.repository }}" | |
steps: | |
- name: downcase CONTAINER_IMAGE | |
run: | | |
echo "CONTAINER_IMAGE=${CONTAINER_IMAGE,,}" >> ${GITHUB_ENV} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
push: true | |
platforms: | | |
linux/amd64 | |
linux/arm64 | |
tags: | | |
${{ env.CONTAINER_IMAGE }}:develop | |
${{ env.CONTAINER_IMAGE }}:${{ github.sha }} |