Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 6 additions & 1 deletion .github/actions/build-docs/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: Build Documentation
description: 'Build Documentation.'
description: 'Build Documentation for a package'
inputs:
workspace_path:
Comment thread
edwinokonkwo marked this conversation as resolved.
Outdated
description: 'Path to the package to build docs for.'
required: false
default: 'packages/sdk/server-ai'

runs:
using: composite
Expand Down
11 changes: 8 additions & 3 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Build distribution files
description: 'Build distribution files'
description: 'Build distribution files for a package'
inputs:
workspace_path:
description: 'Path to the package to build.'
required: true
outputs:
package-hashes:
description: "base64-encoded sha256 hashes of distribution files"
Expand All @@ -10,10 +14,11 @@ runs:
steps:
- name: Build distribution files
shell: bash
run: poetry build
run: make -C ${{ inputs.workspace_path }} build

- name: Hash build files for provenance
id: package-hashes
shell: bash
working-directory: ./dist
working-directory: ${{ inputs.workspace_path }}/dist
run: |
echo "package-hashes=$(sha256sum * | base64 -w0)" >> "$GITHUB_OUTPUT"
34 changes: 34 additions & 0 deletions .github/actions/ci/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Shared CI Workflow
description: 'Build, lint, and test a package'
inputs:
workspace_path:
description: 'Path to the package to build/test.'
required: true
python_version:
description: 'Python version to use'
required: false
default: '3.11'

runs:
using: composite
steps:
- name: Set up Python ${{ inputs.python_version }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python_version }}

- name: Install poetry
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439

- name: Install Dependencies
shell: bash
working-directory: ${{ inputs.workspace_path }}
run: poetry install

- name: Lint
shell: bash
run: make -C ${{ inputs.workspace_path }} lint

- name: Test
shell: bash
run: make -C ${{ inputs.workspace_path }} test
28 changes: 13 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,31 @@ on:
- '**.md'

jobs:
linux:
server-ai-linux:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install poetry
Comment thread
edwinokonkwo marked this conversation as resolved.
Outdated
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439

- uses: ./.github/actions/build
- uses: ./.github/actions/build-docs
- uses: ./.github/actions/ci
with:
workspace_path: packages/sdk/server-ai
python_version: ${{ matrix.python-version }}

- name: Run tests
run: make test
- uses: ./.github/actions/build
with:
workspace_path: packages/sdk/server-ai

- name: Verify typehints
run: make lint
- uses: ./.github/actions/build-docs

windows:
server-ai-windows:
runs-on: windows-latest

defaults:
run:
shell: powershell
Expand All @@ -50,6 +46,7 @@ jobs:

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand All @@ -59,7 +56,8 @@ jobs:
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439

- name: Install requirements
working-directory: packages/sdk/server-ai
run: poetry install

- name: Run tests
run: make test
run: make -C packages/sdk/server-ai test
161 changes: 129 additions & 32 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -1,67 +1,164 @@
name: Run Release Please
# This workflow handles both automated and manual package publishing:
#
# AUTOMATED PUBLISHING (on push to main):
# - Triggered automatically when changes are pushed to the main branch
# - Uses release-please to create releases based on conventional commits
# - Publishes packages to PyPI automatically when release PRs are merged
#
# MANUAL PUBLISHING (via workflow_dispatch):
# - Can be triggered manually from the Actions tab
# - Allows publishing a specific package to PyPI
# - Supports dry-run mode
#
name: release-please

on:
push:
branches: [ main ]
branches:
- main
workflow_dispatch:
inputs:
workspace_path:
description: 'The workspace to publish'
required: true
default: 'packages/sdk/server-ai'
type: choice
options:
- packages/sdk/server-ai
- packages/ai-providers/server-ai-langchain
dry_run:
description: 'Is this a dry run. If so no package will be published.'
type: boolean
required: true

jobs:
release-package:
release-please:
runs-on: ubuntu-latest
permissions:
Comment thread
edwinokonkwo marked this conversation as resolved.
id-token: write # Needed if using OIDC to get release secrets.
contents: write # Contents and pull-requests are for release-please to make releases.
pull-requests: write
if: github.event_name == 'push'
outputs:
release-created: ${{ steps.release.outputs.release_created }}
upload-tag-name: ${{ steps.release.outputs.tag_name }}
package-hashes: ${{ steps.build.outputs.package-hashes}}
package-server-ai-released: ${{ steps.release.outputs['packages/sdk/server-ai--release_created'] }}
package-server-ai-langchain-released: ${{ steps.release.outputs['packages/ai-providers/server-ai-langchain--release_created'] }}
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{secrets.GITHUB_TOKEN}}
Comment thread
edwinokonkwo marked this conversation as resolved.
Outdated

