From d9b0a1287bb35e7f99f7ddda6385558d6019bd81 Mon Sep 17 00:00:00 2001 From: Max Peintner Date: Fri, 11 Jul 2025 13:50:59 +0200 Subject: [PATCH] docs turbo, exec turbo build from workflows --- .github/workflows/build.yml | 19 ++++++++- .github/workflows/console.yml | 6 ++- .github/workflows/docs.yml | 61 +++++++++++++++++++++++++++++ .github/workflows/login-quality.yml | 13 +++++- docs/turbo.json | 40 +++++++++++++++++++ 5 files changed, 134 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/docs.yml create mode 100644 docs/turbo.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 81f3104065..0ed1012980 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,6 +34,12 @@ jobs: node_version: "20" buf_version: "latest" + docs: + uses: ./.github/workflows/docs.yml + with: + node_version: "20" + buf_version: "latest" + version: uses: ./.github/workflows/version.yml with: @@ -86,7 +92,7 @@ jobs: actions: write id-token: write with: - ignore-run-cache: ${{ github.event_name == 'workflow_dispatch' || fromJSON(github.run_attempt) > 1 }} + ignore-run-cache: ${{ github.event_name == 'workflow_dispatch' || fromJSON(github.run_attempt) > 1 }} node_version: "20" container: @@ -121,7 +127,16 @@ jobs: issues: write pull-requests: write needs: - [version, core-unit-test, core-integration-test, lint, container, login-container, login-quality, e2e] + [ + version, + core-unit-test, + core-integration-test, + lint, + container, + login-container, + login-quality, + e2e, + ] if: ${{ github.event_name == 'workflow_dispatch' }} secrets: GCR_JSON_KEY_BASE64: ${{ secrets.GCR_JSON_KEY_BASE64 }} diff --git a/.github/workflows/console.yml b/.github/workflows/console.yml index 908d7f5865..a6fb0e2d54 100644 --- a/.github/workflows/console.yml +++ b/.github/workflows/console.yml @@ -49,7 +49,11 @@ jobs: cache: "pnpm" cache-dependency-path: pnpm-lock.yaml - if: ${{ steps.cache.outputs.cache-hit != 'true' }} - run: make console_build + name: Install dependencies + run: pnpm install + - if: ${{ steps.cache.outputs.cache-hit != 'true' }} + name: Build console with Turbo + run: pnpm turbo build --filter=./console - if: ${{ steps.cache.outputs.cache-hit != 'true' }} uses: actions/cache/save@v4 with: diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000000..353af5d486 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,61 @@ +name: Build docs + +on: + workflow_call: + inputs: + node_version: + required: true + type: string + buf_version: + required: true + type: string + outputs: + cache_key: + value: ${{ jobs.build.outputs.cache_key }} + cache_path: + value: ${{ jobs.build.outputs.cache_path }} + +env: + cache_path: docs/build + +jobs: + build: + outputs: + cache_key: ${{ steps.cache.outputs.cache-primary-key }} + cache_path: ${{ env.cache_path }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/cache/restore@v4 + timeout-minutes: 1 + continue-on-error: true + id: cache + with: + key: docs-${{ hashFiles('docs', 'proto', '!docs/build', '!docs/node_modules') }} + restore-keys: | + docs- + path: ${{ env.cache_path }} + - if: ${{ steps.cache.outputs.cache-hit != 'true' }} + uses: bufbuild/buf-setup-action@v1 + with: + github_token: ${{ github.token }} + version: ${{ inputs.buf_version }} + - if: ${{ steps.cache.outputs.cache-hit != 'true' }} + uses: pnpm/action-setup@v4 + - if: ${{ steps.cache.outputs.cache-hit != 'true' }} + uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node_version }} + cache: "pnpm" + cache-dependency-path: pnpm-lock.yaml + - if: ${{ steps.cache.outputs.cache-hit != 'true' }} + name: Install dependencies + run: pnpm install + - if: ${{ steps.cache.outputs.cache-hit != 'true' }} + name: Build docs with Turbo + run: pnpm turbo build --filter=./docs + - if: ${{ steps.cache.outputs.cache-hit != 'true' }} + uses: actions/cache/save@v4 + with: + path: ${{ env.cache_path }} + key: ${{ steps.cache.outputs.cache-primary-key }} diff --git a/.github/workflows/login-quality.yml b/.github/workflows/login-quality.yml index 0b4fea73f4..81383941c6 100644 --- a/.github/workflows/login-quality.yml +++ b/.github/workflows/login-quality.yml @@ -4,7 +4,7 @@ on: workflow_call: inputs: ignore-run-cache: - description: 'Ignore run caches' + description: "Ignore run caches" type: boolean required: true node_version: @@ -43,7 +43,16 @@ jobs: run: | tar -xvf .artifacts/zitadel-linux-amd64.tar.gz mv zitadel-linux-amd64/zitadel ./zitadel - - run: make login_quality + - uses: pnpm/action-setup@v4 + - uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node_version }} + cache: "pnpm" + cache-dependency-path: pnpm-lock.yaml + - name: Install dependencies + run: pnpm install + - name: Run login quality checks with Turbo + run: pnpm turbo lint test:unit --filter=./login env: # latest if branch is main, otherwise image version which is the pull request number LOGIN_BAKE_CLI: depot bake diff --git a/docs/turbo.json b/docs/turbo.json new file mode 100644 index 0000000000..3b4df47539 --- /dev/null +++ b/docs/turbo.json @@ -0,0 +1,40 @@ +{ + "$schema": "https://turbo.build/schema.json", + "extends": ["//"], + "tasks": { + "generate": { + "dependsOn": ["^generate"], + "outputs": ["docs/api/**", "docs/self-hosting/manage/configure/*.yaml"], + "cache": true + }, + "generate:grpc": { + "dependsOn": ["^generate"], + "outputs": ["docs/api/**"], + "cache": true + }, + "generate:apidocs": { + "dependsOn": ["generate:grpc"], + "outputs": ["docs/api/**"], + "cache": true + }, + "generate:configdocs": { + "outputs": ["docs/self-hosting/manage/configure/*.yaml"], + "cache": true + }, + "build": { + "dependsOn": ["generate"], + "outputs": ["build/**"], + "cache": true + }, + "start": { + "dependsOn": ["generate"], + "cache": false, + "persistent": true + }, + "start:api": { + "dependsOn": ["generate"], + "cache": false, + "persistent": true + } + } +}