Skip to content

Commit

Permalink
Merge branch 'postgresql-dialect' into sequelize-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
olavloite committed May 16, 2024
2 parents 0992c00 + d79421d commit 96b06b2
Show file tree
Hide file tree
Showing 117 changed files with 3,238 additions and 1,316 deletions.
116 changes: 0 additions & 116 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,35 +32,6 @@ jobs:
distribution: 'zulu'
- run: java -version
- run: .ci/run-with-credentials.sh lint
e2e-psql-v11-v1:
needs: [check-env]
if: needs.check-env.outputs.has-key == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'zulu'
- run: java -version
- name: "Install postgresql-client-11"
run: |
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-client-11
- id: 'auth'
uses: google-github-actions/auth@v2
with:
credentials_json: '${{ secrets.JSON_SERVICE_ACCOUNT_CREDENTIALS }}'
- id: 'setup-gcloud'
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ env.GOOGLE_CLOUD_PROJECT }}
- name: "Install gcloud alpha component"
run: gcloud components install alpha
- run: .ci/run-with-credentials.sh uber-jar-build
- run: .ci/run-with-credentials.sh e2e-psql 11 1.0
e2e-psql-v11-v14:
needs: [check-env]
if: needs.check-env.outputs.has-key == 'true'
Expand Down Expand Up @@ -90,35 +61,6 @@ jobs:
run: gcloud components install alpha
- run: .ci/run-with-credentials.sh uber-jar-build
- run: .ci/run-with-credentials.sh e2e-psql 11 14.1
e2e-psql-v12-v1:
needs: [check-env]
if: needs.check-env.outputs.has-key == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'zulu'
- run: java -version
- name: "Install postgresql-client-12"
run: |
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-client-12
- id: 'auth'
uses: google-github-actions/auth@v2
with:
credentials_json: '${{ secrets.JSON_SERVICE_ACCOUNT_CREDENTIALS }}'
- id: 'setup-gcloud'
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ env.GOOGLE_CLOUD_PROJECT }}
- name: "Install gcloud alpha component"
run: gcloud components install alpha
- run: .ci/run-with-credentials.sh uber-jar-build
- run: .ci/run-with-credentials.sh e2e-psql 12 1.0
e2e-psql-v12-v1-v14:
needs: [check-env]
if: needs.check-env.outputs.has-key == 'true'
Expand Down Expand Up @@ -148,35 +90,6 @@ jobs:
run: gcloud components install alpha
- run: .ci/run-with-credentials.sh uber-jar-build
- run: .ci/run-with-credentials.sh e2e-psql 12 14.1
e2e-psql-v13-v1:
needs: [check-env]
if: needs.check-env.outputs.has-key == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'zulu'
- run: java -version
- name: "Install postgresql-client-13"
run: |
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-client-13
- id: 'auth'
uses: google-github-actions/auth@v2
with:
credentials_json: '${{ secrets.JSON_SERVICE_ACCOUNT_CREDENTIALS }}'
- id: 'setup-gcloud'
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ env.GOOGLE_CLOUD_PROJECT }}
- name: "Install gcloud alpha component"
run: gcloud components install alpha
- run: .ci/run-with-credentials.sh uber-jar-build
- run: .ci/run-with-credentials.sh e2e-psql 13 1.0
e2e-psql-v13-v14:
needs: [check-env]
if: needs.check-env.outputs.has-key == 'true'
Expand Down Expand Up @@ -206,35 +119,6 @@ jobs:
run: gcloud components install alpha
- run: .ci/run-with-credentials.sh uber-jar-build
- run: .ci/run-with-credentials.sh e2e-psql 13 14.1
e2e-psql-v14-v1:
needs: [check-env]
if: needs.check-env.outputs.has-key == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'zulu'
- run: java -version
- name: "Install postgresql-client-14"
run: |
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-client-14
- id: 'auth'
uses: google-github-actions/auth@v2
with:
credentials_json: '${{ secrets.JSON_SERVICE_ACCOUNT_CREDENTIALS }}'
- id: 'setup-gcloud'
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ env.GOOGLE_CLOUD_PROJECT }}
- name: "Install gcloud alpha component"
run: gcloud components install alpha
- run: .ci/run-with-credentials.sh uber-jar-build
- run: .ci/run-with-credentials.sh e2e-psql 14 1.0
e2e-psql-v14-v14:
needs: [check-env]
if: needs.check-env.outputs.has-key == 'true'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-emulator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
--health-timeout 5s
--health-retries 5
emulator:
image: gcr.io/cloud-spanner-emulator/emulator:latest
image: gcr.io/cloud-spanner-emulator/emulator
ports:
- 9010:9010
- 9020:9020
Expand Down
115 changes: 115 additions & 0 deletions .github/workflows/integration-multiplexed-sessions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
on:
pull_request:
workflow_dispatch:
name: integration-multiplexed-sessions
env:
GOOGLE_CLOUD_PROJECT: "span-cloud-testing"
GOOGLE_CLOUD_INSTANCE: "pgadapter-testing"
GOOGLE_CLOUD_DATABASE: "testdb_integration"
GOOGLE_CLOUD_ENDPOINT: "spanner.googleapis.com"
GOOGLE_CLOUD_SPANNER_ENABLE_MULTIPLEXED_SESSIONS: true
jobs:
check-env:
outputs:
has-key: ${{ steps.project-id.outputs.defined }}
runs-on: ubuntu-latest
steps:
- id: project-id
env:
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
if: "${{ env.GCP_PROJECT_ID != '' }}"
run: echo "defined=true" >> "$GITHUB_OUTPUT"
integration-test:
needs: [check-env]
if: needs.check-env.outputs.has-key == 'true'
timeout-minutes: 60
runs-on: ubuntu-latest
# Add a PostgreSQL Docker container
services:
# Container label
postgres:
image: postgres:14
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
ports:
- 5432:5432
volumes:
- /pg:/var/run/postgresql
- /tmp:/tmp
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
# TODO: Remove
- id: set-test-type-for-float32
run: |
if [[ $GOOGLE_CLOUD_ENDPOINT == 'staging-wrenchworks.sandbox.googleapis.com' ]]; then
echo "FLOAT32_TEST_TYPE=float4" >> $GITHUB_ENV
else
echo "FLOAT32_TEST_TYPE=float8" >> $GITHUB_ENV
fi
- id: set-excluded-integration-tests
if: github.event_name == 'pull_request'
run: |
echo "EXCLUDED_INTEGRATION_TESTS=SlowTest" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 21
- run: java -version
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '^1.17.7'
- run: go version
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- uses: actions/setup-node@v4
with:
node-version: 16
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- name: Setup psql
run: |
sudo apt-get update
sudo apt-get install --yes --no-install-recommends postgresql-client-14
- name: Create PostgreSQL test database
run: |
psql -h /pg -U postgres -c "CREATE DATABASE pgadapter"
- name: Run unit tests
run: mvn test -B -Ptest-all -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
env:
POSTGRES_HOST: /pg
POSTGRES_PORT: 5432
POSTGRES_USER: postgres
POSTGRES_DATABASE: pgadapter
- name: Run unit tests with virtual threads
run: mvn test -Dpgadapter.use_virtual_threads=true -Dpgadapter.use_virtual_grpc_transport_threads=true -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B -Ptest-all
env:
POSTGRES_HOST: /pg
POSTGRES_PORT: 5432
POSTGRES_USER: postgres
POSTGRES_DATABASE: pgadapter
- name: Auth
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.JSON_SERVICE_ACCOUNT_CREDENTIALS }}
- name: Setup GCloud
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
- name: Run integration tests
run: mvn verify -B -Dclirr.skip=true -DskipITs=false -DskipUnits=true -Dpgadapter.test_float4_type="$FLOAT32_TEST_TYPE" -DexcludedIntegrationTests="$EXCLUDED_INTEGRATION_TESTS" -DPG_ADAPTER_HOST="https://$GOOGLE_CLOUD_ENDPOINT" -DPG_ADAPTER_INSTANCE="$GOOGLE_CLOUD_INSTANCE" -DPG_ADAPTER_DATABASE="$GOOGLE_CLOUD_DATABASE"
env:
POSTGRES_HOST: /pg
POSTGRES_PORT: 5432
POSTGRES_USER: postgres
POSTGRES_DATABASE: pgadapter
43 changes: 43 additions & 0 deletions .github/workflows/integration-windows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
on:
pull_request:
workflow_dispatch:
name: integration-windows
env:
GOOGLE_CLOUD_PROJECT: "span-cloud-testing"
GOOGLE_CLOUD_INSTANCE: "pgadapter-testing"
GOOGLE_CLOUD_DATABASE: "testdb_integration"
GOOGLE_CLOUD_ENDPOINT: "spanner.googleapis.com"
DOTNET_NOLOGO: true
jobs:
check-env:
outputs:
has-key: ${{ steps.project-id.outputs.defined }}
runs-on: ubuntu-latest
steps:
- id: project-id
env:
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
if: "${{ env.GCP_PROJECT_ID != '' }}"
run: echo "defined=true" >> "$GITHUB_OUTPUT"
integration-test:
needs: [check-env]
if: needs.check-env.outputs.has-key == 'true'
timeout-minutes: 60
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
- run: java -version
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
- name: Auth
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.JSON_SERVICE_ACCOUNT_CREDENTIALS }}
- name: Run integration tests
run: mvn verify -B -D clirr.skip=true -D it.test=ITNpgsqlTest -D skipITs=false -D skipUnits=true -D PG_ADAPTER_INSTANCE=%GOOGLE_CLOUD_INSTANCE% -D PG_ADAPTER_DATABASE=%GOOGLE_CLOUD_DATABASE%
15 changes: 11 additions & 4 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
on:
push:
branches:
- postgresql-dialect
pull_request:
schedule:
# Run at 04:52UTC every day. This run will use preprod-spanner.sandbox.googleapis.com
Expand Down Expand Up @@ -114,8 +111,18 @@ jobs:
psql -h /pg -U postgres -c "CREATE DATABASE pgadapter"
- name: Run unit tests
run: mvn test -B -Ptest-all -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
env:
POSTGRES_HOST: /pg
POSTGRES_PORT: 5432
POSTGRES_USER: postgres
POSTGRES_DATABASE: pgadapter
- name: Run unit tests with virtual threads
run: mvn test -Dpgadapter.use_virtual_threads=true -Dpgadapter.use_virtual_grpc_transport_threads=true -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B -Ptest-all
env:
POSTGRES_HOST: /pg
POSTGRES_PORT: 5432
POSTGRES_USER: postgres
POSTGRES_DATABASE: pgadapter
- name: Auth
uses: google-github-actions/auth@v2
with:
Expand All @@ -132,7 +139,7 @@ jobs:
POSTGRES_USER: postgres
POSTGRES_DATABASE: pgadapter
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
directory: ./target/site/jacoco-merged-test-coverage-report
fail_ci_if_error: false
Expand Down
19 changes: 17 additions & 2 deletions .github/workflows/samples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.20.7'
go-version: '1.22.3'
- run: go version
- name: Run gorm Sample tests
working-directory: ./samples/golang/gorm
Expand All @@ -41,7 +41,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.12'
- run: python --version
- name: Install pip
run: python -m pip install --upgrade pip
Expand All @@ -55,6 +55,11 @@ jobs:
run: |
pip install -r requirements.txt
python run_sample.py
- name: Run Django Sample tests
working-directory: ./samples/python/django
run: |
pip install -r requirements.txt
python sample.py
nodejs-samples:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -87,3 +92,13 @@ jobs:
run: |
bundle install
bundle exec rake run
dotnet-samples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
- name: Run npgsql Sample tests
working-directory: ./samples/dotnet/npgsql-sample
run: dotnet run Program.cs
Loading

0 comments on commit 96b06b2

Please sign in to comment.