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
27 changes: 23 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ jobs:
echo "git rev-parse origin/$MAIN_BRANCH: $(git rev-parse origin/$MAIN_BRANCH)"
echo "git rev-parse HEAD: $(git rev-parse HEAD)"
echo "github.ref_type: ${{ github.ref_type }}"
echo "isReleaseTag=$(if [ "$(git rev-parse origin/$MAIN_BRANCH)" == "$(git rev-parse HEAD)" ] && ${{ github.ref_type == 'tag' }}; then echo 1; else echo 0; fi)" >> "$GITHUB_OUTPUT"
echo "isReleaseTag=$(if [ "$(git rev-parse origin/$MAIN_BRANCH)" == "$(git rev-parse HEAD)" ] && ${{ github.ref_type == 'tag' }}; then echo 1; else echo 0; fi)"
echo "isReleaseTag=$(if ${{ github.ref_type == 'tag' }}; then echo 1; else echo 0; fi)" >> "$GITHUB_OUTPUT"
echo "isReleaseTag=$(if ${{ github.ref_type == 'tag' }}; then echo 1; else echo 0; fi)"
-
name: Configure AWS Credentials
id: creds
Expand Down Expand Up @@ -195,9 +195,28 @@ jobs:
- uses: webfactory/ssh-agent@fc49353b67b2b7c1e0e6a600572d01a69f2672dd
with:
ssh-private-key: ${{ secrets[matrix.sshKey] }}

- name: Split monorepo
run: |
set -euxo pipefail

ssh-add -l
docker build -t monorepo-tools ./bin
docker run -v $PWD:/monorepo -w /monorepo -v $SSH_AUTH_SOCK:/ssh-agent -v ~/.ssh/known_hosts:/root/.ssh/known_hosts -e SSH_AUTH_SOCK=/ssh-agent monorepo-tools bin/split-repo.sh . ${{ matrix.repo }} ${{ matrix.path }} ${{ matrix.name }}/ ${{ matrix.lastTag}}

# Resolve absolute paths on the host
WORKTREE="$PWD"
GITDIR="$(git rev-parse --git-dir)"
[[ "${GITDIR}" != /* ]] && GITDIR="$WORKTREE/${GITDIR}"

echo "WORKTREE=${WORKTREE}"
echo "GITDIR=${GITDIR}"

# Run with identical absolute paths inside the container
docker run --rm \
-v "${WORKTREE}:${WORKTREE}" \
-v "${GITDIR}:${GITDIR}" \
-w "${WORKTREE}" \
-v "$SSH_AUTH_SOCK:/ssh-agent" \
-v "$HOME/.ssh/known_hosts:/root/.ssh/known_hosts" \
-e SSH_AUTH_SOCK=/ssh-agent \
monorepo-tools \
bin/split-repo.sh . "${{ matrix.repo }}" "${{ matrix.path }}" "${{ matrix.name }}/" "${{ matrix.lastTag }}"
9 changes: 5 additions & 4 deletions bin/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
FROM debian:11
FROM debian:12

RUN echo "deb http://deb.debian.org/debian bullseye-backports main contrib non-free" >> /etc/apt/sources.list \
&& echo "deb-src http://deb.debian.org/debian bullseye-backports main contrib non-free" >> /etc/apt/sources.list \
RUN echo "deb http://deb.debian.org/debian bookworm-backports main contrib non-free" >> /etc/apt/sources.list \
&& echo "deb-src http://deb.debian.org/debian bookworm-backports main contrib non-free" >> /etc/apt/sources.list \
&& apt-get update -yq \
&& apt-get install -yqq \
git \
git-filter-repo \
vim \
openssh-client \
python3-pip \
python3-packaging \
&& mkdir -p ~/.ssh || true \
&& chmod 700 ~/.ssh/ \
&& ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts \
&& pip install packaging
&& git config --system --add safe.directory '*'
17 changes: 12 additions & 5 deletions bin/split-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,19 @@ LIB_PATH="${3}"
TAG_PREFIX="${4}"
LAST_TAG_IN_SINGLEREPO="${5}"

# We require the source to be a local path because we use --mirror flag. The --mirror flag is needed on the other hand
# to copy all refs when doing a local clone.
if [[ ! -d "${SOURCE_REPO_PATH}/.git" ]]; then
echo ">> Splitting repo"
echo "Source repo: ${SOURCE_REPO_PATH}"
echo "Target repo: ${TARGET_REPO_URL}"
echo "Library path: ${LIB_PATH}"
echo "Tag prefix: ${TAG_PREFIX}"
echo "Last tag in singlerepo: ${LAST_TAG_IN_SINGLEREPO}"

if ! git -C "${SOURCE_REPO_PATH}" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "Source repo '${SOURCE_REPO_PATH}' is not a valid GIT repository"
exit 1
fi
echo "Work tree: $(git -C "${SOURCE_REPO_PATH}" rev-parse --show-toplevel || true)"
echo "Git dir: $(git -C "${SOURCE_REPO_PATH}" rev-parse --git-dir || true)"

TMP_DIR=`mktemp -d`
WORK_DIR=`pwd`
Expand All @@ -37,8 +44,8 @@ clean_up () {
trap clean_up EXIT

echo ">> Cloning source repo '${SOURCE_REPO_PATH}'"
git clone --no-local --mirror "${SOURCE_REPO_PATH}" $TMP_DIR
cd $TMP_DIR
REAL_GIT_DIR="$(git -C "${SOURCE_REPO_PATH}" rev-parse --git-dir)"
git clone --no-local --mirror "${REAL_GIT_DIR}" "$TMP_DIR"

echo ">> Rebuild repo"
LIB_PATH="${LIB_PATH%/}/" # ensure trailing slash
Expand Down
3 changes: 2 additions & 1 deletion packages/php-datatypes/src/Definition/Snowflake.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ class Snowflake extends Common
self::TYPE_GEOMETRY,
self::TYPE_VECTOR,
];
public const MAX_VARCHAR_LENGTH = 16777216;
public const DEFAULT_VARCHAR_LENGTH = 16777216;
public const MAX_VARCHAR_LENGTH = 134217728;
public const MAX_VARBINARY_LENGTH = 8388608;

/**
Expand Down
6 changes: 3 additions & 3 deletions packages/php-datatypes/tests/SnowflakeDatatypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,10 @@ public function testValidCharacterLengths(): void
new Snowflake('STRING');
new Snowflake('STRING', ['length' => '']);
new Snowflake('STRING', ['length' => '1']);
new Snowflake('STRING', ['length' => '16777216']);
new Snowflake('STRING', ['length' => '134217728']);
new Snowflake('STRING', [
'length' => [
'character_maximum' => '16777216',
'character_maximum' => '134217728',
],
]);
new Snowflake('STRING', [
Expand Down Expand Up @@ -343,7 +343,7 @@ public function invalidCharacterLengths(): array
return [
['a'],
['0'],
['16777217'],
['134217729'],
['-1'],
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private static function createNvarcharColumn(string $columnName): SnowflakeColum
new Snowflake(
Snowflake::TYPE_VARCHAR,
[
'length' => (string) Snowflake::MAX_VARCHAR_LENGTH,
'length' => (string) Snowflake::DEFAULT_VARCHAR_LENGTH,
'nullable' => true, // set all columns to be nullable
],
),
Expand Down