Merge pull request #177 from binance/handle_data_streams #122
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
| name: Java Main Workflow | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master, rc-* ] | |
| jobs: | |
| detect-targets: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| modified_targets: ${{ steps.filter.outputs.modified_targets }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 2 | |
| - name: Detect modified targets | |
| id: filter | |
| run: | | |
| MODIFIED_TARGETS=() | |
| # Ensure HEAD^ exists | |
| if git rev-parse --verify HEAD^ >/dev/null 2>&1; then | |
| BASE_COMMIT="HEAD^" | |
| else | |
| BASE_COMMIT=$(git rev-list --max-parents=0 HEAD) # First commit | |
| fi | |
| # Check each client dynamically | |
| while read client; do | |
| CLIENT_NAME=$(basename "$client") | |
| if ! git diff --quiet "$BASE_COMMIT" HEAD -- "$client"; then | |
| echo "Changes detected in $CLIENT_NAME" | |
| MODIFIED_TARGETS+=("$CLIENT_NAME") | |
| fi | |
| done < <(find clients/* -type d -maxdepth 0) | |
| # Convert to JSON array format | |
| MODIFIED_TARGETS_JSON=$(printf '%s\n' "${MODIFIED_TARGETS[@]}" | jq -R -s -c 'split("\n") | map(select(. != ""))') | |
| echo "Detected modified targets: $MODIFIED_TARGETS_JSON" | |
| echo "modified_targets=$MODIFIED_TARGETS_JSON" >> $GITHUB_ENV | |
| echo "::set-output name=modified_targets::$MODIFIED_TARGETS_JSON" | |
| verify: | |
| runs-on: ubuntu-latest | |
| needs: detect-targets | |
| if: ${{ needs.detect-targets.outputs.modified_targets != '[]' }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: 17 | |
| distribution: 'adopt' | |
| cache: 'maven' | |
| cache-dependency-path: | | |
| 'clients/pom.xml' | |
| 'examples/pom.xml' | |
| - name: Validate modules | |
| run: | | |
| mvn -f clients/pom.xml -pl common install -Dgpg.skip | |
| mvn -f clients/pom.xml -pl `echo '${{ needs.detect-targets.outputs.modified_targets }}' | jq -r 'join(",")'` verify -Dgpg.skip |