-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: set up kokoro job for sdk schema test
PiperOrigin-RevId: 662674058
- Loading branch information
1 parent
3b6aa54
commit b27fcca
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Download resources for system tests (service account key, etc.) | ||
env_vars: { | ||
key: "TRAMPOLINE_BUILD_FILE" | ||
value: "github/nodejs-vertexai/.kokoro/sdk-schema-test.sh" | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2024 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 | ||
# | ||
# https://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. | ||
|
||
set -e | ||
|
||
export TEST_REPO=nodejs-vertexai | ||
CURRENT_VERSION=$(node -v 2>/dev/null || echo "none") | ||
REQUIRED_VERSION="v18.0.0" | ||
|
||
install_node() { | ||
echo "Installing Node.js via NodeSource..." | ||
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - | ||
sudo apt-get install -y nodejs | ||
} | ||
|
||
compare_versions() { | ||
[ "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" != "$1" ] | ||
} | ||
|
||
if [ "$CURRENT_VERSION" = "none" ]; then | ||
echo "Node.js is not installed. Installing Node.js..." | ||
install_node | ||
else | ||
echo "Current Node.js version: $CURRENT_VERSION" | ||
|
||
if compare_versions "$CURRENT_VERSION" "$REQUIRED_VERSION"; then | ||
echo "Node.js version is greater than or equal to $REQUIRED_VERSION" | ||
else | ||
echo "Node.js version is less than $REQUIRED_VERSION. Installing the required version..." | ||
install_node | ||
fi | ||
fi | ||
|
||
echo "Node.js installation or upgrade process completed." | ||
|
||
npm install | ||
git clone https://github.com/google-gemini/generative-ai-js.git | ||
sudo npm install -g ts-node && sudo npm install -g typescript | ||
ts-node sdk_schema_test/vertex_ai/*test.ts | ||
ts-node sdk_schema_test/google_ai/*test.ts | ||
rm -rf generative-ai-js | ||
rm -rf build | ||
rm -rf node_modules | ||
find . -type f -name "*.js" ! -path "./test/spec/*" ! -name ".*.js" -exec rm {} \; | ||
rm package-lock.json |