Skip to content
Merged
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
11 changes: 11 additions & 0 deletions .github/workflows/dataconnect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,23 @@
with:
args: -color /github/workspace/.github/workflows/dataconnect.yml

shellcheck:
continue-on-error: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
show-progress: false
sparse-checkout: 'firebase-dataconnect/'
- name: shellcheck
run: find . -name '*.sh' -print0 | xargs --verbose -0 shellcheck --norc --enable=all --shell=bash

python-ci-unit-tests:
continue-on-error: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:

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}
show-progress: false
sparse-checkout: 'firebase-dataconnect/ci/'
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
Expand Down
15 changes: 8 additions & 7 deletions firebase-dataconnect/emulator/emulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

set -euo pipefail

readonly SCRIPT_DIR="$(dirname "$0")"
SCRIPT_DIR="$(dirname "$0")"
readonly SCRIPT_DIR
readonly SELF_EXECUTABLE="$0"
readonly LOG_PREFIX="[$0] "
readonly DEFAULT_POSTGRESQL_STRING='postgresql://postgres:postgres@localhost:5432?sslmode=disable'
Expand All @@ -38,7 +39,7 @@ function parse_args {
local OPTIND=1
local OPTERR=0
while getopts ":c:p:v:hwg" arg ; do
case "$arg" in
case "${arg}" in
c) emulator_binary="${OPTARG}" ;;
g) emulator_binary="gradle" ;;
p) postgresql_string="${OPTARG}" ;;
Expand All @@ -59,21 +60,21 @@ function parse_args {
exit 2
;;
*)
log_error_and_exit "INTERNAL ERROR: unknown argument: $arg"
log_error_and_exit "INTERNAL ERROR: unknown argument: ${arg}"
;;
esac
done

