diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..169e78a1 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,83 @@ +on: + push: + branches: + - '**' + pull_request: + workflow_call: + inputs: + ref: + description: Ref of this repository to build. + required: false + type: string + default: main + +name: CI + +jobs: + generate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + with: + repository: vrchatapi/vrchatapi-dart + ref: ${{ inputs.ref || github.ref }} + + - uses: dart-lang/setup-dart@v1.8.0 + + - uses: vrchatapi/specification/.github/actions/setup-generator@main + + - uses: vrchatapi/specification/.github/actions/download@main + with: + bundle: openapi-legacy.yaml + + - run: | + mkdir -p ../vrchatapi-specification/dist + mv openapi-legacy.yaml ../vrchatapi-specification/dist/ + + - run: ./generate.sh local + + - uses: actions/upload-artifact@v7 + with: + name: dart-generated + path: . + include-hidden-files: true + + analyze: + needs: generate + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v8 + with: + name: dart-generated + + - uses: dart-lang/setup-dart@v1.8.0 + + - run: dart pub get + working-directory: vrchat_dart_generated + + - run: dart analyze + working-directory: vrchat_dart_generated + + pana: + needs: generate + runs-on: ubuntu-latest + strategy: + matrix: + package: [vrchat_dart, vrchat_dart_generated] + defaults: + run: + working-directory: ${{ matrix.package }} + steps: + - uses: actions/download-artifact@v8 + with: + name: dart-generated + + - uses: dart-lang/setup-dart@v1.8.0 + + - run: dart pub get + + - run: dart pub publish --dry-run + + - run: | + dart pub global activate pana + pana --no-warning --exit-code-threshold 0 diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 50a8a746..98b9e0be 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -9,13 +9,13 @@ jobs: generate: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: subosito/flutter-action@v2 + - uses: actions/checkout@v7 + - uses: subosito/flutter-action@v2.23.0 with: cache: true - name: Pub cache - uses: actions/cache@v4 + uses: actions/cache@v6 env: cache-name: root with: @@ -24,7 +24,7 @@ jobs: restore-keys: ${{ env.cache-name }}- - name: Homebrew cache - uses: actions/cache@v4 + uses: actions/cache@v6 with: path: | /home/linuxbrew/.linuxbrew @@ -37,7 +37,7 @@ jobs: ${{ runner.os }}-brew- - name: Set up Homebrew - uses: Homebrew/actions/setup-homebrew@master + uses: Homebrew/actions/setup-homebrew@fd832223f9f99ebf0244dd20658680e5d4aca049 - name: Generate run: ./generate.sh @@ -53,7 +53,7 @@ jobs: - name: Create Pull Request if: steps.changelog.outputs.changed == 'true' - uses: peter-evans/create-pull-request@v6 + uses: peter-evans/create-pull-request@v8 with: branch: ci/regenerate-from-spec commit-message: "Regenerated from spec" diff --git a/.github/workflows/major-dependency-upgrades.yaml b/.github/workflows/major-dependency-upgrades.yaml index 4d701958..257340b2 100644 --- a/.github/workflows/major-dependency-upgrades.yaml +++ b/.github/workflows/major-dependency-upgrades.yaml @@ -9,13 +9,13 @@ jobs: upgrade-dependencies: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: subosito/flutter-action@v2 + - uses: actions/checkout@v7 + - uses: subosito/flutter-action@v2.23.0 with: cache: true - name: Pub cache - uses: actions/cache@v4 + uses: actions/cache@v6 env: cache-name: pub-cache with: @@ -38,7 +38,7 @@ jobs: - name: Create Pull Request if: steps.pubspec_check.outputs.changed - uses: peter-evans/create-pull-request@v6 + uses: peter-evans/create-pull-request@v8 with: branch: ci/major-dependency-upgrades commit-message: "Upgraded dependency major versions" diff --git a/.github/workflows/pana.yml b/.github/workflows/pana.yml deleted file mode 100644 index 75e39320..00000000 --- a/.github/workflows/pana.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Package analysis -on: - push: - branches: - - main - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - package-analysis: - runs-on: ubuntu-latest - strategy: - matrix: - package: [vrchat_dart, vrchat_dart_generated] - defaults: - run: - working-directory: ${{ matrix.package }} - steps: - - uses: actions/checkout@v4 - - uses: subosito/flutter-action@v2 - with: - cache: true - - name: Pub cache - uses: actions/cache@v4 - env: - cache-name: ${{ matrix.package }} - with: - path: ${{ env.PUB_CACHE }} - key: ${{ env.cache-name }}-${{ hashFiles('**/pubspec.lock') }} - restore-keys: ${{ env.cache-name }}- - - name: Pub get - run: dart pub get - - name: Publish dry run - run: dart pub publish --dry-run - - name: Run pana - run: | - dart pub global activate pana - pana --no-warning --exit-code-threshold 0 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 21aeff0e..b8b22a9b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,7 @@ name: Test on: push: branches: - - main + - '**' pull_request: concurrency: @@ -13,12 +13,12 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: subosito/flutter-action@v2 + - uses: actions/checkout@v7 + - uses: subosito/flutter-action@v2.23.0 with: cache: true - name: Pub cache - uses: actions/cache@v4 + uses: actions/cache@v6 env: cache-name: vrchat_dart with: diff --git a/generate.sh b/generate.sh index c5df5761..f22684f8 100755 --- a/generate.sh +++ b/generate.sh @@ -15,8 +15,6 @@ dart pub get dart run tool/patch_input.dart "$@" cd .. -# Ensure openapi-generator is installed and up to date -brew install openapi-generator openapi-generator generate -g dart-dio -c generator-config.yaml # We need to do a pub get in the output before patching it diff --git a/openapitools.json b/openapitools.json new file mode 100644 index 00000000..a02c0c45 --- /dev/null +++ b/openapitools.json @@ -0,0 +1,6 @@ +{ + "spaces": 2, + "generator-cli": { + "version": "7.24.0" + } +}