Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
31 changes: 31 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.git
**/node_modules
**/dist
**/coverage
**/.pytest_cache
**/__pycache__
**/*.pyc
**/*.tsbuildinfo
*.log

# === Python virtualenvs + caches (added by setup) ===
.venv
.venv/
.venv*/
**/.venv
**/.venv/
**/.venv*/
venv
venv/
**/venv
**/venv/
__pycache__/
**/__pycache__/
*.pyc
*.pyo
.pytest_cache/
**/.pytest_cache/
.ruff_cache/
**/.ruff_cache/
.mypy_cache/
**/.mypy_cache/
287 changes: 287 additions & 0 deletions .github/workflows/release-sdks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,287 @@
name: Release SDKs

on:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: write
id-token: write
packages: write

concurrency:
group: release-sdks-${{ github.ref }}
cancel-in-progress: false

jobs:
package-checks:
name: Package checks
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
cache-dependency-path: python/pyproject.toml

- name: Install Python SDK
run: |
python -m pip install --upgrade pip
python -m pip install -e ./python pytest build

- name: Run Python tests
run: PYTHONPATH=python pytest -q python/tests

- name: Build Python package
run: python -m build python

- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 10.12.1
run_install: false

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: pnpm
cache-dependency-path: typescript/pnpm-lock.yaml

- name: Install TypeScript SDK
working-directory: typescript/futureagi
run: pnpm install --frozen-lockfile --ignore-scripts

- name: Type check TypeScript SDK
working-directory: typescript/futureagi
run: pnpm run typecheck

- name: Run TypeScript tests
working-directory: typescript/futureagi
run: pnpm test --runInBand

- name: Build TypeScript SDK
working-directory: typescript/futureagi
run: pnpm run build

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
cache-dependency-path: go/futureagi/go.sum

- name: Test Go SDK
working-directory: go/futureagi
run: go test ./...

- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
cache: maven
cache-dependency-path: java/futureagi/pom.xml

- name: Build Java SDK
run: mvn -B -f java/futureagi/pom.xml -DskipTests package

python-compliance:
name: Python SDK compliance
uses: future-agi/futureagi-sdk-test-harness/.github/workflows/test-sdk.yml@main
with:
adapter-dockerfile: tests/compliance/python/Dockerfile
adapter-context: "."
report-name: futureagi-sdk-python-release-compliance-report

typescript-compliance:
name: TypeScript SDK compliance
uses: future-agi/futureagi-sdk-test-harness/.github/workflows/test-sdk.yml@main
with:
adapter-dockerfile: typescript/futureagi/tests/compliance/Dockerfile
adapter-context: "."
report-name: futureagi-sdk-typescript-release-compliance-report

publish-python:
name: Publish Python SDK
needs:
- package-checks
- python-compliance
- typescript-compliance
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Build Python package
run: |
python -m pip install --upgrade pip build
python -m build python

- name: Publish Python package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: python/dist
skip-existing: true

publish-typescript:
name: Publish TypeScript SDK
needs:
- package-checks
- python-compliance
- typescript-compliance
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
working-directory: typescript/futureagi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 10.12.1
run_install: false

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: pnpm
cache-dependency-path: typescript/pnpm-lock.yaml
registry-url: https://registry.npmjs.org

- name: Install TypeScript SDK
run: pnpm install --frozen-lockfile --ignore-scripts

- name: Build TypeScript SDK
run: pnpm run build

- name: Check npm package version
id: npm-version
run: |
PACKAGE_NAME="$(node -p "require('./package.json').name")"
PACKAGE_VERSION="$(node -p "require('./package.json').version")"
if npm view "${PACKAGE_NAME}@${PACKAGE_VERSION}" version >/dev/null 2>&1; then
echo "exists=true" >> "$GITHUB_OUTPUT"
echo "${PACKAGE_NAME}@${PACKAGE_VERSION} already exists on npm; skipping publish."
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi

- name: Require npm token
if: steps.npm-version.outputs.exists != 'true'
run: |
if [ -z "${NODE_AUTH_TOKEN}" ]; then
echo "::error::NPM_TOKEN is required to publish a new TypeScript SDK version."
exit 1
fi

- name: Publish TypeScript package to npm
if: steps.npm-version.outputs.exists != 'true'
run: pnpm publish --access public --provenance --no-git-checks

release-go:
name: Release Go SDK module tag
needs:
- package-checks
- python-compliance
- typescript-compliance
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Resolve Go SDK version
id: go-version
run: |
VERSION="$(sed -n 's/.*packageVersion=\([^,]*\).*/\1/p' scripts/generate-go-java-sdk.sh | head -n 1)"
if [ -z "${VERSION}" ]; then
echo "::error::Could not resolve Go SDK packageVersion from scripts/generate-go-java-sdk.sh."
exit 1
fi
TAG="go/futureagi/v${VERSION}"
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"

- name: Push Go module tag
run: |
TAG="${{ steps.go-version.outputs.tag }}"
git fetch --tags origin
if git rev-parse "${TAG}" >/dev/null 2>&1; then
echo "${TAG} already exists; skipping Go module release."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag "${TAG}" "${GITHUB_SHA}"
git push origin "${TAG}"

publish-java:
name: Publish Java SDK
needs:
- package-checks
- python-compliance
- typescript-compliance
runs-on: ubuntu-latest
timeout-minutes: 10
env:
GITHUB_TOKEN: ${{ github.token }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
cache: maven
cache-dependency-path: java/futureagi/pom.xml
server-id: github
server-username: GITHUB_ACTOR
server-password: GITHUB_TOKEN

- name: Check Java package version
id: java-version
run: |
VERSION="$(sed -n 's:.*<version>\([^<]*\)</version>.*:\1:p' java/futureagi/pom.xml | head -n 1)"
if [ -z "${VERSION}" ]; then
echo "::error::Could not resolve Java SDK version from java/futureagi/pom.xml."
exit 1
fi
PACKAGE_NAME="com.futureagi.futureagi-sdk"
EXISTING="$(
gh api "/orgs/future-agi/packages/maven/${PACKAGE_NAME}/versions" \
--jq ".[] | select(.name == \"${VERSION}\") | .name" 2>/dev/null | head -n 1 || true
)"
if [ "${EXISTING}" = "${VERSION}" ]; then
echo "exists=true" >> "$GITHUB_OUTPUT"
echo "${PACKAGE_NAME}:${VERSION} already exists in GitHub Packages; skipping publish."
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi

- name: Publish Java package to GitHub Packages
if: steps.java-version.outputs.exists != 'true'
run: >
mvn -B -f java/futureagi/pom.xml -DskipTests deploy
-DaltDeploymentRepository=github::default::https://maven.pkg.github.com/future-agi/futureagi-sdk
Loading
Loading