Repository navigation
Fixes #7957: Add distributed MCP invocation and concurrency quotas #1888
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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: native-sql-matrix | |
| on: | |
| pull_request: | |
| push: | |
| branches: [master] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| # Give every non-PR run its own group, including runs still waiting for a runner. | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| scope: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| required: ${{ steps.scope.outputs.required }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Determine SQL scope without skipping the aggregate check | |
| id: scope | |
| env: | |
| EVENT_NAME: ${{ github.event_name }} | |
| BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }} | |
| run: | | |
| python3 - <<'PY' | |
| import os, re, subprocess | |
| from pathlib import Path | |
| base = os.environ.get('BASE_SHA', '') | |
| required = True | |
| if os.environ['EVENT_NAME'] != 'workflow_dispatch' and re.fullmatch(r'[0-9a-f]{40}', base) and set(base) != {'0'}: | |
| subprocess.run(['git', 'fetch', '--no-tags', '--depth=1', 'origin', base], check=True) | |
| paths = subprocess.check_output(['git', 'diff', '--name-only', base, 'HEAD'], text=True).splitlines() | |
| paths = [path for path in paths if not ( | |
| 'docs' in Path(path).parts or | |
| (path.endswith('.md') and ('/' not in path or Path(path).name.startswith('README'))))] | |
| required = any(path.startswith(('db/init/', 'db/upgrade/', 'shenyu-admin/')) | |
| or path in ('.github/workflows/native-sql-matrix.yml', '.github/scripts/native-sql-matrix.py', | |
| '.github/scripts/test-native-sql-matrix.py') for path in paths) | |
| with open(os.environ['GITHUB_OUTPUT'], 'a') as output: | |
| output.write('required=' + str(required).lower() + '\n') | |
| PY | |
| runner-tests: | |
| needs: scope | |
| if: needs.scope.outputs.required == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: python3 .github/scripts/test-native-sql-matrix.py | |
| list-contract: | |
| needs: scope | |
| if: needs.scope.outputs.required == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 40 | |
| services: | |
| mysql: | |
| image: mysql:8.0@sha256:7dcddc01f13bab2f15cde676d44d01f61fc9f99fe7785e86196dfc07d358ae2b | |
| env: | |
| MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' | |
| MYSQL_ROOT_HOST: '%' | |
| MYSQL_DATABASE: shenyu_fencing_test_snapshot | |
| ports: | |
| - 3306/tcp | |
| options: >- | |
| --health-cmd="mysqladmin ping --host=127.0.0.1 --user=root" | |
| --health-interval=5s --health-timeout=5s --health-retries=30 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '17' | |
| cache: maven | |
| - name: Verify list/detail/export, index and fencing snapshot contracts | |
| run: >- | |
| exec bash .github/scripts/maven-with-retry.sh ./mvnw -B -ntp -pl shenyu-admin -am test | |
| -Dtest=PluginMapperTest,PluginServiceTest,PluginControllerTest,AdminQueryIndexTest,PluginIndexUpgradeContractTest,DataPermissionMapperTest,PermissionListenerIntegrationTest,InstanceInfoUpsertTest,MockRequestHeaderPersistenceTest,MockRequestHeaderMigrationTest,OracleSQLPrepareInterceptorTest,RegistrationFencingSnapshotTest | |
| -Dshenyu.fencing.test.jdbcUrl=jdbc:mysql://127.0.0.1:${{ job.services.mysql.ports[3306] }}/shenyu_fencing_test_snapshot | |
| -Dshenyu.fencing.test.username=root | |
| -Dsurefire.failIfNoSpecifiedTests=false -Dmaven.javadoc.skip=true | |
| native-sql: | |
| needs: scope | |
| if: needs.scope.outputs.required == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 40 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| dialect: [mysql, ob, pg, og, oracle] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Fetch immutable 2.7.1 baseline | |
| run: git fetch --no-tags --depth=1 origin 218c5634ebffb1f0ce7e8ea921b85cd5a633cde7 | |
| - name: Run native fresh-install and upgrade checks | |
| env: | |
| DIALECT: ${{ matrix.dialect }} | |
| RESULTS: ${{ runner.temp }}/sql-matrix/${{ matrix.dialect }} | |
| run: python3 .github/scripts/native-sql-matrix.py --dialect "$DIALECT" --output "$RESULTS" | |
| - name: Upload results and database startup logs | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sql-matrix-${{ matrix.dialect }} | |
| path: ${{ runner.temp }}/sql-matrix/${{ matrix.dialect }} | |
| if-no-files-found: warn | |
| - name: Remove this job's test containers | |
| if: ${{ !cancelled() }} | |
| env: | |
| DIALECT: ${{ matrix.dialect }} | |
| run: docker ps -aq --filter "name=^/shenyu-sql-${DIALECT}-" | xargs -r docker rm -f | |
| sql-matrix: | |
| name: sql-matrix | |
| if: ${{ !cancelled() }} | |
| needs: [scope, runner-tests, list-contract, native-sql] | |
| runs-on: ubuntu-latest | |
| env: | |
| SCOPE_RESULT: ${{ needs.scope.result }} | |
| RUNNER_RESULT: ${{ needs.runner-tests.result }} | |
| REQUIRED: ${{ needs.scope.outputs.required }} | |
| LIST_RESULT: ${{ needs.list-contract.result }} | |
| SQL_RESULT: ${{ needs.native-sql.result }} | |
| steps: | |
| - name: Require every applicable database and list contract | |
| run: | | |
| python3 - <<'PY' | |
| import os | |
| assert os.environ['SCOPE_RESULT'] == 'success', 'Scope detection failed' | |
| if os.environ['REQUIRED'] == 'true': | |
| assert os.environ['RUNNER_RESULT'] == 'success', 'SQL harness tests failed' | |
| assert os.environ['LIST_RESULT'] == 'success', 'List contract failed or was canceled/skipped' | |
| assert os.environ['SQL_RESULT'] == 'success', 'Native SQL matrix failed or was canceled/skipped' | |
| else: | |
| assert os.environ['REQUIRED'] == 'false', 'Missing scope output' | |
| assert os.environ['RUNNER_RESULT'] == 'skipped', 'Unexpected harness result' | |
| assert os.environ['LIST_RESULT'] == os.environ['SQL_RESULT'] == 'skipped', 'Unexpected SQL result' | |
| print('No SQL/Admin changes; native matrix is not applicable.') | |
| PY |