From 029bef98ac53b4a312f94a885a2365463c991067 Mon Sep 17 00:00:00 2001 From: Sayali Mohadikar <76010603+sayaliM0412@users.noreply.github.com> Date: Mon, 18 Sep 2023 05:59:29 -0700 Subject: [PATCH] DAT-15809 (#439) * consume packages from GPM * add env variables and profile for CORE and PRO in pom * Update test.yml --------- Co-authored-by: Sayali M --- .github/workflows/test.yml | 189 ++++++++++++++++++++++++++++++++++++- pom.xml | 26 +++++ 2 files changed, 214 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 171dd8b3..1e9afa7b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,6 +12,11 @@ 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 @@ -21,6 +26,48 @@ jobs: 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 @@ -53,6 +100,9 @@ jobs: 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 @@ -64,6 +114,49 @@ jobs: 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 @@ -84,6 +177,9 @@ jobs: 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: @@ -104,12 +200,60 @@ jobs: 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 ] @@ -124,6 +268,49 @@ jobs: 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/cache@v3.3.2 with: @@ -149,4 +336,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: mongodb-test-results - path: build/spock-reports \ No newline at end of file + path: build/spock-reports diff --git a/pom.xml b/pom.xml index a2bf9407..2980f1e1 100644 --- a/pom.xml +++ b/pom.xml @@ -460,6 +460,32 @@ + + remote-repositories + + + env.CI + true + + + + + liquibase + https://maven.pkg.github.com/liquibase/liquibase + + true + + + + liquibase-pro + https://maven.pkg.github.com/liquibase/liquibase-pro + + true + + + + + coverage