mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-07 19:22:14 +09:00
100 lines
3.0 KiB
YAML
100 lines
3.0 KiB
YAML
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
name: Dart SDK Validation
|
|
|
|
on:
|
|
pull_request:
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
openapi-drift:
|
|
name: Detect OpenAPI schema drift
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 15
|
|
steps:
|
|
- name: Checkout fluxer
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Set up Rust toolchain (CI helpers)
|
|
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9
|
|
with:
|
|
toolchain: "1.93.0"
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271
|
|
|
|
- name: Install Node.js
|
|
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
|
|
with:
|
|
node-version: '24'
|
|
cache: 'pnpm'
|
|
|
|
- name: Install dependencies
|
|
run: >-
|
|
cargo run --locked --quiet --manifest-path tools/ci/Cargo.toml -- ci
|
|
--step install_dependencies
|
|
|
|
- name: Generate OpenAPI schemas
|
|
run: pnpm openapi:generate
|
|
|
|
- name: Validate OpenAPI schemas
|
|
run: pnpm openapi:validate
|
|
|
|
- name: Check drift of OpenAPI schemas
|
|
run: |
|
|
if ! git diff --exit-code -- fluxer_api/src/api/openapi/openapi.json fluxer_admin/openapi-admin.json; then
|
|
echo "::error::OpenAPI schemas are outdated."
|
|
exit 1
|
|
fi
|
|
|
|
validate:
|
|
name: Validate Dart SDK generation
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check changed files
|
|
id: changes
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
|
|
run: |
|
|
changed_files="$(mktemp)"
|
|
gh pr diff "$PULL_REQUEST_NUMBER" --repo "$GITHUB_REPOSITORY" --name-only > "$changed_files"
|
|
if grep -Fxq 'fluxer_api/src/api/openapi/openapi.json' "$changed_files"; then
|
|
echo "openapi=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "openapi=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Checkout fluxer
|
|
if: steps.changes.outputs.openapi == 'true'
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Checkout Dart SDK
|
|
if: steps.changes.outputs.openapi == 'true'
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
|
|
with:
|
|
repository: fluxerapp/dart_sdk
|
|
path: dart_sdk
|
|
persist-credentials: false
|
|
|
|
- name: Setup Dart
|
|
if: steps.changes.outputs.openapi == 'true'
|
|
uses: dart-lang/setup-dart@65eb853c7ba17dde3be364c3d2858773e7144260
|
|
with:
|
|
sdk: stable
|
|
|
|
- name: Validate Dart SDK generation
|
|
if: steps.changes.outputs.openapi == 'true'
|
|
working-directory: dart_sdk
|
|
run: ./scripts/openapi_sdk.sh validate
|