Skip to content

[DAT-15338] Add mongodb connection patterns to hide credentials in logs #90

[DAT-15338] Add mongodb connection patterns to hide credentials in logs

[DAT-15338] Add mongodb connection patterns to hide credentials in logs #90

Workflow file for this run

name: Build and Test
on:
workflow_dispatch:
pull_request:
types:
- opened
- reopened
- synchronize
jobs:
build:
name: Build & Package
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LIQUIBOT_TOKEN: ${{ secrets.LIQUIBOT_PAT }}
GPM_USERNAME: "liquibot"
GPM_PASSWORD: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'
# look for dependencies in maven
- name: maven-settings-xml-action
uses: whelk-io/maven-settings-xml-action@v21
with:
repositories: |
[
{
"id": "liquibase",
"url": "https://maven.pkg.github.com/liquibase/liquibase",
"releases": {
"enabled": "false"
},
"snapshots": {
"enabled": "true",
"updatePolicy": "always"
}
},
{
"id": "liquibase-pro",
"url": "https://maven.pkg.github.com/liquibase/liquibase-pro",
"releases": {
"enabled": "false"
},
"snapshots": {
"enabled": "true",
"updatePolicy": "always"
}
}
]
servers: |
[
{
"id": "liquibase-pro",
"username": "liquibot",
"password": "${{ secrets.LIQUIBOT_PAT }}"
},
{
"id": "liquibase",
"username": "liquibot",
"password": "${{ secrets.LIQUIBOT_PAT }}"
}
]
- name: Build and Package
run: mvn -B dependency:go-offline clean package -DskipTests=true
- name: Get Artifact ID
id: get-artifact-id
run: echo "::set-output name=artifact_id::$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)"
- name: Save Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ steps.get-artifact-id.outputs.artifact_id }}-artifacts
path: |
target/*
- name: Save Event File
uses: actions/upload-artifact@v3
with:
name: Event File
path: ${{ github.event_path }}
outputs:
artifact_id: ${{ steps.get-artifact-id.outputs.artifact_id }}
unit-test:
strategy:
fail-fast: false
matrix:
java: [ 8, 11, 17, 18 ]
os: [ ubuntu-latest, windows-latest ]
name: Test Java ${{ matrix.java }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
LIQUIBOT_TOKEN: ${{ secrets.LIQUIBOT_PAT }}
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
needs: build
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: 'maven'
# look for dependencies in maven
- name: maven-settings-xml-action
uses: whelk-io/maven-settings-xml-action@v21
with:
repositories: |
[
{
"id": "liquibase",
"url": "https://maven.pkg.github.com/liquibase/liquibase",
"releases": {
"enabled": "false"
},
"snapshots": {
"enabled": "true",
"updatePolicy": "always"
}
},
{
"id": "liquibase-pro",
"url": "https://maven.pkg.github.com/liquibase/liquibase-pro",
"releases": {
"enabled": "false"
},
"snapshots": {
"enabled": "true",
"updatePolicy": "always"
}
}
]
servers: |
[
{
"id": "liquibase-pro",
"username": "liquibot",
"password": "${{ secrets.LIQUIBOT_PAT }}"
},
{
"id": "liquibase",
"username": "liquibot",
"password": "${{ secrets.LIQUIBOT_PAT }}"
}
]
- uses: actions/download-artifact@v3
with:
name: ${{needs.build.outputs.artifact_id}}-artifacts
path: ./target
- name: Run Tests
run: mvn -B jacoco:prepare-agent surefire:test
- name: Archive Test Results - ${{ matrix.os }}
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: test-reports-jdk-${{ matrix.java }}-${{ matrix.os }}
path: |
**/target/surefire-reports
**/target/jacoco.exec
integration-tests:
name: Integration Test - Java ${{ matrix.java }}
runs-on: ubuntu-latest
env:
LIQUIBOT_TOKEN: ${{ secrets.LIQUIBOT_PAT }}
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
needs: unit-test
strategy:
matrix:
java: [8, 11, 17]
mongodb: [4]
services:
mongodb:
image: mongo:${{ matrix.mongodb }}
ports:
- 27017-27019:27017-27019
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: 'maven'
# look for dependencies in maven
- name: maven-settings-xml-action
uses: whelk-io/maven-settings-xml-action@v21
with:
repositories: |
[
{
"id": "liquibase",
"url": "https://maven.pkg.github.com/liquibase/liquibase",
"releases": {
"enabled": "false"
},
"snapshots": {
"enabled": "true",
"updatePolicy": "always"
}
},
{
"id": "liquibase-pro",
"url": "https://maven.pkg.github.com/liquibase/liquibase-pro",
"releases": {
"enabled": "false"
},
"snapshots": {
"enabled": "true",
"updatePolicy": "always"
}
}
]
servers: |
[
{
"id": "liquibase-pro",
"username": "liquibot",
"password": "${{ secrets.LIQUIBOT_PAT }}"
},
{
"id": "liquibase",
"username": "liquibot",
"password": "${{ secrets.LIQUIBOT_PAT }}"
}
]
- name: Integration Test - Java ${{ matrix.java }}
run: mvn -B clean test verify -Prun-its --file pom.xml
harness-tests:
name: Harness Tests - Java ${{ matrix.java }}
runs-on: ubuntu-latest
env:
LIQUIBOT_TOKEN: ${{ secrets.LIQUIBOT_PAT }}
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
strategy:
matrix:
java: [ 11, 17 ]
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: 'maven'
# look for dependencies in maven
- name: maven-settings-xml-action
uses: whelk-io/maven-settings-xml-action@v21
with:
repositories: |
[
{
"id": "liquibase",
"url": "https://maven.pkg.github.com/liquibase/liquibase",
"releases": {
"enabled": "false"
},
"snapshots": {
"enabled": "true",
"updatePolicy": "always"
}
},
{
"id": "liquibase-pro",
"url": "https://maven.pkg.github.com/liquibase/liquibase-pro",
"releases": {
"enabled": "false"
},
"snapshots": {
"enabled": "true",
"updatePolicy": "always"
}
}
]
servers: |
[
{
"id": "liquibase-pro",
"username": "liquibot",
"password": "${{ secrets.LIQUIBOT_PAT }}"
},
{
"id": "liquibase",
"username": "liquibot",
"password": "${{ secrets.LIQUIBOT_PAT }}"
}
]
- name: Build Cache
uses: actions/[email protected]
with:
key: build-${{ github.run_number }}-${{ github.run_attempt }}
path: |
**/target/**
~/.m2/repository/org/liquibase/
- name: Start Database
run: |
docker ps -a
docker-compose -f ./src/test/resources/docker/docker-compose.yml up -d
docker ps -a
- name: Harness Foundational Test Suite Run - Java ${{ matrix.java }}
run: mvn -Dtest="HarnessNoSqlCompatibility" -DdbName=mongodb clean package
- name: Stop Docker Databases
if: always()
run: docker-compose -f ./src/test/resources/docker/docker-compose.yml down
- name: Archive Mongo Database Test Results
uses: actions/upload-artifact@v3
with:
name: mongodb-test-results
path: build/spock-reports