release-server-ai:
runs-on: ubuntu-latest
needs: ['release-please']
permissions:
Comment thread
edwinokonkwo marked this conversation as resolved.
id-token: write
contents: write
if: ${{ needs.release-please.outputs.package-server-ai-released == 'true' }}
steps:
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.releases_created == 'true' }}
with:
fetch-depth: 0 # If you only need the current version keep this.
fetch-depth: 0

- uses: actions/setup-python@v5
if: ${{ steps.release.outputs.releases_created == 'true' }}
with:
python-version: 3.9
python-version: '3.11'

- name: Install poetry
if: ${{ steps.release.outputs.releases_created == 'true' }}
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439

- uses: ./.github/actions/ci
with:
workspace_path: packages/sdk/server-ai

- uses: ./.github/actions/build
id: build
with:
workspace_path: packages/sdk/server-ai

- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.2.0
if: ${{ steps.release.outputs.releases_created == 'true' }}
name: 'Get PyPI token'
with:
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
ssm_parameter_pairs: '/production/common/releasing/pypi/token = PYPI_AUTH_TOKEN'

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ env.PYPI_AUTH_TOKEN }}
packages-dir: packages/sdk/server-ai/dist/

release-server-ai-langchain:
runs-on: ubuntu-latest
needs: ['release-please', 'release-server-ai']
Comment thread
edwinokonkwo marked this conversation as resolved.
Outdated
permissions:
Comment thread
edwinokonkwo marked this conversation as resolved.
id-token: write
contents: write
if: ${{ always() && !failure() && !cancelled() && needs.release-please.outputs.package-server-ai-langchain-released == 'true' }}
Comment thread
edwinokonkwo marked this conversation as resolved.
Outdated
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install poetry
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439

- uses: ./.github/actions/ci
with:
workspace_path: packages/ai-providers/server-ai-langchain

- uses: ./.github/actions/build
id: build
if: ${{ steps.release.outputs.releases_created == 'true' }}
with:
workspace_path: packages/ai-providers/server-ai-langchain

- uses: ./.github/actions/build-docs
if: ${{ steps.release.outputs.releases_created == 'true' }}
- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.2.0
name: 'Get PyPI token'
with:
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
ssm_parameter_pairs: '/production/common/releasing/pypi/token = PYPI_AUTH_TOKEN'

- name: Publish package distributions to PyPI
if: ${{ steps.release.outputs.releases_created == 'true' }}
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Comment thread
edwinokonkwo marked this conversation as resolved.
Outdated
with:
password: ${{env.PYPI_AUTH_TOKEN}}
password: ${{ env.PYPI_AUTH_TOKEN }}
packages-dir: packages/ai-providers/server-ai-langchain/dist/

release-provenance:
Comment thread
edwinokonkwo marked this conversation as resolved.
needs: [ 'release-package' ]
if: ${{ needs.release-package.outputs.release-created == 'true' }}
manual-publish:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing to note is doing a manual publish as written will not generate the release provenance. I'm not going to block on this but we should fix it in a separate PR once we get the Langchain provider work completed.

runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
permissions:
actions: read
id-token: write
contents: write
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0
with:
base64-subjects: "${{ needs.release-package.outputs.package-hashes }}"
upload-assets: true
upload-tag-name: ${{ needs.release-package.outputs.upload-tag-name }}
contents: read
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install poetry
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439

- uses: ./.github/actions/ci
with:
workspace_path: ${{ inputs.workspace_path }}

- uses: ./.github/actions/build
id: build
with:
workspace_path: ${{ inputs.workspace_path }}

- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.2.0
if: ${{ inputs.dry_run != true }}
name: 'Get PyPI token'
with:
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
ssm_parameter_pairs: '/production/common/releasing/pypi/token = PYPI_AUTH_TOKEN'

- name: Publish to PyPI
if: ${{ inputs.dry_run != true }}
uses: pypa/gh-action-pypi-publish@release/v1
Comment thread
edwinokonkwo marked this conversation as resolved.
Outdated
with:
password: ${{ env.PYPI_AUTH_TOKEN }}
packages-dir: ${{ inputs.workspace_path }}/dist/
3 changes: 2 additions & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
".": "0.10.1"
"packages/sdk/server-ai": "0.10.1",
"packages/ai-providers/server-ai-langchain": "0.1.0"
}
Loading
Loading