Skip to content

Commit

Permalink
Merge branch 'main' into graal-datastore-2
Browse files Browse the repository at this point in the history
On conflict, keep what's already in 2288.
  • Loading branch information
zhumin8 committed Oct 26, 2023
2 parents 450977e + c8d25c8 commit 654c1ca
Show file tree
Hide file tree
Showing 42 changed files with 397 additions and 154 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/NativeTests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ jobs:
- storage-sample
- trace-sample
- vision-sample
- pubsub-sample
- secretmanager-sample
- pubsub-integration-sample
- pubsub-bus-sample
- pubsub-stream-sample
steps:
- name: Get current date
id: date
Expand All @@ -56,10 +60,10 @@ jobs:
run: ./mvnw dependency:go-offline -ntp -B -T 1.5C
- name: Mvn install # Need this when the directory/pom structure changes
id: install
continue-on-error: true
run: |
./mvnw \
--batch-mode \
--no-transfer-progress \
--threads 1.5C \
--define maven.test.skip=true \
--define maven.javadoc.skip=true \
Expand All @@ -74,13 +78,13 @@ jobs:
native-image-job-reports: 'true'
- name: Native Tests in Modules
id: intTest
continue-on-error: true
run: |
MODULE_UNDER_TEST="${{ matrix.it }}" ./.github/workflows/scripts/native-image-tests.sh
- name: Aggregate Report
run: |
./mvnw \
--batch-mode \
--no-transfer-progress \
--define aggregate=true \
--activate-profiles spring-native,\!default \
surefire-report:report-only
Expand Down Expand Up @@ -129,10 +133,10 @@ jobs:
run: ./mvnw dependency:go-offline -ntp -B -T 1.5C
- name: Mvn install # Need this when the directory/pom structure changes
id: install
continue-on-error: true
run: |
./mvnw \
--batch-mode \
--no-transfer-progress \
--threads 1.5C \
--define maven.test.skip=true \
--define maven.javadoc.skip=true \
Expand All @@ -153,16 +157,16 @@ jobs:
native-image-job-reports: 'true'
- name: Native Tests in Modules
id: intTest
continue-on-error: true
run: |
MODULE_UNDER_TEST="${{ matrix.it }}" ./.github/workflows/scripts/native-image-tests.sh
- name: Aggregate Report
run: |
./mvnw \
--batch-mode \
--no-transfer-progress \
--define aggregate=true \
--activate-profiles spring-native,\!default \
surefire-report:report-only
surefire-report:report-only
- name: Archive logs
if: always()
continue-on-error: true
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/generateAutoConfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jobs:
set -e
./mvnw \
--batch-mode \
--no-transfer-progress \
--show-version \
--threads 1.5C \
--define maven.test.skip=true \
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/integrationTests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,21 @@ jobs:
run: ./mvnw dependency:go-offline -ntp -B -T 1.5C
- name: Mvn install # Need this when the directory/pom structure changes
id: install
continue-on-error: true
run: |
./mvnw \
--batch-mode \
--no-transfer-progress \
--threads 1.5C \
--define maven.test.skip=true \
--define maven.javadoc.skip=true \
install
# Unlike for the other integrationTest job, we don't block here as these run in parallel.
- name: Integration Tests
id: intTest
continue-on-error: true
run: |
./mvnw \
--batch-mode \
--no-transfer-progress \
--activate-profiles spring-cloud-gcp-ci-it \
--define maven.javadoc.skip=true \
--define skip.surefire.tests=true \
Expand Down Expand Up @@ -146,10 +146,10 @@ jobs:
run: ./mvnw dependency:go-offline -ntp -B -T 1.5C
- name: Mvn install # Need this when the directory/pom structure changes
id: install
continue-on-error: true
run: |
./mvnw \
--batch-mode \
--no-transfer-progress \
--threads 1.5C \
--define maven.test.skip=true \
--define maven.javadoc.skip=true \
Expand All @@ -163,10 +163,10 @@ jobs:
same-branch-only: false
- name: Integration Tests
id: intTest
continue-on-error: true
run: |
./mvnw \
--batch-mode \
--no-transfer-progress \
--activate-profiles spring-cloud-gcp-ci-it \
--define maven.javadoc.skip=true \
--define skip.surefire.tests=true \
Expand All @@ -180,6 +180,7 @@ jobs:
run: |
./mvnw \
--batch-mode \
--no-transfer-progress \
--define aggregate=true \
surefire-report:failsafe-report-only
- name: Archive logs
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/linkageCheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
run: |
./mvnw \
--batch-mode \
--no-transfer-progress \
--show-version \
--threads 1.5C \
--define skipTests=true \
Expand All @@ -51,6 +52,7 @@ jobs:
--activate-profiles linkage-check \
--projects spring-cloud-gcp-dependencies \
--batch-mode \
--no-transfer-progress \
--show-version \
--threads 1.5C \
--define skipTests=true \
Expand Down
62 changes: 52 additions & 10 deletions .github/workflows/scripts/native-image-tests.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,68 @@
#!/bin/bash

