| # Licensed to the Apache Software Foundation (ASF) under one | |
| # or more contributor license agreements. See the NOTICE file | |
| # distributed with this work for additional information | |
| # regarding copyright ownership. The ASF licenses this file | |
| # to you under the Apache License, Version 2.0 (the | |
| # "License"); you may not use this file except in compliance | |
| # with the License. You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, | |
| # software distributed under the License is distributed on an | |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| # KIND, either express or implied. See the License for the | |
| # specific language governing permissions and limitations | |
| # under the License. | |
| name: CI | |
| on: | |
| pull_request: | |
| branches: [main, rust-preview] | |
| push: | |
| branches: [main, rust-preview] | |
| workflow_dispatch: | |
| inputs: | |
| worker: | |
| description: "Validate one registered worker (leave empty for full CI)" | |
| type: string | |
| required: false | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ci-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| defaults: | |
| run: | |
| shell: bash | |
| env: | |
| CARGO_INCREMENTAL: "0" | |
| CARGO_PROFILE_DEV_DEBUG: "0" | |
| CARGO_PROFILE_TEST_DEBUG: "0" | |
| CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG: "0" | |
| CARGO_PROFILE_TEST_BUILD_OVERRIDE_DEBUG: "0" | |
| jobs: | |
| plan: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| tooling: ${{ steps.plan.outputs.tooling }} | |
| root: ${{ steps.plan.outputs.root }} | |
| workers: ${{ steps.plan.outputs.workers }} | |
| artifact: ${{ steps.upload.outputs.artifact-id }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 2 | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: "26" | |
| package-manager-cache: false | |
| - id: plan | |
| env: | |
| MAKA_CI_WORKER: ${{ inputs.worker }} | |
| run: node scripts/ci.mjs plan | |
| - name: Check documentation source headers | |
| if: steps.plan.outputs.tooling != 'true' | |
| run: node scripts/asf-license-headers.mjs check | |
| - uses: actions/upload-artifact@v7 | |
| id: upload | |
| with: | |
| name: ci-plan-${{ github.run_attempt }} | |
| path: ${{ runner.temp }}/ci-plan.json | |
| if-no-files-found: error | |
| tooling: | |
| needs: plan | |
| if: needs.plan.outputs.tooling == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 180 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| persist-credentials: false | |
| - uses: ./.github/actions/ci-setup | |
| with: | |
| role: tooling | |
| javascript: "true" | |
| compile: "false" | |
| - run: node scripts/ci.mjs run tooling | |
| root-build: | |
| needs: plan | |
| if: needs.plan.outputs.root == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 180 | |
| outputs: | |
| partitions: ${{ steps.archive.outputs.partitions }} | |
| has_tests: ${{ steps.archive.outputs.has_tests }} | |
| nextest: ${{ steps.archive.outputs.nextest }} | |
| filter: ${{ steps.archive.outputs.filter }} | |
| native: ${{ steps.upload-native.outputs.artifact-id }} | |
| cli: ${{ steps.upload-cli.outputs.artifact-id }} | |
| rest: ${{ steps.upload-rest.outputs.artifact-id }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| persist-credentials: false | |
| - uses: ./.github/actions/ci-setup | |
| id: setup | |
| with: | |
| role: root | |
| dependencies: headless | |
| javascript: "true" | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| artifact-ids: ${{ needs.plan.outputs.artifact }} | |
| path: ${{ runner.temp }} | |
| merge-multiple: true | |
| - name: Build and archive selected tests | |
| id: archive | |
| run: node scripts/ci.mjs archive | |
| - uses: actions/upload-artifact@v7 | |
| id: upload-native | |
| if: steps.archive.outputs.has_tests == 'true' | |
| with: | |
| name: root-tests-native-${{ github.run_attempt }} | |
| path: ${{ runner.temp }}/root-tests-native.tar.zst | |
| compression-level: 0 | |
| if-no-files-found: ignore | |
| - uses: actions/upload-artifact@v7 | |
| id: upload-cli | |
| if: steps.archive.outputs.has_tests == 'true' | |
| with: | |
| name: root-tests-cli-${{ github.run_attempt }} | |
| path: ${{ runner.temp }}/root-tests-cli.tar.zst | |
| compression-level: 0 | |
| if-no-files-found: ignore | |
| - uses: actions/upload-artifact@v7 | |
| id: upload-rest | |
| if: steps.archive.outputs.has_tests == 'true' | |
| with: | |
| name: root-tests-rest-${{ github.run_attempt }} | |
| path: ${{ runner.temp }}/root-tests-rest.tar.zst | |
| compression-level: 0 | |
| if-no-files-found: ignore | |
| - uses: ./.github/actions/ci-cache | |
| if: ${{ github.event_name == 'push' && !cancelled() && steps.archive.outcome == 'success' }} | |
| with: | |
| key: ${{ steps.setup.outputs.compiled_key }} | |
| hit: ${{ steps.setup.outputs.compiled_hit }} | |
| - name: Report producer storage | |
| if: always() | |
| run: | | |
| df -h "$GITHUB_WORKSPACE" "$RUNNER_TEMP" | |
| if [ -d target ]; then du -sh target; fi | |
| root-tests: | |
| needs: root-build | |
| if: needs.root-build.outputs.has_tests == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 180 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: ${{ fromJSON(needs.root-build.outputs.partitions) }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| persist-credentials: false | |
| - uses: ./.github/actions/ci-setup | |
| with: | |
| role: replay | |
| dependencies: replay | |
| javascript: ${{ matrix.group == 'rest' }} | |
| compile: "false" | |
| nextest: ${{ needs.root-build.outputs.nextest }} | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| artifact-ids: ${{ needs.root-build.outputs[matrix.group] }} | |
| path: ${{ runner.temp }} | |
| merge-multiple: true | |
| - name: Execute the produced test partition | |
| env: | |
| MAKA_CI_FILTER: ${{ needs.root-build.outputs.filter }} | |
| MAKA_CI_HELPERS: ${{ toJSON(matrix.helpers) }} | |
| run: node scripts/ci.mjs replay '${{ matrix.group }}' '${{ matrix.partition }}' "$MAKA_CI_HELPERS" -E "$MAKA_CI_FILTER" | |
| suites: | |
| needs: plan | |
| if: needs.plan.outputs.workers != '[]' | |
| name: ${{ matrix.id }} | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 180 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: ${{ fromJSON(needs.plan.outputs.workers) }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| persist-credentials: false | |
| - uses: ./.github/actions/ci-setup | |
| id: setup | |
| with: | |
| role: ${{ matrix.id }} | |
| cache_role: ${{ matrix.cacheRole || matrix.id }} | |
| workspace: ${{ matrix.workspace }} | |
| dependencies: ${{ matrix.dependencies }} | |
| javascript: ${{ matrix.javascript }} | |
| compile: ${{ matrix.compile }} | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| artifact-ids: ${{ needs.plan.outputs.artifact }} | |
| path: ${{ runner.temp }} | |
| merge-multiple: true | |
| - name: Compile selected suites | |
| id: compile | |
| run: node scripts/ci.mjs prepare '${{ matrix.id }}' | |
| - name: Verify selected suites | |
| id: verify | |
| if: ${{ !cancelled() && (steps.compile.outcome == 'success' || steps.compile.outcome == 'failure') }} | |
| shell: bash | |
| env: | |
| MAKA_UI_ARTIFACT_DIR: ${{ runner.temp }}/maka-ui-artifacts | |
| run: | | |
| set -o pipefail | |
| node scripts/ci.mjs verify '${{ matrix.id }}' 2>&1 | tee "$RUNNER_TEMP/maka-suite-verify.log" | |
| - uses: actions/upload-artifact@v7 | |
| if: ${{ failure() && steps.verify.outcome == 'failure' }} | |
| with: | |
| name: ${{ matrix.id }}-failure-log-${{ github.run_attempt }} | |
| path: | | |
| ${{ runner.temp }}/maka-suite-verify.log | |
| ${{ runner.temp }}/maka-ui-artifacts | |
| if-no-files-found: error | |
| - uses: ./.github/actions/ci-cache | |
| if: ${{ github.event_name == 'push' && !cancelled() && matrix.compile && matrix.saveCache && steps.compile.outcome == 'success' }} | |
| env: | |
| MAKA_CI_ROLE: ${{ matrix.id }} | |
| with: | |
| key: ${{ steps.setup.outputs.compiled_key }} | |
| hit: ${{ steps.setup.outputs.compiled_hit }} | |
| workspace: ${{ matrix.workspace }} | |
| - name: Report worker storage | |
| if: always() | |
| run: | | |
| df -h "$GITHUB_WORKSPACE" "$RUNNER_TEMP" | |
| if [ -d target ]; then du -sh target; fi | |
| test: | |
| name: ${{ inputs.worker && format('test ({0})', inputs.worker) || 'test' }} | |
| needs: [plan, tooling, root-build, root-tests, suites] | |
| if: always() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: "26" | |
| package-manager-cache: false | |
| - name: Require a successful plan | |
| if: needs.plan.result != 'success' | |
| run: node -e 'throw new Error("CI planning did not succeed")' | |
| - uses: actions/download-artifact@v8 | |
| if: needs.plan.result == 'success' | |
| with: | |
| artifact-ids: ${{ needs.plan.outputs.artifact }} | |
| path: ${{ runner.temp }} | |
| merge-multiple: true | |
| - name: Require all planned work to succeed | |
| if: needs.plan.result == 'success' | |
| env: | |
| MAKA_CI_RESULTS: ${{ toJSON(needs) }} | |
| MAKA_CI_HAS_TESTS: ${{ needs.root-build.outputs.has_tests }} | |
| run: node scripts/ci.mjs gate |