diff --git a/.github/workflows/verify_library_generation.yaml b/.github/workflows/verify_library_generation.yaml index dabf01a458..ae32b9eced 100644 --- a/.github/workflows/verify_library_generation.yaml +++ b/.github/workflows/verify_library_generation.yaml @@ -28,8 +28,7 @@ jobs: library_generation/test/generate_library_integration_test.sh \ -p google/bigtable/v2 \ -d google-cloud-bigtable-v2-java \ - --googleapis_gen_url https://cloud-java-bot:${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }}@github.com/googleapis/googleapis-gen.git \ - --os_type ${{ matrix.os }} + --googleapis_gen_url https://cloud-java-bot:${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }}@github.com/googleapis/googleapis-gen.git unit_tests: strategy: matrix: diff --git a/library_generation/generate_library.sh b/library_generation/generate_library.sh index e20d9f1856..8355b4a6a5 100755 --- a/library_generation/generate_library.sh +++ b/library_generation/generate_library.sh @@ -78,7 +78,7 @@ if [ -z "${include_samples}" ]; then fi if [ -z "${os_architecture}" ]; then - os_architecture="linux-x86_64" + os_architecture=$(detect_os_architecture) fi mkdir -p "${destination_path}" diff --git a/library_generation/test/generate_library_integration_test.sh b/library_generation/test/generate_library_integration_test.sh index 1c437d328a..fa1585346e 100755 --- a/library_generation/test/generate_library_integration_test.sh +++ b/library_generation/test/generate_library_integration_test.sh @@ -30,10 +30,6 @@ case $key in googleapis_gen_url="$2" shift ;; - --os_type) - os_type="$2" - shift - ;; *) echo "Invalid option: [$1]" exit 1 @@ -78,11 +74,6 @@ include_samples=$(get_config_from_BUILD \ "false" ) echo "GAPIC options are transport=${transport}, rest_numeric_enums=${rest_numeric_enums}, include_samples=${include_samples}." -os_architecture="linux-x86_64" -if [[ "$os_type" == *"macos"* ]]; then - os_architecture="osx-x86_64" -fi -echo "OS Architecture is ${os_architecture}." # generate GAPIC client library echo "Generating library from ${proto_path}, to ${destination_path}..." "${library_generation_dir}"/generate_library.sh \ @@ -93,8 +84,7 @@ echo "Generating library from ${proto_path}, to ${destination_path}..." --grpc_version "${grpc_version}" \ --transport "${transport}" \ --rest_numeric_enums "${rest_numeric_enums}" \ ---include_samples "${include_samples}" \ ---os_architecture "${os_architecture}" +--include_samples "${include_samples}" echo "Generate library finished." echo "Checking out googleapis-gen repository..." diff --git a/library_generation/utilities.sh b/library_generation/utilities.sh index 70dccc6c6c..d7647f217a 100755 --- a/library_generation/utilities.sh +++ b/library_generation/utilities.sh @@ -273,3 +273,21 @@ get_version_from_versions_txt() { version=$(grep "$key:" "${versions}" | cut -d: -f3) # 3rd field is snapshot echo "${version}" } + +detect_os_architecture() { + local os_type + local os_architecture + os_type=$(uname -sm) + case "${os_type}" in + *"Linux x86_64"*) + os_architecture="linux-x86_64" + ;; + *"Darwin x86_64"*) + os_architecture="osx-x86_64" + ;; + *) + os_architecture="osx-aarch_64" + ;; + esac + echo "${os_architecture}" +}