# This script executes native image tests based on the MODULE_UNDER_TEST provided.
# If MODULE_UNDER_TEST is 'vision', for example, then it runs tests under spring-cloud-gcp-vision.
# If it is 'vision-sample' then it runs tests under spring-cloud-gcp-samples/spring-cloud-gcp-vision-api-sample
# and spring-cloud-gcp-samples/spring-cloud-gcp-vision-ocr-demo.

set -eo pipefail

# Get git repo root
scriptDir=$(realpath "$(dirname "${BASH_SOURCE[0]}")")
cd "${scriptDir}/../../.."

OLD_IFS="$IFS"
IFS='-' read -ra MATRIX_SUBSTRINGS <<< "$MODULE_UNDER_TEST"
IFS="$OLD_IFS"

is_desired_directory() {
local directory="$1"

# Exclude Spring Integration, Config Bus, Cloud Stream samples when testing with pubsub-sample
if [ "$MODULE_UNDER_TEST" == "pubsub-sample" ] && [[ "$directory" =~ "integration" || "$directory" =~ "stream" || "$directory" =~ "bus" ]] ; then
return 1
fi

for substring in "${MATRIX_SUBSTRINGS[@]}"; do
if [[ ! "$directory" =~ $substring ]]; then
return 1
fi
done
return 0
}

run_sample_tests () {
# module_name: only cut the last word after "-"
module_name=$(echo "$MODULE_UNDER_TEST" | rev | cut -d '-' -f2- |rev)
directory_names=$(ls 'spring-cloud-gcp-samples')
pushd spring-cloud-gcp-samples
directory_names=$(find -maxdepth 2 -type d -name 'spring-cloud-gcp-*' | sed 's/.\///')
module_samples=()
for dir in $directory_names; do
if [[ $dir =~ $module_name ]]; then
module_samples+=("spring-cloud-gcp-samples/$dir")
if is_desired_directory "$dir"; then
module_samples+=("$dir")
fi
done
project_names="$(echo "${module_samples[@]}" | sed 's/ /,/g')"
mvn clean --activate-profiles native-sample-config,nativeTest --define notAllModules=true --define maven.javadoc.skip=true -pl="${project_names}" test

# The spring-cloud-gcp-pubsub-stream-functional-sample-test needs the process-aot step to explicitly be triggered
# before native image tests. The module's application class is not tested through the SpringBootTest annotation
# so it doesn't get automatically detected by the Spring AOT processor (See https://github.com/spring-projects/spring-boot/issues/35626)
if [[ ${module_samples[*]} =~ "spring-cloud-gcp-pubsub-stream-functional-sample" ]]; then
functional_test_directory_names=$(find -maxdepth 2 -type d -name 'spring-cloud-gcp-pubsub-stream-functional-*' | sed 's/\.\///')
filtered_modules=()
for sample in "${module_samples[@]}"; do
if [[ ! $functional_test_directory_names =~ $sample ]]; then
filtered_modules+=("$sample")
fi
done
pushd spring-cloud-gcp-pubsub-stream-functional-sample/spring-cloud-gcp-pubsub-stream-functional-sample-test
mvn package -Pnative -Pnative-sample-config -DskipTests
mvn -Pnative-sample-config -PnativeTest --define notAllModules=true --define maven.javadoc.skip=true test
popd
filtered_project_names="$(echo "${filtered_modules[@]}" | sed 's/ /,/g')"
mvn clean --activate-profiles native-sample-config,nativeTest --define notAllModules=true --define maven.javadoc.skip=true -pl="${filtered_project_names}" test

else
project_names="$(echo "${module_samples[@]}" | sed 's/ /,/g')"
mvn clean --activate-profiles native-sample-config,nativeTest --define notAllModules=true --define maven.javadoc.skip=true -pl="${project_names}" test
fi
popd
}

