Skip to content

Python server side sandbox #117

Python server side sandbox

Python server side sandbox #117

Workflow file for this run

name: CI
on:
push:
branches:
- main
tags:
- '**'
pull_request: {}
env:
COLUMNS: 150
UV_PYTHON: 3.12
UV_FROZEN: '1'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- run: npm install
- run: uv sync
working-directory: src/sandbox
- uses: pre-commit/[email protected]
with:
extra_args: --all-files --verbose
env:
SKIP: no-commit-to-branch
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm install
- uses: cloudflare/wrangler-action@v3
name: Test deploy backend
with:
command: deploy --dry-run
workingDirectory: src/backend
- uses: cloudflare/wrangler-action@v3
name: Test deploy sandbox
with:
command: deploy --dry-run
workingDirectory: src/sandbox
check:
if: always()
needs: [lint, build]
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
deploy-preview:
if: 'success() && github.event.pull_request.head.repo.full_name == github.repository'
runs-on: ubuntu-latest
needs: [check]
environment:
name: deploy-preview
url: ${{ steps.get_preview_url.outputs.preview_url }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm install
- uses: cloudflare/wrangler-action@v3
name: Deploy sandbox-pydantic-run-preview
id: deploy_sandbox
with:
apiToken: ${{ secrets.SC_CLOUDFLARE_API_TOKEN }}
environment: previews
command: deploy --var GITHUB_SHA:${{ github.sha }}
workingDirectory: src/sandbox
- name: get sandbox preview URL
id: get_sandbox_preview_url
run: python .github/get_preview_url.py >> $GITHUB_OUTPUT
env:
DEPLOY_OUTPUT: ${{ steps.deploy_sandbox.outputs.command-output }}
- uses: cloudflare/wrangler-action@v3
name: Deploy pydantic-run-preview
id: deploy
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
environment: previews
command: deploy --var GITHUB_SHA:${{ github.sha }} --var SANDBOX:${{ steps.get_sandbox_preview_url.outputs.preview_url }}
workingDirectory: src/backend
- name: get preview URL
id: get_preview_url
run: python .github/get_preview_url.py >> $GITHUB_OUTPUT
env:
DEPLOY_OUTPUT: ${{ steps.deploy.outputs.command-output }}
deploy:
if: "success() && github.ref == 'refs/heads/main'"
runs-on: ubuntu-latest
needs: [check]
environment:
name: deploy-prod
url: https://pydantic.run
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm install
- uses: cloudflare/wrangler-action@v3
name: Deploy pydantic-run
with:
apiToken: ${{ secrets.cloudflare_api_token }}
command: deploy --var GITHUB_SHA:${{ github.sha }}
workingDirectory: src/backend