Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9649e08
ci: update actions to their current major versions
ariesclark Aug 9, 2026
c016258
ci: run build and test workflows on every branch
ariesclark Aug 9, 2026
6025e0d
ci: build from a supplied spec on push, pull request, or call
ariesclark Aug 9, 2026
e5dc1ee
ci: use the shared SDK specification action
ariesclark Aug 9, 2026
2f7df21
ci: build against the bundle this SDK generates from
ariesclark Aug 9, 2026
d8fafb3
ci: take the default bundle
ariesclark Aug 9, 2026
92e66f4
ci: let setup decide where the bundle comes from
ariesclark Aug 9, 2026
bc461db
ci: cache dependencies and drop redundant setup
ariesclark Aug 9, 2026
4091f18
ci: run the generator from its jar instead of an npm wrapper
ariesclark Aug 9, 2026
c24de56
ci: use the renamed setup-generator and download actions
ariesclark Aug 9, 2026
1f60b47
ci: split the checks into their own jobs and separate release
ariesclark Aug 9, 2026
37cd8d0
ci: give generation its own job ahead of the checks
ariesclark Aug 9, 2026
3c42cf5
refactor: leave building and testing to CI in generate.sh
ariesclark Aug 9, 2026
c4e020c
ci: fold the standalone checks into the ci workflow
ariesclark Aug 9, 2026
e19f608
Merge remote-tracking branch 'origin/main' into ci/modernise-actions
ariesclark Aug 9, 2026
aecd781
ci: check formatting of the committed sources and the patches
ariesclark Aug 9, 2026
2c9b361
ci: run the checks once per change
ariesclark Aug 9, 2026
184a47a
ci: run the checks once per change, and on fork pull requests
ariesclark Aug 9, 2026
4e77adc
ci: run the checks on every branch
ariesclark Aug 9, 2026
78eded6
ci: report how to install what this run built
ariesclark Aug 9, 2026
82eb95d
ci: report how to install what this run built
ariesclark Aug 9, 2026
5577142
ci: let each SDK report itself
ariesclark Aug 9, 2026
4c59cef
ci: publish from the ci workflow
ariesclark Aug 9, 2026
3487ef9
fix(ci): only publish from the SDK's own repository
ariesclark Aug 9, 2026
066e821
ci: use the actions from the specification's main branch
ariesclark Aug 9, 2026
138284a
Merge remote-tracking branch 'origin/main' into ci/modernise-actions
ariesclark Aug 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions .github/workflows/check_pr.yaml

This file was deleted.

154 changes: 101 additions & 53 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,85 +1,133 @@
on:
push:
branches:
- '**'
pull_request:
repository_dispatch:
types: [release]
workflow_dispatch:
inputs:
json:
description: 'Passed json from repository_dispatch'
description: Passed json from repository_dispatch
required: true
type: string
version_postfix:
description: 'Additional string to concatenate onto the existing version before release'
description: Additional string to concatenate onto the existing version before release
required: false
type: string
default: ''
workflow_call:
inputs:
ref:
description: Ref of this repository to build.
required: false
type: string
default: main

name: Generate VRChat API SDK
name: CI

env:
PASSED_VERSION: ${{ (github.event_name == 'repository_dispatch' && github.event.client_payload || fromJSON(inputs.json || '{}'))['version'] }}
VERSION_POSTPEND: ${{ github.event_name == 'workflow_dispatch' && inputs.version_postfix || '' }}

jobs:
generate:
runs-on: ubuntu-latest
name: Generate VRChat API SDK
env:
ARTIFACT_NAME: "openapi.json"
INPUT: ${{ github.event_name == 'repository_dispatch' && toJSON(github.event.client_payload) || inputs.json }}
SPEC_URL: ${{ (github.event_name == 'repository_dispatch' && github.event.client_payload || fromJSON(inputs.json))['artifacts']['openapi.json'] }}
PASSED_VERSION: ${{ (github.event_name == 'repository_dispatch' && github.event.client_payload || fromJSON(inputs.json))['version'] }}
VERSION_POSTPEND: ${{ github.event_name == 'workflow_dispatch' && inputs.version_postfix || '' }}
steps:
- uses: actions/setup-node@v6
with:
node-version: 22
- uses: actions/checkout@v6
- name: 'Cache node_modules'
uses: actions/cache@v6
- uses: actions/checkout@v7
with:
path: node_modules
key: ${{ runner.os }}-node-v22-${{ hashFiles('**/generate.sh') }}
restore-keys: |
${{ runner.os }}-node-v22
- name: Install OpenAPI Generator CLI
run: npm install @openapitools/openapi-generator-cli
- name: Set OpenAPI Generator version
run: ./node_modules/\@openapitools/openapi-generator-cli/main.js version-manager set 7.21.0
- name: Set up JDK 20
uses: actions/setup-java@v5
with:
java-version: '20'
distribution: 'temurin'
- name: Install Rustup toolchain
uses: moonrepo/setup-rust@v1
- name: Download Specification
run: wget "${SPEC_URL}" '--output-document' "${ARTIFACT_NAME}"
- name: Check version number
repository: vrchatapi/vrchatapi-rust
ref: ${{ inputs.ref || github.ref }}