run_module_tests() {
Expand All @@ -35,6 +77,7 @@ run_module_tests() {
mvn clean verify -Pspring-native,!default -pl="${project_names}"
}


if [ -z "$MODULE_UNDER_TEST" ]; then
echo "Please specify the MODULE_UNDER_TEST."
exit 1
Expand All @@ -44,5 +87,4 @@ if [[ "$MODULE_UNDER_TEST" == *"sample" ]]; then
run_sample_tests
else
run_module_tests
fi

fi
1 change: 1 addition & 0 deletions .github/workflows/showcaseTests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
run: |
./mvnw \
--batch-mode \
--no-transfer-progress \
--show-version \
--threads 1.5C \
--define maven.test.skip=true \
Expand Down
32 changes: 4 additions & 28 deletions .github/workflows/sonar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,48 +43,24 @@ jobs:
if: steps.mvn-cache.outputs.cache-hit != 'true'
run: ./mvnw dependency:go-offline -ntp -B -T 1.5C
- name: Mvn install w/ coverage # Need this when the directory/pom structure changes
id: install1
continue-on-error: true
run: |
./mvnw \
--batch-mode \
--show-version \
--threads 1.5C \
--activate-profiles codecov \
clean \
install
- name: Retry Install on Failure
id: install2
if: steps.install1.outcome == 'failure'
id: install
run: |
./mvnw \
--batch-mode \
--no-transfer-progress \
--show-version \
--threads 1.5C \
--activate-profiles codecov \
clean \
install
- name: Build and analyze
id: sonar1
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
run: |
./mvnw \
--batch-mode \
--activate-profiles codecov \
--define sonar.projectKey=GoogleCloudPlatform_spring-cloud-gcp \
--define sonar.host.url=https://sonarcloud.io \
--define sonar.organization=googlecloudplatform \
org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
- name: Retry Sonar on Failure
id: sonar2
if: steps.sonar1.outcome == 'failure'
id: sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
run: |
./mvnw \
--batch-mode \
--no-transfer-progress \
--activate-profiles codecov \
--define sonar.projectKey=GoogleCloudPlatform_spring-cloud-gcp \
--define sonar.host.url=https://sonarcloud.io \
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/unitTests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ jobs:
run: |
./mvnw \
--batch-mode \
--no-transfer-progress \
-Drelease=true \
-DskipTests \
-Dgpg.skip \
Expand All @@ -133,6 +134,7 @@ jobs:
run: |
./mvnw \
--batch-mode \
--no-transfer-progress \
--activate-profiles docs,spring \
-DskipTests \
-Dgpg.skip \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/updateDocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
run: |
./mvnw \
--batch-mode \
--no-transfer-progress \
--show-version \
--threads 1.5C \
--define maven.test.skip=true \
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@
<!-- Plugin versions -->
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
<maven-failsafe-plugin.version>3.1.2</maven-failsafe-plugin.version>
<maven-failsafe-plugin.version>3.2.1</maven-failsafe-plugin.version>
<maven-flatten-plugin.version>1.5.0</maven-flatten-plugin.version>
<maven-gpg-plugin.version>3.1.0</maven-gpg-plugin.version>
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
<maven-javadoc-plugin.version>3.6.0</maven-javadoc-plugin.version>
<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
<maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
<maven-surefire-plugin.version>3.2.1</maven-surefire-plugin.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<nexus-staging-plugin.version>1.6.13</nexus-staging-plugin.version>
<maven-checkstyle-plugin.version>3.3.0</maven-checkstyle-plugin.version>
<maven-checkstyle-plugin.version>3.3.1</maven-checkstyle-plugin.version>
<checkstyle-rules.version>9.3</checkstyle-rules.version>
<asciidoctor-maven-plugin.version>2.0.0</asciidoctor-maven-plugin.version>
<errorprone.version>2.23.0</errorprone.version>
<native-maven-plugin.version>0.9.27</native-maven-plugin.version>
<native-maven-plugin.version>0.9.28</native-maven-plugin.version>

<!-- All checks except for javadoc enforced by default -->
<skip.failsafe.tests>${skipTests}</skip.failsafe.tests>
Expand Down
2 changes: 1 addition & 1 deletion spring-cloud-gcp-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.14.0</version>
<version>2.15.0</version>
<scope>test</scope>
</dependency>

Expand Down
Loading

0 comments on commit 654c1ca

Please sign in to comment.