diff --git a/.github/workflows/approve-label.yml b/.github/workflows/approve-label.yml deleted file mode 100644 index a631c84a74..0000000000 --- a/.github/workflows/approve-label.yml +++ /dev/null @@ -1,64 +0,0 @@ -# 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: "Label when approved workflow run" -on: - workflow_run: - workflows: [Label-when-reviewed] - types: [requested] -permissions: - # All other permissions are set to none - checks: write - contents: read - pull-requests: write -jobs: - label-when-approved: - name: "Label when approved" - runs-on: ubuntu-latest - outputs: - isApprovedByCommitters: ${{ steps.label-when-approved-by-committers.outputs.isApproved }} - isApprovedByAnyone: ${{ steps.label-when-approved-by-anyone.outputs.isApproved }} - steps: - - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" - uses: actions/checkout@v2 - with: - persist-credentials: false - submodules: recursive - - name: "Get information about the original trigger of the run" - uses: ./.github/actions/get-workflow-origin - id: source-run-info - with: - token: ${{ secrets.GITHUB_TOKEN }} - sourceRunId: ${{ github.event.workflow_run.id }} - - name: Label when approved by committers - uses: ./.github/actions/label-when-approved-action - id: label-when-approved-by-committers - with: - token: ${{ secrets.GITHUB_TOKEN }} - label: 'approved' - require_committers_approval: 'true' - remove_label_when_approval_missing: 'true' - pullRequestNumber: ${{ steps.source-run-info.outputs.pullRequestNumber }} - - name: Label when approved by anyone - uses: ./.github/actions/label-when-approved-action - id: label-when-approved-by-anyone - with: - token: ${{ secrets.GITHUB_TOKEN }} - label: 'reviewed' - pullRequestNumber: ${{ steps.source-run-info.outputs.pullRequestNumber }} - remove_label_when_approval_missing: 'true' diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 87dd0cfee9..77bd185eff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,14 +22,9 @@ on: branches: - master pull_request: - paths-ignore: - - 'chunjun-docker/**/*' - - 'chunjun-examples/**/*' - - 'chunjun-dev/**/*' - - '**/*.md' - - 'docs/**/*' - - 'website/**/*' - - '**/*.ftl' + +permissions: + contents: read concurrency: group: backend-${{ github.event.pull_request.number || github.ref }} @@ -43,11 +38,9 @@ jobs: timeout-minutes: 10 steps: - name: Checkout code - uses: actions/checkout@v3 - with: - submodules: true + uses: actions/checkout@v4 - name: Set up JDK 8 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: 8 distribution: 'temurin' @@ -63,22 +56,50 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 90 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + with: + fetch-depth: 2 + - name: Check whether the PR needs a Maven build + id: scope + if: github.event_name == 'pull_request' + shell: bash + run: | + changed_files="$(mktemp)" + trap 'rm -f "$changed_files"' EXIT + git diff --name-only --no-renames -z HEAD^1 HEAD > "$changed_files" + while IFS= read -r -d '' path; do + case "$path" in + chunjun-docker/*|chunjun-examples/*|chunjun-dev/*|*.md|docs/*|website/*|*.ftl) ;; + *) + echo "maven=true" >> "$GITHUB_OUTPUT" + exit 0 + ;; + esac + done < "$changed_files" + echo "maven=false" >> "$GITHUB_OUTPUT" - name: Set up JDK 8 - uses: actions/setup-java@v3 + if: steps.scope.outputs.maven != 'false' + uses: actions/setup-java@v4 with: java-version: 8 distribution: 'temurin' cache: 'maven' - - name: add dependencies - - name: build project - run: | - ./mvnw clean package -Dmaven.test.skip --no-snapshot-updates - - name: unit-test - run: | - ./mvnw -T 1C clean compile test -DskipUT=false -DskipITCase=false --no-snapshot-updates - - name: integration-test + - name: Install the GBase JDBC driver + if: steps.scope.outputs.maven != 'false' + shell: bash run: | - ./mvnw -T 1C -B verify -DskipUT=true -DskipIT=false --no-snapshot-updates -pl chunjun-e2e -am + # This exact version is not in Maven Central. Use the original, + # immutable upstream artifact without adding binaries to the checkout. + jar="$RUNNER_TEMP/gbase-8.3.81.53.jar" + curl --fail --silent --show-error --location --retry 3 --max-time 60 \ + 'https://raw.githubusercontent.com/DTStack/chunjun/0adb82e4566d09ff547165f15ab7d3a6dd2966fc/jars/gbase-8.3.81.53.jar' \ + --output "$jar" + echo "687687f0d0798deabfba2cccf3ab7e6808c76b0b4af2299044ab82a97deb69fa $jar" | sha256sum --check + ./mvnw -B -N org.apache.maven.plugins:maven-install-plugin:3.1.4:install-file \ + -DgroupId=com.esen.jdbc -DartifactId=gbase -Dversion=8.3.81.53 \ + -Dpackaging=jar -Dfile="$jar" -DgeneratePom=true + - name: Verify the reactor + if: steps.scope.outputs.maven != 'false' + run: ./mvnw -B clean verify -Dspotless.check.skip=true --no-snapshot-updates env: MAVEN_OPTS: -Xmx2048m diff --git a/.github/workflows/approve-label-trigger.yml b/.github/workflows/workflow-lint.yml similarity index 54% rename from .github/workflows/approve-label-trigger.yml rename to .github/workflows/workflow-lint.yml index 5ed70f747d..cd09d84f85 100644 --- a/.github/workflows/approve-label-trigger.yml +++ b/.github/workflows/workflow-lint.yml @@ -14,15 +14,34 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -# -name: Label-when-reviewed -on: pull_request_review -jobs: +name: Workflow lint + +on: + pull_request: + paths: + - '.github/workflows/**' + push: + branches: + - master + paths: + - '.github/workflows/**' - label-when-reviewed: - name: "Label PRs when reviewed" +permissions: + contents: read + +jobs: + actionlint: runs-on: ubuntu-latest + timeout-minutes: 5 steps: - - name: "Do nothing. Only trigger corresponding workflow_run event" - run: echo + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: '1.23.x' + cache: false + - name: Validate GitHub Actions workflows + # Legacy runtime warnings in docs-deploy.yml and label.yml are tracked separately. + run: >- + go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.7 + -ignore 'runner of "actions/(checkout@v3|setup-node@v3|labeler@v4)" action is too old' diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index a5d0c92009..0000000000 --- a/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule ".github/actions/get-workflow-origin"] - path = .github/actions/get-workflow-origin - url = https://github.com/potiuk/get-workflow-origin.git -[submodule ".github/actions/label-when-approved-action"] - path = .github/actions/label-when-approved-action - url = https://github.com/TobKed/label-when-approved-action