- uses: vrchatapi/specification/.github/actions/setup-generator@main

- uses: vrchatapi/specification/.github/actions/download@main

- if: env.PASSED_VERSION != ''
run: |
set -euo pipefail
if [ "$(yq '--unwrapScalar' '.info.version' "${ARTIFACT_NAME}")" != ${PASSED_VERSION} ]
then
echo -e "Mismatch between actual and expected version!\nAborting Release." >&2

if [ "$(yq '--unwrapScalar' '.info.version' openapi.json)" != "${PASSED_VERSION}" ]; then
echo "Mismatch between actual and expected version" >&2
exit 1
fi
- name: Apply Version Postpend
if: ${{ github.event_name == 'workflow_dispatch' && inputs.version_postfix != '' }}
run: yq '--inplace' ".info.version |= \"${PASSED_VERSION}${VERSION_POSTPEND}\"" "${ARTIFACT_NAME}"
- name: Generate SDK Client
run: bash ./generate.sh "${ARTIFACT_NAME}"
- name: Check version number

- if: env.VERSION_POSTPEND != ''
run: yq '--inplace' ".info.version |= \"${PASSED_VERSION}${VERSION_POSTPEND}\"" openapi.json

- run: bash ./generate.sh openapi.json

- if: env.PASSED_VERSION != ''
run: |
set -euo pipefail
if [ "$(yq '--unwrapScalar' '--input-format=toml' '--output-format=toml' '.package.version' 'Cargo.toml')" != "${PASSED_VERSION}${VERSION_POSTPEND}" ]
then
echo -e "Mismatch between actual and expected version!\nAborting Release." >&2

if [ "$(yq '--unwrapScalar' '--input-format=toml' '--output-format=toml' '.package.version' Cargo.toml)" != "${PASSED_VERSION}${VERSION_POSTPEND}" ]; then
echo "Mismatch between actual and expected version" >&2
exit 1
fi
- name: Remove API Spec
run: unlink "${ARTIFACT_NAME}"
- name: Deploy SDK back into main branch
uses: JamesIves/github-pages-deploy-action@v4

- uses: actions/upload-artifact@v7
with:
name: rust-generated
path: .
include-hidden-files: true

format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
repository: vrchatapi/vrchatapi-rust
ref: ${{ inputs.ref || github.ref }}

- uses: moonrepo/setup-rust@v1.3.0
with:
components: rustfmt

- run: cargo fmt --all -- --check

- run: rustfmt --edition 2021 --check patches/*.rs

test:
needs: generate
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v8
with:
name: rust-generated

- uses: moonrepo/setup-rust@v1.3.0

- run: cargo test --all
Comment thread
C0D3-M4513R marked this conversation as resolved.

publish:
needs:
- generate
- format
- test
if: github.repository == 'vrchatapi/vrchatapi-rust'
&& (github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
repository: vrchatapi/vrchatapi-rust

- uses: actions/download-artifact@v8
with:
name: rust-generated

- run: rm -f openapi.json

- uses: JamesIves/github-pages-deploy-action@v4.9.0
with:
branch: main
folder: .
commit-message: "Upgrade Rust SDK to spec ${{ env.PASSED_VERSION }}${{env.VERSION_POSTPEND}}"
- name: Deploy to Crates.io
run: cargo publish --allow-dirty #Cargo.toml is always detected as "dirty", eventhough the changed should have been pushed by the step above
commit-message: Upgrade Rust SDK to spec ${{ env.PASSED_VERSION }}${{ env.VERSION_POSTPEND }}

- uses: moonrepo/setup-rust@v1.3.0

# Cargo.toml always reads as dirty, though the change was pushed above.
- run: cargo publish --allow-dirty
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
4 changes: 1 addition & 3 deletions generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fi
# Generate Client
rm src/apis src/models docs -rf

./node_modules/\@openapitools/openapi-generator-cli/main.js generate \
openapi-generator generate \
-g rust \
-t ./templates \
'--additional-properties=packageName=vrchatapi,supportAsync=true,avoidBoxedModels=true,library=reqwest,supportMiddleware=true,repositoryUrl="https://github.com/vrchatapi/vrchatapi-rust",description="VRChat API Client for Rust",infoEmail="vrchatapi.lpv0t@aries.fyi"' \
Expand Down Expand Up @@ -42,5 +42,3 @@ cp -r patches src/patches
printf "\npub mod patches;" >> src/lib.rs

cargo fmt
cargo build
cargo test
1 change: 0 additions & 1 deletion openapitools.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "7.21.0"
Expand Down
Loading
Loading