Skip to content

Update to sync all dependencies for build #1872

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/actions/provenance/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Labelbox Python SDK Provenance Generation

inputs:
subjects:
required: true
type: string
runs:
using: "composite"
steps:
- name: upload
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0
with:
base64-subjects: "${{ inputs.subjects }}"
upload-assets: true
upload-tag-name: v.6.0.0 # Tag from the initiation of the workflow
189 changes: 189 additions & 0 deletions .github/workflows/lbox-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
name: LBox Publish

on:
workflow_dispatch:
inputs:
tag:
description: 'Release Tag'
required: true

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
id-token: write

jobs:
path-filter:
runs-on: ubuntu-latest
outputs:
lbox: ${{ true }}
test-matrix: ${{ steps.matrix.outputs.test-matrix }}
package-matrix: ${{ steps.matrix.outputs.publish-matrix }}
steps:
- uses: actions/checkout@v4
with:
# ref: ${{ inputs.tag }}
ref: ${{ inputs.tag }}
- uses: dorny/paths-filter@v3
id: filter
with:
ref: ${{ inputs.tag }}
list-files: 'json'
filters: |
lbox:
- 'libs/lbox*/**'
- id: matrix
uses: ./.github/actions/lbox-matrix
with:
files-changed: ${{ steps.filter.outputs.lbox_files }}
build:
runs-on: ubuntu-latest
needs: ['path-filter', 'test-build']
outputs:
hashes: ${{ steps.hash.outputs.hashes_lbox-clients }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.path-filter.outputs.package-matrix) }}
steps:
- uses: actions/checkout@v4
with:
# ref: ${{ inputs.tag }}
ref: ${{ inputs.tag }}
- name: Install the latest version of rye
uses: eifinger/setup-rye@v2
with:
version: ${{ vars.RYE_VERSION }}
enable-cache: true
- name: Rye Setup
run: |
rye config --set-bool behavior.use-uv=true
- name: Create build
working-directory: libs/${{ matrix.package }}
run: |
rye sync
rye build
- name: "Generate hashes"
id: hash
run: |
cd dist && echo "hashes_${{ matrix.package }}=$(sha256sum * | base64 -w0)" >> $GITHUB_OUTPUT
echo "hashes_${{ matrix.package }}=$(sha256sum * | base64 -w0)"
- uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.package }}
path: ./dist
provenance_python:
needs: [build]
permissions:
actions: read
contents: write
id-token: write # Needed to access the workflow's OIDC identity.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0
with:
base64-subjects: "${{ needs.build.outputs.hashes }}"
upload-assets: true
upload-tag-name: ${{ inputs.tag }} # Tag from the initiation of the workflow
provenance-name: lbox-clients.intoto.jsonl

test-build:
needs: ['path-filter']
if: ${{ needs.path-filter.outputs.lbox == 'true' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.path-filter.outputs.test-matrix) }}
concurrency:
group: lbox-staging-${{ matrix.python-version }}-${{ matrix.package }}
cancel-in-progress: false
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.ACTIONS_ACCESS_TOKEN }}
# ref: ${{ inputs.tag }}
ref: ${{ inputs.tag }}
- uses: ./.github/actions/python-package-shared-setup
with:
rye-version: ${{ vars.RYE_VERSION }}
python-version: ${{ matrix.python-version }}
- name: Format
run: rye format --check -v -p ${{ matrix.package }}
- name: Linting
run: rye lint -v -p ${{ matrix.package }}
- name: Unit
working-directory: libs/${{ matrix.package }}
run: rye run unit
- name: Integration
working-directory: libs/${{ matrix.package }}
env:
LABELBOX_TEST_API_KEY: ${{ secrets[matrix.api-key] }}
DA_GCP_LABELBOX_API_KEY: ${{ secrets[matrix.da-test-key] }}
LABELBOX_TEST_ENVIRON: 'staging'
run: rye run integration
pypi-publish:
runs-on: ubuntu-latest
needs: ['build', 'test-build', 'path-filter']
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.path-filter.outputs.package-matrix) }}
environment:
name: publish-${{ matrix.package }}
url: 'https://pypi.org/project/${{ matrix.package }}'
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: build-${{ matrix.package }}
path: ./artifact
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: artifact/
container-publish:
runs-on: ubuntu-latest
needs: ['build', 'path-filter']
if: ${{ needs.path-filter.outputs.lbox == 'true' }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.path-filter.outputs.package-matrix) }}
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
packages: write
steps:
- uses: actions/checkout@v4
with:
# ref: ${{ inputs.tag }}
ref: ${{ inputs.tag }}
- 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
id: build_container
with:
context: .
file: ./libs/${{ matrix.package }}/Dockerfile
github-token: ${{ secrets.GITHUB_TOKEN }}
push: true
platforms: |
linux/amd64
linux/arm64
tags: |
ghcr.io/labelbox/${{ matrix.package }}:latest
ghcr.io/labelbox/${{ matrix.package }}:${{ inputs.tag }}
- name: Output image
id: image
run: |
echo "ghcr.io/labelbox/${{ matrix.package }}:latest" >> "$GITHUB_STEP_SUMMARY"
echo "ghcr.io/labelbox/${{ matrix.package }}:${{ inputs.tag }}" >> "$GITHUB_STEP_SUMMARY"
2 changes: 1 addition & 1 deletion libs/lbox-clients/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# lbox-example
# lbox-clients

This is an example module which can be cloned and reused to develop modules under the `lbox` namespace.

Expand Down
1 change: 1 addition & 0 deletions libs/lbox-clients/src/lbox/request_client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# for the Labelbox Python SDK
import inspect
import json
import logging
Expand Down
Loading