| # 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: | |
| # Required checks must report a result even for documentation-only PRs. | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| paths-ignore: | |
| - '**.md' | |
| - '**.txt' | |
| - '**.png' | |
| - '**.jpg' | |
| - '**.jpeg' | |
| - '**.gif' | |
| - '**.svg' | |
| - '**.ico' | |
| - '**.pdf' | |
| - '**.doc' | |
| - '**.docx' | |
| - 'LICENSE' | |
| - 'NOTICE' | |
| - 'DISCLAIMER' | |
| - '.asf.yaml' | |
| - '.gitignore' | |
| - '.licenserc.yaml' | |
| - '.github/ISSUE_TEMPLATE/**' | |
| - '.github/PULL_REQUEST_TEMPLATE' | |
| - '**/resources/static/**' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| agent_gateway_migrations: | |
| if: github.repository == 'apache/shenyu' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Check Agent Gateway upgrade and schema consistency | |
| run: | | |
| python3 .github/scripts/check-agent-gateway-migrations.py | |
| python3 .github/scripts/test-agent-gateway-migrations.py | |
| changes: | |
| if: github.repository == 'apache/shenyu' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| code: ${{ steps.modules.outputs.has_code_changes }} | |
| code_files: ${{ steps.filter.outputs.code_files }} | |
| rat_required: ${{ steps.filter.outputs.code }} | |
| modules: ${{ steps.modules.outputs.modules }} | |
| full_build_required: ${{ steps.modules.outputs.full_build_required }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Test CI case resolver | |
| run: bash .github/scripts/resolve-test-case-matrix-test.sh | |
| - name: Test Maven transfer retries | |
| run: bash .github/scripts/maven-with-retry-test.sh | |
| - name: Test storage Compose healthchecks | |
| run: bash shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/compose-script-test.sh | |
| - uses: ./actions/paths-filter | |
| id: filter | |
| with: | |
| list-files: "json" | |
| filters: | | |
| code: | |
| - '!**/*.md' | |
| - '!**/*.txt' | |
| - '!resources/static/**' | |
| - '!.asf.yaml' | |
| - '!.gitignore' | |
| - '!.licenserc.yaml' | |
| - '!LICENSE' | |
| - '!**/LICENSE' | |
| - '!shenyu-*/**/LICENSE' | |
| - '!shenyu-*/**/release-docs/LICENSE' | |
| - '!NOTICE' | |
| - '!**/NOTICE' | |
| - '!shenyu-*/**/NOTICE' | |
| - '!shenyu-*/**/release-docs/NOTICE' | |
| - '!.github/ISSUE_TEMPLATE/**' | |
| - '!.github/PULL_REQUEST_TEMPLATE' | |
| - 'shenyu-*/**' | |
| - 'pom.xml' | |
| - '**/pom.xml' | |
| - 'mvnw' | |
| - 'mvnw.cmd' | |
| - '.mvn/**' | |
| - '.github/workflows/**' | |
| - '.github/scripts/**' | |
| - name: Resolve changed Maven modules | |
| id: modules | |
| if: steps.filter.outputs.code == 'true' | |
| env: | |
| CHANGED_FILES_JSON: ${{ steps.filter.outputs.code_files }} | |
| run: bash .github/scripts/resolve-ci-modules.sh | |
| - name: Test GHCR publish routing | |
| run: bash .github/scripts/resolve-ghcr-publish-test.sh | |
| registry_dependencies: | |
| needs: changes | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'apache/shenyu' && needs.changes.outputs.code == 'true' | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: ./actions/setup-java-with-retry | |
| with: | |
| java-version: "17" | |
| distribution: "temurin" | |
| - name: Replay registration contract and check resolved client boundaries | |
| run: | | |
| python3 .github/scripts/test-client-boundary.py | |
| python3 .github/scripts/check-client-boundary.py | |
| ./mvnw -B -ntp -pl shenyu-admin,shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-beat -am package dependency:tree \ | |
| -Dtest=RegistrationProtocolCompatibilityTest,ZookeeperClientDiscoveryIntegrationTest,HeartbeatListenerConfigurationTest \ | |
| -Dsurefire.failIfNoSpecifiedTests=false -DskipRemoteResources=true -Djacoco.skip=true -Dmaven.javadoc.skip=true \ | |
| -Dscope=test -DoutputType=tgf -DoutputFile=target/client-boundary.tgf | |
| python3 .github/scripts/check-client-boundary.py --trees | |
| - name: Check resolved registry dependency boundaries | |
| run: | | |
| python3 .github/scripts/test-registry-dependencies.py | |
| REGISTRY_MODULES="$(python3 .github/scripts/check-registry-dependencies.py --modules)" | |
| ./mvnw -B -ntp -pl "$REGISTRY_MODULES" -am package dependency:tree \ | |
| -DskipTests -DskipRemoteResources=true -Djacoco.skip=true -Dmaven.javadoc.skip=true \ | |
| -Dscope=runtime -DoutputType=tgf -DoutputFile=target/registry-dependencies.tgf | |
| python3 .github/scripts/check-registry-dependencies.py | |
| rat_check: | |
| needs: changes | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'apache/shenyu' && needs.changes.outputs.rat_required == 'true' | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: ./actions/setup-java-with-retry | |
| with: | |
| java-version: "17" | |
| distribution: "temurin" | |
| - name: Run Apache RAT check | |
| run: ./mvnw -B -ntp apache-rat:check | |
| pr_build: | |
| needs: changes | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'apache/shenyu' && github.event_name == 'pull_request' && needs.changes.outputs.code == 'true' | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| - name: Debug - Show matched files | |
| run: | | |
| echo "Matched files: ${{ needs.changes.outputs.code_files }}" | |
| echo "Resolved modules: ${{ needs.changes.outputs.modules }}" | |
| echo "Full build required: ${{ needs.changes.outputs.full_build_required }}" | |
| - name: Restore ShenYu Maven Repos | |
| id: restore-maven-cache | |
| uses: actions/cache/restore@v3 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - uses: ./actions/setup-java-with-retry | |
| with: | |
| java-version: "17" | |
| distribution: "temurin" | |
| - name: Build with Maven | |
| shell: bash | |
| run: | | |
| MAVEN_ARGS="-B -ntp -T 1C" | |
| TEST_ARGS="-Prelease -DskipRemoteResources=true -Djacoco.skip=true" | |
| MODULE_ARGS="" | |
| if [[ "${{ needs.changes.outputs.full_build_required }}" != "true" && -n "${{ needs.changes.outputs.modules }}" ]]; then | |
| MODULE_ARGS="-pl ${{ needs.changes.outputs.modules }} -am" | |
| fi | |
| exec bash .github/scripts/maven-with-retry.sh ./mvnw ${MAVEN_ARGS} ${MODULE_ARGS} test ${TEST_ARGS} | |
| build_local_repo: | |
| needs: changes | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'apache/shenyu' && github.event_name == 'push' && needs.changes.outputs.code == 'true' | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| - name: Restore ShenYu Maven Repos | |
| id: restore-maven-cache | |
| uses: actions/cache/restore@v3 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - uses: ./actions/setup-java-with-retry | |
| with: | |
| java-version: "17" | |
| distribution: "temurin" | |
| - name: Install mvnd | |
| shell: bash | |
| run: | | |
| MVND_VERSION=1.0.6 | |
| curl -sfL https://downloads.apache.org/maven/mvnd/${MVND_VERSION}/maven-mvnd-${MVND_VERSION}-linux-amd64.zip -o mvnd.zip | |
| unzip -q mvnd.zip | |
| mkdir -p $HOME/.local | |
| mv maven-mvnd-${MVND_VERSION}-linux-amd64 $HOME/.local/mvnd | |
| echo "$HOME/.local/mvnd/bin" >> $GITHUB_PATH | |
| echo "MVND_HOME=$HOME/.local/mvnd" >> $GITHUB_ENV | |
| - name: Build ShenYu local Maven repository | |
| shell: bash | |
| run: | | |
| MAVEN_ARGS="-B -ntp -T 1C" | |
| BUILD_ARGS="-Prelease -DskipTests -DskipRemoteResources=true -Djacoco.skip=true -Dmaven.javadoc.skip=true -Drat.skip=true" | |
| if mvnd --version > /dev/null 2>&1; then | |
| echo "Using mvnd for local repository build" | |
| mvnd ${MAVEN_ARGS} install ${BUILD_ARGS} | |
| else | |
| echo "Falling back to maven wrapper" | |
| ./mvnw ${MAVEN_ARGS} install ${BUILD_ARGS} | |
| fi | |
| mkdir -p /tmp/shenyu-m2/org/apache | |
| cp -R "${HOME}/.m2/repository/org/apache/shenyu" /tmp/shenyu-m2/org/apache/shenyu | |
| - name: Upload ShenYu local Maven repository | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: shenyu-local-maven-repository | |
| path: /tmp/shenyu-m2 | |
| retention-days: 1 | |
| test_group: | |
| needs: | |
| - changes | |
| - build_local_repo | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'apache/shenyu' && github.event_name == 'push' && needs.changes.outputs.code == 'true' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: core | |
| modules: shenyu-common,shenyu-spi,shenyu-disruptor,shenyu-protocol,shenyu-loadbalancer | |
| - name: gateway | |
| modules: shenyu-web,shenyu-bootstrap,shenyu-spring-boot-starter | |
| - name: admin-sync | |
| modules: shenyu-admin,shenyu-admin-listener,shenyu-sync-data-center | |
| - name: plugin | |
| modules: shenyu-plugin | |
| - name: client-register-registry | |
| modules: shenyu-client,shenyu-register-center,shenyu-registry | |
| - name: dist-extra | |
| modules: shenyu-dist,shenyu-sdk,shenyu-alert,shenyu-kubernetes-controller,shenyu-infra | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| - name: Restore ShenYu Maven Repos | |
| id: restore-maven-cache | |
| uses: actions/cache/restore@v3 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - uses: ./actions/setup-java-with-retry | |
| with: | |
| java-version: "17" | |
| distribution: "temurin" | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: shenyu-local-maven-repository | |
| path: /tmp/shenyu-m2 | |
| - name: Restore ShenYu local Maven repository | |
| run: bash .github/scripts/restore-shenyu-local-repo.sh /tmp/shenyu-m2 | |
| - name: Run Maven tests | |
| shell: bash | |
| run: | | |
| modules="$(GROUP_ROOTS="${{ matrix.modules }}" bash .github/scripts/expand-ci-module-roots.sh)" | |
| echo "Testing Maven modules: ${modules}" | |
| ./mvnw -B -ntp -T 1C -pl "${modules}" test -Prelease -DskipRemoteResources=true | |
| - uses: codecov/codecov-action@v1 | |
| with: | |
| token: 2760af6a-3405-4882-9e61-04c5176fecfa | |
| flags: ${{ matrix.name }} | |
| compat_java21: | |
| needs: | |
| - changes | |
| - build_local_repo | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'apache/shenyu' && github.event_name == 'push' && needs.changes.outputs.code == 'true' | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| - name: Restore ShenYu Maven Repos | |
| id: restore-maven-cache | |
| uses: actions/cache/restore@v3 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - uses: ./actions/setup-java-with-retry | |
| with: | |
| java-version: "21" | |
| distribution: "temurin" | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: shenyu-local-maven-repository | |
| path: /tmp/shenyu-m2 | |
| - name: Restore ShenYu local Maven repository | |
| run: bash .github/scripts/restore-shenyu-local-repo.sh /tmp/shenyu-m2 | |
| - name: Run Java 21 compatibility tests | |
| shell: bash | |
| run: | | |
| ./mvnw -B -ntp -T 1C test -Prelease -DskipRemoteResources=true -Djacoco.skip=true | |
| check-license-header: | |
| name: check-license-header | |
| if: (github.repository == 'apache/shenyu') | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| - name: Check License Header | |
| uses: apache/skywalking-eyes@9bd5feb86b5817aa6072b008f9866a2c3bbc8587 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| requirement: | |
| name: build | |
| if: (github.repository == 'apache/shenyu') && always() | |
| needs: | |
| - changes | |
| - rat_check | |
| - pr_build | |
| - build_local_repo | |
| - test_group | |
| - compat_java21 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checking job status | |
| run: | | |
| [[ "${{ needs.changes.result }}" == "success" ]] || exit -1 | |
| if [[ "${{ needs.changes.outputs.rat_required }}" == "true" ]]; then | |
| [[ "${{ needs.rat_check.result }}" == "success" ]] || exit -1 | |
| fi | |
| if [[ "${{ needs.changes.outputs.code }}" == "true" && "${{ github.event_name }}" == "pull_request" ]]; then | |
| [[ "${{ needs.pr_build.result }}" == "success" ]] || exit -1 | |
| fi | |
| if [[ "${{ needs.changes.outputs.code }}" == "true" && "${{ github.event_name }}" == "push" ]]; then | |
| [[ "${{ needs.build_local_repo.result }}" == "success" ]] || exit -1 | |
| [[ "${{ needs.test_group.result }}" == "success" ]] || exit -1 | |
| [[ "${{ needs.compat_java21.result }}" == "success" ]] || exit -1 | |
| fi |