| # 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: _test |
| on: |
| workflow_call: |
| inputs: |
| component: |
| type: string |
| required: true |
| description: "Component to test" |
| task: |
| type: string |
| required: true |
| description: "Task to run" |
| secrets: |
| CODECOV_TOKEN: |
| required: false |
| |
| permissions: |
| contents: read |
| security-events: write |
| pull-requests: write |
| |
| jobs: |
| run: |
| # Select runner based on build target |
| runs-on: ${{ |
| (inputs.task == 'build-aarch64-gnu' || inputs.task == 'build-aarch64-musl') && 'ubuntu-24.04-arm' || |
| inputs.task == 'build-macos-aarch64' && 'macos-14' || |
| 'ubuntu-latest' |
| }} |
| timeout-minutes: 60 |
| steps: |
| - name: Checkout code |
| uses: actions/checkout@v4 |
| |
| - name: Skip noop |
| if: inputs.component == 'noop' |
| run: echo "No changes detected, skipping tests" |
| |
| # Rust |
| - name: Run Rust task |
| if: startsWith(inputs.component, 'rust') |
| uses: ./.github/actions/rust/pre-merge |
| with: |
| task: ${{ inputs.task }} |
| component: ${{ inputs.component }} |
| |
| - name: Upload coverage to Codecov |
| if: startsWith(inputs.component, 'rust') && inputs.task == 'test' |
| uses: codecov/codecov-action@v5 |
| with: |
| token: ${{ secrets.CODECOV_TOKEN }} |
| files: codecov.json |
| flags: rust |
| fail_ci_if_error: false |
| verbose: true |
| |
| # Python SDK |
| - name: Set up Docker Buildx for Python |
| if: inputs.component == 'sdk-python' && inputs.task == 'test' |
| uses: docker/setup-buildx-action@v3 |
| |
| - name: Run Python SDK task |
| if: inputs.component == 'sdk-python' |
| uses: ./.github/actions/python-maturin/pre-merge |
| with: |
| task: ${{ inputs.task }} |
| |
| # Node SDK |
| - name: Run Node SDK task |
| if: inputs.component == 'sdk-node' |
| uses: ./.github/actions/node-npm/pre-merge |
| with: |
| task: ${{ inputs.task }} |
| |
| # Go SDK |
| - name: Run Go SDK task |
| if: inputs.component == 'sdk-go' |
| uses: ./.github/actions/go/pre-merge |
| with: |
| task: ${{ inputs.task }} |
| |
| # Java SDK |
| - name: Run Java SDK task |
| if: inputs.component == 'sdk-java' |
| uses: ./.github/actions/java-gradle/pre-merge |
| with: |
| task: ${{ inputs.task }} |
| |
| # C# SDK |
| - name: Run C# SDK task |
| if: inputs.component == 'sdk-csharp' |
| uses: ./.github/actions/csharp-dotnet/pre-merge |
| with: |
| task: ${{ inputs.task }} |
| |
| # Web UI |
| - name: Run Web UI task |
| if: inputs.component == 'web-ui' |
| run: | |
| cd web |
| npm ci |
| if [ "${{ inputs.task }}" = "lint" ]; then |
| npm run lint |
| elif [ "${{ inputs.task }}" = "build" ]; then |
| npm run build |
| fi |
| |
| # CI workflow validation |
| - name: Validate CI workflows |
| if: inputs.component == 'ci-workflows' && inputs.task == 'validate' |
| run: | |
| echo "Validating GitHub Actions workflows..." |
| # Basic YAML validation |
| for workflow in .github/workflows/*.yml; do |
| echo "Checking $workflow" |
| python -c "import yaml; yaml.safe_load(open('$workflow'))" || exit 1 |
| done |
| echo "All workflows are valid YAML" |
| |
| # Upload reports |
| - name: Upload reports |
| if: always() |
| uses: actions/upload-artifact@v4 |
| with: |
| name: ${{ inputs.component }}-${{ inputs.task }}-reports-${{ github.run_id }}-${{ github.run_attempt }} |
| path: | |
| reports/** |
| target/llvm-cov/** |
| coverage.lcov |
| codecov.json |
| if-no-files-found: ignore |
| retention-days: 7 |