Skip to content

Match CPython class generator syntax error (#5) #3

Match CPython class generator syntax error (#5)

Match CPython class generator syntax error (#5) #3

# Publish the ty playground.
name: "[ty Playground] Release"
permissions: {}
on:
push:
branches: [main]
paths:
- "crates/ty*/**"
- "crates/ruff_db/**"
- "crates/ruff_python_ast/**"
- "crates/ruff_python_parser/**"
- "playground/**"
- ".github/workflows/publish-ty-playground.yml"
concurrency:
group: publish-ty-playground-${{ github.ref_name }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
CARGO_PROFILE_DEV_LTO: "false"
CARGO_PROFILE_DEV_OPT_LEVEL: 0
CARGO_TERM_COLOR: always
RUSTUP_MAX_RETRIES: 10
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: "Install Rust toolchain"
run: rustup target add wasm32-unknown-unknown
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.19.0
package-manager-cache: false
- uses: jetli/wasm-bindgen-action@20b33e20595891ab1a0ed73145d8a21fc96e7c29 # v0.2.0
- name: "Install Node dependencies"
run: npm ci --ignore-scripts
working-directory: playground
- name: "Run TypeScript checks"
run: npm run check
working-directory: playground
- name: "Build ty playground"
run: npm run build --workspace ty-playground
working-directory: playground
- name: "Verify Pyodide assets"
run: |
test -f ty/dist/assets/pyodide.asm.mjs
test -f ty/dist/assets/pyodide.asm.wasm
test -f ty/dist/assets/pyodide-lock.json
test -f ty/dist/assets/python_stdlib.zip
working-directory: playground
- name: "Upload ty playground"
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ty-playground-dist
path: playground/ty/dist
if-no-files-found: error
retention-days: 1
publish:
needs: build
runs-on: ubuntu-latest
environment: release-playground
env:
CF_API_TOKEN_EXISTS: ${{ secrets.CF_API_TOKEN != '' }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.19.0
package-manager-cache: false
- name: "Download ty playground"
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ty-playground-dist
path: playground/ty/dist
digest-mismatch: error
- name: "Verify static playground assets"
run: |
# The build runs without deployment credentials, but its output may
# still be compromised. Check for missing required assets, and reject
# links and special files before the publisher consumes the artifact.
# Wrangler can deploy `_worker.js` in the output or `functions/` in its
# working directory as server-side Pages code, so reject both.
# These checks do not establish that the generated HTML or JavaScript is safe.
test -f playground/ty/dist/index.html
test -f playground/ty/dist/assets/pyodide.asm.mjs
test -f playground/ty/dist/assets/pyodide.asm.wasm
test -f playground/ty/dist/assets/pyodide-lock.json
test -f playground/ty/dist/assets/python_stdlib.zip
test ! -e playground/ty/dist/_worker.js
test ! -e functions
if [[ -n "$(find playground/ty/dist ! -type f ! -type d -print -quit)" ]]; then
echo "Playground artifacts must contain only regular files and directories"
exit 1
fi
- name: "Install deployment dependencies"
if: ${{ env.CF_API_TOKEN_EXISTS == 'true' }}
run: npm ci --ignore-scripts
working-directory: playground/deploy
- name: "Deploy to Cloudflare Pages"
if: ${{ env.CF_API_TOKEN_EXISTS == 'true' }}
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
# `github.head_ref` is only set during pull requests and for manual runs or tags we use `main` to deploy to production
DEPLOY_BRANCH: ${{ github.head_ref || 'main' }}
run: ./playground/deploy/node_modules/.bin/wrangler pages deploy playground/ty/dist --project-name=ty-playground --branch "$DEPLOY_BRANCH" --commit-hash "$GITHUB_SHA"