Skip to content

CORE-250: upgrade Postgres to 16.6 #584

CORE-250: upgrade Postgres to 16.6

CORE-250: upgrade Postgres to 16.6 #584

Workflow file for this run

# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Run Tests
on:
workflow_dispatch: {}
push:
branches: [ master ]
paths-ignore: [ '**.md' ]
pull_request:
# Branch settings require status checks before merging, so don't add paths-ignore.
branches: [ master ]
env:
JANITOR_APP_SA_FILE: src/test/resources/rendered/sa-account.json
JANITOR_CLIENT_SA_FILE: src/test/resources/rendered/client-sa-account.json
JANITOR_CLIENT_SA_TOOLS_FILE: src/test/resources/rendered/tools-client-sa-account.json
JANITOR_CLOUD_ACCESS_SA_FILE: src/test/resources/rendered/cloud-access-sa-account.json
LOCAL_PROPERTIES_DIR: config
jobs:
unit-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16.6
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- name: Skip version bump merges
id: skiptest
uses: ./.github/actions/bump-skip
with:
event-name: ${{ github.event_name }}
- name: Render secrets for tests
if: steps.skiptest.outputs.is-bump == 'no'
run: |
JANITOR_APP_SA_B64=${{ secrets.JANITOR_APP_SA }}
echo ::add-mask::$JANITOR_APP_SA_B64
JANITOR_APP_SA=$(echo $JANITOR_APP_SA_B64 | base64 --decode)
echo ::add-mask::$JANITOR_APP_SA
echo $JANITOR_APP_SA > $JANITOR_APP_SA_FILE
JANITOR_CLIENT_SA_B64=${{ secrets.JANITOR_CLIENT_SA }}
echo ::add-mask::$JANITOR_CLIENT_SA_B64
JANITOR_CLIENT_SA=$(echo $JANITOR_CLIENT_SA_B64 | base64 --decode)
echo ::add-mask::$JANITOR_CLIENT_SA
echo $JANITOR_CLIENT_SA > $JANITOR_CLIENT_SA_FILE
JANITOR_CLIENT_SA_TOOLS_B64=${{ secrets.JANITOR_CLIENT_SA_TOOLS }}
echo ::add-mask::$JANITOR_CLIENT_SA_TOOLS_B64
JANITOR_CLIENT_SA_TOOLS=$(echo $JANITOR_CLIENT_SA_TOOLS_B64 | base64 --decode)
echo ::add-mask::$JANITOR_CLIENT_SA_TOOLS
echo $JANITOR_CLIENT_SA_TOOLS > $JANITOR_CLIENT_SA_TOOLS_FILE
JANITOR_CLOUD_ACCESS_SA_B64=${{ secrets.JANITOR_CLOUD_ACCESS_SA }}
echo ::add-mask::JANITOR_CLOUD_ACCESS_SA_B64
JANITOR_CLOUD_ACCESS_SA=$(echo $JANITOR_CLOUD_ACCESS_SA_B64 | base64 --decode)
echo ::add-mask::$JANITOR_CLOUD_ACCESS_SA
echo $JANITOR_CLOUD_ACCESS_SA > $JANITOR_CLOUD_ACCESS_SA_FILE
AZURE_PUBLISHER_CLIENT_ID=${{ secrets.AZURE_PUBLISHER_CLIENT_ID }}
echo ::add-mask::$AZURE_PUBLISHER_CLIENT_ID
AZURE_PUBLISHER_CLIENT_SECRET=${{ secrets.AZURE_PUBLISHER_CLIENT_SECRET }}
echo ::add-mask::$AZURE_PUBLISHER_CLIENT_SECRET
AZURE_PUBLISHER_TENANT_ID=${{ secrets.AZURE_PUBLISHER_TENANT_ID }}
echo ::add-mask::$AZURE_PUBLISHER_TENANT_ID
mkdir -p "${LOCAL_PROPERTIES_DIR}"
cat << EOF > ${LOCAL_PROPERTIES_DIR}/local-properties.yml
janitor:
azure:
managed-app-client-id: ${AZURE_PUBLISHER_CLIENT_ID}
managed-app-client-secret: ${AZURE_PUBLISHER_CLIENT_SECRET}
managed-app-tenant-id: ${AZURE_PUBLISHER_TENANT_ID}
EOF
- name: Initialize Postgres DB
if: steps.skiptest.outputs.is-bump == 'no'
env:
PGPASSWORD: postgres
run: psql -h 127.0.0.1 -U postgres -f ./local-dev/local-postgres-init.sql
- name: Set up JDK 17
if: steps.skiptest.outputs.is-bump == 'no'
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Cache Gradle packages
if: steps.skiptest.outputs.is-bump == 'no'
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: v1-${{ runner.os }}-gradle-${{ hashfiles('**/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle') }}
restore-keys: v1-${{ runner.os }}-gradle-${{ hashfiles('**/gradle-wrapper.properties') }}
- name: Grant execute permission for gradlew
if: steps.skiptest.outputs.is-bump == 'no'
run: chmod +x gradlew
- name: Check Javadoc
if: steps.skiptest.outputs.is-bump == 'no'
run: ./gradlew javadoc --scan
- name: Run unit tests
if: steps.skiptest.outputs.is-bump == 'no'
id: unit-test
run: ./gradlew unitTest --scan
- name: Run integration tests
if: steps.skiptest.outputs.is-bump == 'no'
id: integration-test
run: ./gradlew integrationTest --scan
- name: Upload Test Reports
if: always() && steps.skiptest.outputs.is-bump == 'no'
uses: actions/upload-artifact@v3
with:
name: Test Reports
path: build/reports/tests