Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,51 @@ jobs:
env:
JOB_TYPE: test
JOB_NAME: units-${{matrix.java}}
# detect which libraries have changed
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
packages: ${{ steps.filter.outputs.changes }}
steps:
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
java-bigquery: java-bigquery/**
java-bigquerystorage: java-bigquerystorage/**
java-datastore: java-datastore/**
java-logging: java-logging/**
java-logging-logback: java-logging-logback/**
split-units:
runs-on: ubuntu-latest
needs: changes
strategy:
fail-fast: false
matrix:
java: [11, 17, 21, 25]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about Java 8?

package: ${{ fromJSON(needs.changes.outputs.packages) }}
steps:
- name: Get current week within the year
id: date
run: echo "::set-output name=week_of_year::$(date +'%W' --utc)"
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{matrix.java}}
- run: java -version
- uses: actions/cache@v4
id: mvn-cache
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-unified-${{ steps.date.outputs.week_of_year }}
- run: .kokoro/build.sh
env:
BUILD_SUBDIR: ${{matrix.package}}
JOB_TYPE: test
JOB_NAME: units-${{matrix.package}}-${{matrix.java}}
windows:
runs-on: windows-latest
steps:
Expand Down
5 changes: 4 additions & 1 deletion .kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ case ${JOB_TYPE} in
install_modules "${BUILD_SUBDIR}"
echo "Running in subdir: ${BUILD_SUBDIR}"
pushd "${BUILD_SUBDIR}"
EXTRA_PROFILE_OPT=""
else
EXTRA_PROFILE_OPT="-PbulkTests"
Comment on lines +46 to +48
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To handle optional arguments more robustly in bash, it's better to use an array. This avoids potential word-splitting issues. This converts EXTRA_PROFILE_OPT to an array EXTRA_PROFILE_OPTS; a corresponding change will be needed where it's used (see my other comment).

Suggested change
EXTRA_PROFILE_OPT=""
else
EXTRA_PROFILE_OPT="-PbulkTests"
EXTRA_PROFILE_OPTS=()
else
EXTRA_PROFILE_OPTS=("-PbulkTests")

fi
echo "SUREFIRE_JVM_OPT: ${SUREFIRE_JVM_OPT}"
retry_with_backoff 3 10 \
Expand All @@ -56,7 +59,7 @@ case ${JOB_TYPE} in
-Dflatten.skip=true \
-Danimal.sniffer.skip=true \
-Dmaven.wagon.http.retryHandler.count=5 \
-T 1C ${SUREFIRE_JVM_OPT}
-T 1C ${SUREFIRE_JVM_OPT} ${EXTRA_PROFILE_OPT}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To correctly expand the EXTRA_PROFILE_OPTS array, use "${EXTRA_PROFILE_OPTS[@]}". This syntax safely handles both empty and non-empty arrays, preventing issues with word splitting and ensuring arguments are passed correctly.

Suggested change
-T 1C ${SUREFIRE_JVM_OPT} ${EXTRA_PROFILE_OPT}
-T 1C ${SUREFIRE_JVM_OPT} "${EXTRA_PROFILE_OPTS[@]}"

RETURN_CODE=$?

if [[ -n "${BUILD_SUBDIR}" ]]
Expand Down
7 changes: 7 additions & 0 deletions java-bigquery/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,12 @@
<module>benchmark</module>
</modules>
</profile>
<!-- skip tests if bulkTests profile is enabled (when testing the rest of the monorepo) -->
<profile>
<id>bulkTests</id>
<properties>
<skipTests>true</skipTests>
</properties>
</profile>
</profiles>
</project>
12 changes: 11 additions & 1 deletion java-bigquerystorage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,14 @@
<module>google-cloud-bigquerystorage-bom</module>
</modules>

</project>
<profiles>
<!-- skip tests if bulkTests profile is enabled (when testing the rest of the monorepo) -->
<profile>
<id>bulkTests</id>
<properties>
<skipTests>true</skipTests>
</properties>
</profile>
</profiles>

</project>
11 changes: 10 additions & 1 deletion java-datastore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,13 @@
<module>google-cloud-datastore-utils</module>
</modules>

</project>
<profiles>
<!-- skip tests if bulkTests profile is enabled (when testing the rest of the monorepo) -->
<profile>
<id>bulkTests</id>
<properties>
<skipTests>true</skipTests>
</properties>
</profile>
</profiles>
</project>
7 changes: 7 additions & 0 deletions java-logging-logback/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -168,5 +168,12 @@
<test>!LoggingAppenderTest</test>
</properties>
</profile>
<!-- skip tests if bulkTests profile is enabled (when testing the rest of the monorepo) -->
<profile>
<id>bulkTests</id>
<properties>
<skipTests>true</skipTests>
</properties>
</profile>
</profiles>
</project>
11 changes: 10 additions & 1 deletion java-logging/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,13 @@
<module>google-cloud-logging-bom</module>
</modules>

</project>
<profiles>
<!-- skip tests if bulkTests profile is enabled (when testing the rest of the monorepo) -->
<profile>
<id>bulkTests</id>
<properties>
<skipTests>true</skipTests>
</properties>
</profile>
</profiles>
</project>
Loading