chore: import upstream snapshot with attribution
CI / Run CI (push) Has been cancelled
CI / check-backend (push) Has been cancelled
CI / check-frontend (push) Has been cancelled
CI / tests (push) Has been cancelled
CI / e2e-tests (push) Has been cancelled
Copilot Setup Steps / copilot-setup-steps (push) Has been cancelled
CI / Run CI (push) Has been cancelled
CI / check-backend (push) Has been cancelled
CI / check-frontend (push) Has been cancelled
CI / tests (push) Has been cancelled
CI / e2e-tests (push) Has been cancelled
Copilot Setup Steps / copilot-setup-steps (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
name: Check backend
|
||||
|
||||
on: [workflow_call]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
check-backend:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: 'Linting: backend'
|
||||
command: uv run --no-project scripts/lint.py
|
||||
- name: 'Formatting: backend'
|
||||
command: uv run --no-project scripts/format.py --check
|
||||
- name: 'Type checking: backend'
|
||||
command: uv run --no-project scripts/type_check.py
|
||||
name: ${{ matrix.name }}
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: ./.github/actions/uv-python-install
|
||||
name: Install Python, uv and Python dependencies
|
||||
with:
|
||||
uv-args: --no-install-workspace --all-extras --dev
|
||||
- name: ${{ matrix.name }}
|
||||
run: ${{ matrix.command }}
|
||||
@@ -0,0 +1,29 @@
|
||||
name: Check frontend & libs
|
||||
|
||||
on: [workflow_call]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
check-frontend:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: 'Linting: frontend'
|
||||
command: pnpm lint
|
||||
- name: 'Formatting: frontend'
|
||||
command: pnpm format-check
|
||||
- name: 'Type checking: frontend'
|
||||
command: pnpm type-check
|
||||
name: ${{ matrix.name }}
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: ./.github/actions/pnpm-node-install
|
||||
name: Install Node, pnpm and dependencies.
|
||||
- name: Build @chainlit/react-client
|
||||
run: pnpm --filter @chainlit/react-client build
|
||||
- name: ${{ matrix.name }}
|
||||
run: ${{ matrix.command }}
|
||||
@@ -0,0 +1,42 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
workflow_dispatch:
|
||||
merge_group:
|
||||
pull_request:
|
||||
branches: [main, dev, 'release/**']
|
||||
push:
|
||||
branches: [main, dev, 'release/**']
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref_name != 'main' }}
|
||||
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
check-backend:
|
||||
uses: ./.github/workflows/check-backend.yaml
|
||||
secrets: inherit
|
||||
check-frontend:
|
||||
uses: ./.github/workflows/check-frontend.yaml
|
||||
secrets: inherit
|
||||
tests:
|
||||
uses: ./.github/workflows/tests.yaml
|
||||
secrets: inherit
|
||||
e2e-tests:
|
||||
uses: ./.github/workflows/e2e-tests.yaml
|
||||
secrets: inherit
|
||||
ci:
|
||||
runs-on: ubuntu-slim
|
||||
name: Run CI
|
||||
if: always() # This ensures the job always runs
|
||||
needs: [check-backend, check-frontend, tests, e2e-tests]
|
||||
steps:
|
||||
# Propagate failure
|
||||
- name: Check dependent jobs
|
||||
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'action_required') || contains(needs.*.result, 'timed_out')
|
||||
run: |
|
||||
echo "Not all required jobs succeeded"
|
||||
exit 1
|
||||
@@ -0,0 +1,30 @@
|
||||
name: Close inactive issues and pull requests
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 1 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
close-issues:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/stale@v9
|
||||
with:
|
||||
operations-per-run: 400
|
||||
ascending: true
|
||||
days-before-issue-stale: 14
|
||||
days-before-issue-close: 7
|
||||
stale-issue-label: 'stale'
|
||||
exempt-issue-labels: 'enhancement,dev-tooling,e2e-tests,unit-tests,keep-for-a-while'
|
||||
stale-issue-message: 'This issue is stale because it has been open for 14 days with no activity.'
|
||||
close-issue-message: 'This issue was closed because it has been inactive for 7 days since being marked as stale.'
|
||||
days-before-pr-stale: 14
|
||||
days-before-pr-close: 7
|
||||
stale-pr-label: 'stale'
|
||||
exempt-pr-labels: 'enhancement,dev-tooling,e2e-tests,unit-tests,keep-for-a-while'
|
||||
stale-pr-message: 'This PR is stale because it has been open for 14 days with no activity.'
|
||||
close-pr-message: 'This PR was closed because it has been inactive for 7 days since being marked as stale.'
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -0,0 +1,41 @@
|
||||
name: 'Copilot Setup Steps'
|
||||
|
||||
# Automatically run the setup steps when they are changed to allow for easy validation, and
|
||||
# allow manual testing through the repository's "Actions" tab
|
||||
# This workflow optimizes the GitHub Copilot coding agent's ephemeral development environment
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- .github/workflows/copilot-setup-steps.yaml
|
||||
pull_request:
|
||||
paths:
|
||||
- .github/workflows/copilot-setup-steps.yaml
|
||||
|
||||
jobs:
|
||||
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
|
||||
copilot-setup-steps:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
|
||||
# Set the permissions to the lowest permissions possible needed for your steps.
|
||||
# Copilot will be given its own token for its operations.
|
||||
permissions:
|
||||
# If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete.
|
||||
contents: read
|
||||
|
||||
# You can define any steps you want, and they will run before the agent starts.
|
||||
# If you do not check out your code, Copilot will do this for you.
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Install Node.js, pnpm and dependencies
|
||||
uses: ./.github/actions/pnpm-node-install
|
||||
|
||||
- name: Install Python, uv and dependencies
|
||||
uses: ./.github/actions/uv-python-install
|
||||
with:
|
||||
python-version: '3.10'
|
||||
uv-version: 'latest'
|
||||
uv-args: '--all-extras --dev'
|
||||
@@ -0,0 +1,72 @@
|
||||
name: E2E tests
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
e2e_parallel_shards:
|
||||
description: Number of parallel E2E shards per OS.
|
||||
type: number
|
||||
default: 5
|
||||
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
prepare:
|
||||
name: Validate inputs and compute shard matrix
|
||||
runs-on: ubuntu-slim
|
||||
outputs:
|
||||
indexes: ${{ steps.shard-indexes.outputs.indexes }}
|
||||
steps:
|
||||
- name: Validate e2e_parallel_shards
|
||||
run: |
|
||||
n="${{ inputs.e2e_parallel_shards }}"
|
||||
if ! [[ "$n" =~ ^[0-9]+$ ]] || [[ "$n" -lt 1 ]]; then
|
||||
echo "❌ Error: e2e_parallel_shards must be at least 1, got: $n"
|
||||
exit 1
|
||||
fi
|
||||
echo "✅ Validation passed"
|
||||
- id: shard-indexes
|
||||
name: Compute shard indexes
|
||||
run: |
|
||||
json=$(jq -nc --argjson n "${{ inputs.e2e_parallel_shards }}" '[range(1; $n + 1)]')
|
||||
echo "indexes=$json" >> "$GITHUB_OUTPUT"
|
||||
|
||||
e2e-tests:
|
||||
needs: prepare
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
containers: ${{ fromJSON(needs.prepare.outputs.indexes) }}
|
||||
name: ${{ matrix.os }}-${{ matrix.containers }}
|
||||
env:
|
||||
BACKEND_DIR: ./backend
|
||||
# Single path for actions/cache on Linux + Windows (default Cypress dirs differ by OS).
|
||||
CYPRESS_CACHE_FOLDER: ${{ github.workspace }}/.cypress-cache
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- name: Cache Cypress binary
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: .cypress-cache
|
||||
key: cypress-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
- uses: ./.github/actions/pnpm-node-install
|
||||
name: Install Node, pnpm and dependencies.
|
||||
- uses: ./.github/actions/uv-python-install
|
||||
name: Install Python, uv and Python & pnpm (uv does it automatically) dependencies
|
||||
with:
|
||||
working-directory: ${{ env.BACKEND_DIR }}
|
||||
uv-args: --extra tests
|
||||
- name: Run tests
|
||||
env:
|
||||
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
||||
SPLIT: ${{ inputs.e2e_parallel_shards }}
|
||||
SPLIT_INDEX1: ${{ matrix.containers }}
|
||||
run: pnpm test:e2e
|
||||
shell: bash
|
||||
- name: Upload screenshots
|
||||
uses: actions/upload-artifact@v7
|
||||
if: always() && hashFiles('cypress/screenshots/**') != ''
|
||||
with:
|
||||
name: cypress-screenshots-${{ matrix.os }}-${{ matrix.containers }}
|
||||
path: cypress/screenshots
|
||||
@@ -0,0 +1,52 @@
|
||||
name: Publish libs
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
dry_run:
|
||||
description: 'Dry run (test publishing)'
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
name: Validate inputs
|
||||
runs-on: ubuntu-slim
|
||||
steps:
|
||||
- name: Validate publishing branch and destination package index
|
||||
run: |
|
||||
if [[ "${{ github.ref_name }}" != "main" && "${{ github.event_name }}" != "release" ]]; then
|
||||
if [[ "${{ inputs.dry_run }}" != "true" ]]; then
|
||||
echo "❌ Error: Only build from main branch or release tag can be published to npm registry."
|
||||
echo "Please check 'Dry run (test publishing)' when running from branch: ${{ github.ref_name }}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
echo "✅ Validation passed"
|
||||
ci:
|
||||
needs: [validate]
|
||||
uses: ./.github/workflows/ci.yaml
|
||||
secrets: inherit
|
||||
build-n-publish:
|
||||
name: Upload libs release to npm registry
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ci]
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: ./.github/actions/pnpm-node-install
|
||||
name: Install Node, pnpm and dependencies.
|
||||
|
||||
- name: Build react-client
|
||||
run: pnpm --filter @chainlit/react-client build
|
||||
|
||||
- name: Publish packages to npm
|
||||
# --no-git-checks allows testing from non-main branches and publishing from release tags
|
||||
run: pnpm publish --recursive --no-git-checks ${{ inputs.dry_run && '--dry-run' || '' }}
|
||||
@@ -0,0 +1,80 @@
|
||||
name: Publish
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
use_testpypi:
|
||||
description: 'Publish to TestPyPI instead of PyPI'
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
name: Validate inputs
|
||||
runs-on: ubuntu-slim
|
||||
steps:
|
||||
- name: Validate publishing branch and destination package index
|
||||
run: |
|
||||
if [[ "${{ github.ref_name }}" != "main" && "${{ github.event_name }}" != "release" ]]; then
|
||||
if [[ "${{ inputs.use_testpypi }}" != "true" ]]; then
|
||||
echo "❌ Error: Only build from main branch or release tag can be published to PyPI."
|
||||
echo "Please check 'Publish to TestPyPI instead of PyPI' when running from branch: ${{ github.ref_name }}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
echo "✅ Validation passed"
|
||||
ci:
|
||||
needs: [validate]
|
||||
uses: ./.github/workflows/ci.yaml
|
||||
secrets: inherit
|
||||
build-n-publish:
|
||||
name: Upload release to PyPI/TestPyPI
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ci]
|
||||
env:
|
||||
name: ${{ inputs.use_testpypi && 'testpypi' || 'pypi' }}
|
||||
url: ${{ inputs.use_testpypi && 'https://test.pypi.org/project/chainlit' || 'https://pypi.org/project/chainlit' }}
|
||||
BACKEND_DIR: ./backend
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: ./.github/actions/pnpm-node-install
|
||||
name: Install Node, pnpm and dependencies.
|
||||
- uses: ./.github/actions/uv-python-install
|
||||
name: Install Python, uv and Python dependencies
|
||||
with:
|
||||
working-directory: ${{ env.BACKEND_DIR }}
|
||||
|
||||
- name: Build Python distribution
|
||||
run: uv build
|
||||
working-directory: ${{ env.BACKEND_DIR }}
|
||||
|
||||
- name: Check frontend and copilot folder included
|
||||
run: |
|
||||
pip install wheel
|
||||
python -m wheel unpack dist/chainlit-*.whl -d unpacked
|
||||
ls unpacked/chainlit-*/chainlit/frontend/dist
|
||||
ls unpacked/chainlit-*/chainlit/copilot/dist
|
||||
|
||||
- name: Publish package distributions to TestPyPI
|
||||
if: inputs.use_testpypi
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
packages-dir: dist
|
||||
repository-url: https://test.pypi.org/legacy/
|
||||
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
|
||||
verbose: true
|
||||
|
||||
- name: Publish package distributions to PyPI
|
||||
if: ${{ !inputs.use_testpypi }}
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
packages-dir: dist
|
||||
password: ${{ secrets.PYPI_API_TOKEN }}
|
||||
@@ -0,0 +1,28 @@
|
||||
name: Unit & integration tests
|
||||
|
||||
on: [workflow_call]
|
||||
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.10', '3.11', '3.12', '3.13']
|
||||
name: python ${{ matrix.python-version }}
|
||||
env:
|
||||
BACKEND_DIR: ./backend
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: ./.github/actions/pnpm-node-install
|
||||
name: Install Node, pnpm and dependencies.
|
||||
- uses: ./.github/actions/uv-python-install
|
||||
name: Install Python, uv and Python dependencies
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
uv-args: --extra tests --extra custom-data
|
||||
- name: Run backend tests
|
||||
run: uv run --no-project pytest --cov=chainlit/
|
||||
- name: Run frontend tests
|
||||
run: pnpm run test
|
||||
Reference in New Issue
Block a user