Skip to content

Websocket types

Websocket types #1965

Workflow file for this run

on:
push:
branches:
- main
pull_request:
schedule:
- cron: "17 7 * * *"
workflow_dispatch:
env:
GH_TOKEN: ${{ github.token }}
jobs:
lint:
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: pnpm/setup@v2
with:
runtime: bun@latest
cache: true
- if: github.event_name == 'push'
run: |
changes=$(git diff --name-only --diff-filter=d "${{ github.event.commits[0].id }}~1" "${{ github.event.commits[0].id }}")
{
echo 'changes<<eof_${{ github.run_id }}'
echo "$changes"
echo 'eof_${{ github.run_id }}'
} >> $GITHUB_ENV
- if: github.event_name == 'pull_request'
run: |
changes=$(git diff --name-only --diff-filter=d "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}")
{
echo 'changes<<eof_${{ github.run_id }}'
echo "$changes"
echo 'eof_${{ github.run_id }}'
} >> $GITHUB_ENV
- name: lint changed files
if: env.changes != ''
run: |
pattern=$(echo "${{ env.changes }}" | tr '\n' '|' | sed 's/|$//')
pnpm run lint-ci 2>&1 | grep -E "$pattern" || true
exit ${PIPESTATUS[0]:-1}
- name: lint files
if: env.changes == ''
continue-on-error: true
run: pnpm run lint-ci
- name: assert no unused paths
if: env.changes != ''
run: |
status=0
mapfile -t expected <<< "$(yq -re '.paths | keys' openapi/components/paths/*.yaml | yq -r 'sort_by(.) | .[]')"
mapfile -t actual <<< "$(yq -re 'sort_by(keys) | keys[]' openapi/components/paths.yaml)"
for ((i = 0, j = 0; i < "${#expected[@]}"; i++)); do
if [[ "${expected[$i]}" == "${actual[$j]}" ]]; then
j=$((j + 1))
else
status=2
echo "Missing path: ${expected[$i]}" >&2;
fi
done;
if [[ "$status" -ne 0 ]]; then
exit "$status"
fi
bundle:
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: pnpm/setup@v2
with:
runtime: bun@latest
cache: true
- run: bun --bun run bundle
- uses: actions/github-script@v9
with:
script: |
const { readdir } = require("node:fs/promises");
const { resolve, dirname } = require("node:path");
const { DefaultArtifactClient } = require("@actions/artifact");
const artifact = new DefaultArtifactClient();
const files = await readdir("./dist");
const artifacts = await Promise.all(files.map(async (file) => {
const pathname = resolve(`./dist/${file}`);
return artifact.uploadArtifact(file, [pathname], dirname(pathname));
}));
build_javascript:
needs: bundle
uses: vrchatapi/vrchatapi-javascript/.github/workflows/ci.yaml@main
build_rust:
needs: bundle
uses: vrchatapi/vrchatapi-rust/.github/workflows/ci.yaml@main
build_java:
needs: bundle
uses: vrchatapi/vrchatapi-java/.github/workflows/ci.yaml@main
build_python:
needs: bundle
uses: vrchatapi/vrchatapi-python/.github/workflows/ci.yaml@main
build_csharp:
needs: bundle
uses: vrchatapi/vrchatapi-csharp/.github/workflows/ci.yaml@main
build_dart:
needs: bundle
uses: vrchatapi/vrchatapi-dart/.github/workflows/ci.yaml@main
release:
runs-on: ubuntu-latest
needs:
- lint
- bundle
if: ${{ !failure() && !cancelled() && github.event_name != 'schedule' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, '[no release]') }}
outputs:
version: ${{ steps.metadata.outputs.version }}
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: pnpm/setup@v2
with:
runtime: bun@latest
cache: true
- uses: actions/download-artifact@v8
with:
path: dist
pattern: openapi*
merge-multiple: true
- id: metadata
run: |
version=$(jq -r '.info.version' dist/openapi.json)
version_sha=$(
git rev-list -n 1 "v$version" 2>/dev/null \
|| git rev-list -n 1 "release/$version" 2>/dev/null \
|| echo ""
)
if [ "$version_sha" == "" ]; then
echo "prerelease=false" >> $GITHUB_ENV
else
echo "prerelease=true" >> $GITHUB_ENV
version=$(pnpm semver $version -i)-nightly.$(git rev-list --count "$version_sha"..HEAD)
fi
echo "version=$version" >> $GITHUB_ENV
echo "version=$version" >> $GITHUB_OUTPUT
- name: create release
if: env.prerelease == 'false'
run: gh release create v${{ env.version }} dist/* --generate-notes
- name: create release (nightly)
if: env.prerelease == 'true'
run: |
jq --arg v "${{ env.version }}" '.info.version = $v' dist/openapi.json > dist/.openapi.json && mv dist/.openapi.json dist/openapi.json
yq eval ".info.version = \"${{ env.version }}\"" -i dist/openapi.yaml
gh release create v${{ env.version }} dist/* \
--generate-notes \
--prerelease
release_dispatch:
uses: ./.github/workflows/release_dispatch.yaml
needs: release
secrets: inherit
with:
version: ${{ needs.release.outputs.version }}
test:
if: github.event_name != 'pull_request' && !contains(github.event.head_commit.message, '[no test]')
runs-on: ubuntu-latest
concurrency:
group: test
cancel-in-progress: false
steps:
- uses: actions/checkout@v7
- uses: pnpm/setup@v2
with:
runtime: bun@latest
cache: true
- run: bun --bun run bundle
- run: pnpm test
env:
VRCHAT_EMAIL: ${{ secrets.VRCHAT_EMAIL }}
VRCHAT_PASSWORD: ${{ secrets.VRCHAT_PASSWORD }}
VRCHAT_TOTP_SECRET: ${{ secrets.VRCHAT_TOTP_SECRET }}
VRCHAT_FRIEND_ID: ${{ secrets.VRCHAT_FRIEND_ID }}
- if: "!cancelled()"
uses: actions/upload-artifact@v7
with:
name: respect-report
path: test/.out/respect.json
retention-days: 1
- if: "!cancelled()"
timeout-minutes: 2
run: sh test/report.sh --format github
- if: "!cancelled()"
timeout-minutes: 2
run: sh test/report.sh >> "$GITHUB_STEP_SUMMARY"
- if: "!cancelled()"
timeout-minutes: 5
run: |
status=0
pnpm -s test:drift --max-findings 1000 --output test/.out/drift.txt || status=$?
cat test/.out/drift.txt
{
printf '### Drift\n\n```\n'
cat test/.out/drift.txt
printf '```\n'
} >> "$GITHUB_STEP_SUMMARY"
exit $status