chore(postgresql-dialect): release 0.23.1 #4104
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
on: | |
push: | |
branches: | |
- postgresql-dialect | |
pull_request: | |
schedule: | |
# Run at 04:52UTC every day. This run will use preprod-spanner.sandbox.googleapis.com | |
- cron: '52 4 * * *' | |
# Run at 03:14UTC every day. This run will use staging-wrenchworks.sandbox.googleapis.com | |
- cron: '14 3 * * *' | |
workflow_dispatch: | |
inputs: | |
endpoint: | |
description: "The Spanner endpoint to use for the tests" | |
required: true | |
type: choice | |
options: | |
- spanner.googleapis.com | |
- staging-wrenchworks.sandbox.googleapis.com | |
- preprod-spanner.sandbox.googleapis.com | |
name: integration | |
env: | |
GOOGLE_CLOUD_PROJECT: "span-cloud-testing" | |
GOOGLE_CLOUD_INSTANCE: "pgadapter-testing" | |
GOOGLE_CLOUD_DATABASE: "testdb_integration" | |
GOOGLE_CLOUD_ENDPOINT: "spanner.googleapis.com" | |
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 "::set-output name=defined::true" | |
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: | |
- id: set-manual-endpoint | |
if: "${{ inputs.endpoint }}" | |
run: | | |
echo "GOOGLE_CLOUD_ENDPOINT=${{ inputs.endpoint }}" >> $GITHUB_ENV | |
- id: set-preprod-scheduled-endpoint | |
if: github.event.schedule=='52 4 * * *' | |
run: | | |
echo "GOOGLE_CLOUD_ENDPOINT=preprod-spanner.sandbox.googleapis.com" >> $GITHUB_ENV | |
- id: set-staging-scheduled-endpoint | |
if: github.event.schedule=='14 3 * * *' | |
run: | | |
echo "GOOGLE_CLOUD_ENDPOINT=staging-wrenchworks.sandbox.googleapis.com" >> $GITHUB_ENV | |
- uses: actions/checkout@v3 | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: zulu | |
java-version: 11 | |
- run: java -version | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '^1.17.7' | |
- run: go version | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- uses: actions/setup-node@v3 | |
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 | |
- name: Setup GCloud | |
uses: google-github-actions/setup-gcloud@v0 | |
with: | |
project_id: ${{ secrets.GCP_PROJECT_ID }} | |
service_account_key: ${{ secrets.JSON_SERVICE_ACCOUNT_CREDENTIALS }} | |
export_default_credentials: true | |
- name: Run integration tests | |
run: mvn verify -B -Dclirr.skip=true -DskipITs=false -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 | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
directory: ./target/site/jacoco-merged-test-coverage-report | |
fail_ci_if_error: true | |
flags: all_tests | |
name: codecov-umbrella | |
path_to_write_report: ./coverage/codecov_report.txt | |
verbose: true | |
- id: create-issue-on-failure | |
if: "${{ failure() && (github.event.schedule=='52 4 * * *' || github.event.schedule=='14 3 * * *' || inputs.endpoint != '')}}" | |
uses: JasonEtco/create-an-issue@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ENDPOINT: ${{ env.GOOGLE_CLOUD_ENDPOINT }} | |
with: | |
filename: .github/integration-test-failed-template.md | |
assignees: pratickchokhani, olavloite |