if [[ $emulator_binary != "gradle" ]] ; then
if [[ ${emulator_binary} != "gradle" ]] ; then
export DATACONNECT_EMULATOR_BINARY_PATH="${emulator_binary}"
else
run_command "${SCRIPT_DIR}/../../gradlew" -p "${SCRIPT_DIR}/../.." --configure-on-demand :firebase-dataconnect:connectors:downloadDebugDataConnectExecutable
local gradle_emulator_binaries=("${SCRIPT_DIR}"/../connectors/build/intermediates/dataconnect/debug/executable/*)
if [[ ${#gradle_emulator_binaries[@]} -ne 1 ]]; then
log_error_and_exit "expected exactly 1 emulator binary from gradle, but got ${#gradle_emulator_binaries[@]}: ${gradle_emulator_binaries[*]}"
fi
local gradle_emulator_binary="${gradle_emulator_binaries[@]}"
if [[ ! -e $gradle_emulator_binary ]] ; then
local gradle_emulator_binary="${gradle_emulator_binaries[0]}"
if [[ ! -e ${gradle_emulator_binary} ]] ; then
log_error_and_exit "emulator binary from gradle does not exist: ${gradle_emulator_binary}"
fi
export DATACONNECT_EMULATOR_BINARY_PATH="${gradle_emulator_binary}"
Expand All @@ -82,7 +83,7 @@ function parse_args {
export FIREBASE_DATACONNECT_POSTGRESQL_STRING="${postgresql_string}"
export DATA_CONNECT_PREVIEW="${preview_flags}"

if [[ $wipe_and_restart_postgres_pod == "1" ]] ; then
if [[ ${wipe_and_restart_postgres_pod} == "1" ]] ; then
run_command "${SCRIPT_DIR}/wipe_postgres_db.sh"
run_command "${SCRIPT_DIR}/start_postgres_pod.sh"
fi
Expand Down
5 changes: 3 additions & 2 deletions firebase-dataconnect/emulator/start_postgres_pod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ function run_command {
"$@"
}

# Determine the absolute path of the directory containing this file.
readonly SCRIPT_DIR="$(readlink -f $(dirname "$0"))"
# Determine the path of the directory containing this file.
SCRIPT_DIR="$(dirname "$0")"
readonly SCRIPT_DIR

# Create the podman "pod" if it is not already created.
# Bind the PostgreSQL server to port 5432 on the host, so that the host can connect to it.
Expand Down
3 changes: 2 additions & 1 deletion firebase-dataconnect/scripts/compile_kotlin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

set -euo pipefail

readonly PROJECT_ROOT_DIR="$(dirname "$0")/../.."
PROJECT_ROOT_DIR="$(dirname "$0")/../.."
readonly PROJECT_ROOT_DIR

readonly TARGETS=(
":firebase-dataconnect:compileDebugKotlin"
Expand Down
3 changes: 2 additions & 1 deletion firebase-dataconnect/scripts/emulator_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

set -euo pipefail

readonly PROJECT_ROOT_DIR="$(dirname "$0")/../.."
PROJECT_ROOT_DIR="$(dirname "$0")/../.."
readonly PROJECT_ROOT_DIR

(
set -xv
Expand Down
3 changes: 2 additions & 1 deletion firebase-dataconnect/scripts/generateApiTxtFile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

set -euo pipefail

readonly PROJECT_ROOT_DIR="$(dirname "$0")/../.."
PROJECT_ROOT_DIR="$(dirname "$0")/../.."
readonly PROJECT_ROOT_DIR

readonly args=(
"${PROJECT_ROOT_DIR}/gradlew"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

set -euo pipefail

readonly PROJECT_ROOT_DIR="$(dirname "$0")/../.."
PROJECT_ROOT_DIR="$(dirname "$0")/../.."
readonly PROJECT_ROOT_DIR

readonly TARGETS=(
":firebase-dataconnect:connectors:generateDebugDataConnectSources"
Expand Down
3 changes: 2 additions & 1 deletion firebase-dataconnect/scripts/run_all_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

set -euo pipefail

readonly PROJECT_ROOT_DIR="$(dirname "$0")/../.."
PROJECT_ROOT_DIR="$(dirname "$0")/../.."
readonly PROJECT_ROOT_DIR

readonly TARGETS=(
":firebase-dataconnect:androidTestutil:connectedDebugAndroidTest"
Expand Down
3 changes: 2 additions & 1 deletion firebase-dataconnect/scripts/run_integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

set -euo pipefail

readonly PROJECT_ROOT_DIR="$(dirname "$0")/../.."
PROJECT_ROOT_DIR="$(dirname "$0")/../.."
readonly PROJECT_ROOT_DIR

readonly TARGETS=(
":firebase-dataconnect:connectedDebugAndroidTest"
Expand Down
3 changes: 2 additions & 1 deletion firebase-dataconnect/scripts/run_unit_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

set -euo pipefail

readonly PROJECT_ROOT_DIR="$(dirname "$0")/../.."
PROJECT_ROOT_DIR="$(dirname "$0")/../.."
readonly PROJECT_ROOT_DIR

readonly TARGETS=(
":firebase-dataconnect:testDebugUnitTest"
Expand Down
36 changes: 36 additions & 0 deletions firebase-dataconnect/scripts/shellcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Copyright 2025 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.

set -euo pipefail

DATACONNECT_ROOT_DIR="$(dirname "$0")/.."
readonly DATACONNECT_ROOT_DIR

sh_files=(
"${DATACONNECT_ROOT_DIR}"/emulator/*.sh
"${DATACONNECT_ROOT_DIR}"/scripts/*.sh
)

readonly args=(
shellcheck
--norc
--enable=all
--shell=bash
"${sh_files[@]}"
)

echo "${args[*]}"
exec "${args[@]}"
3 changes: 2 additions & 1 deletion firebase-dataconnect/scripts/spotlessApply.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

set -euo pipefail

readonly PROJECT_ROOT_DIR="$(dirname "$0")/../.."
PROJECT_ROOT_DIR="$(dirname "$0")/../.."
readonly PROJECT_ROOT_DIR

readonly TARGETS=(
":firebase-dataconnect:spotlessApply"
Expand Down
Loading