Skip to content
Draft
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
36 changes: 36 additions & 0 deletions .github/workflows/spanner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2022 Google LLC
#
# Licensed 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.
# Github action job to test core java library features on
# downstream client libraries before they are released.
on:
push:
branches:
- main
pull_request:
name: spanner
jobs:
units:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java: [21]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: ${{matrix.java}}
- run: java -version
- run: tests/spanner/test-spanner.sh
Comment on lines +24 to +36

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
38 changes: 38 additions & 0 deletions tests/spanner/test-spanner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
set -e

SPANNER_VERSION=$(awk '/<artifactId>google-cloud-spanner-bom<\/artifactId>/{f=1;next} /<version>/{if(f){print;exit}}' google-cloud-bom/pom.xml | sed -n 's/.*<version>\(.*\)<\/version>.*/\1/p')
FIRST_PARTY_DEPENDENCIES_VERSION=$(awk '/<artifactId>first-party-dependencies<\/artifactId>/{f=1;next} /<version>/{if(f){print;exit}}' libraries-bom/pom.xml | sed -n 's/.*<version>\(.*\)<\/version>.*/\1/p')

echo "google-cloud-spanner-bom version: $SPANNER_VERSION"
echo "first-party-dependencies version: $FIRST_PARTY_DEPENDENCIES_VERSION"

# Download spanner source code
rm -rf java-spanner
git clone --depth 1 --branch v${SPANNER_VERSION} -c advice.detachedHead=false https://github.com/googleapis/java-spanner.git

# Update the version of sdk-platform-java-config in all pom.xml files
for pom_file in $(find java-spanner -name "pom.xml"); do
if grep -q "<artifactId>sdk-platform-java-config</artifactId>" "$pom_file"; then
awk -v version="${FIRST_PARTY_DEPENDENCIES_VERSION}" '
/<artifactId>sdk-platform-java-config<\/artifactId>/ {
print
getline # Read the next line (which should be the version)
print " <version>" version "</version>"
next
}
{ print }
' "$pom_file" > "$pom_file.tmp" && mv "$pom_file.tmp" "$pom_file"
echo "Updated: $pom_file"
fi
done

# Show the diffs
echo "Changes after version updates:"
(cd java-spanner && git add .)
(cd java-spanner && git --no-pager diff --staged)

# Clean up backup files
find java-spanner -name "pom.xml.bak" -delete

(cd java-spanner && JOB_TYPE=test .kokoro/build.sh)
Loading