From ae3994cbe283e617095b3cf1f75014fdf59e6d12 Mon Sep 17 00:00:00 2001 From: "Karl M. Davis" Date: Sun, 19 Nov 2023 10:13:00 -0500 Subject: [PATCH 1/4] Setup CI workflow using GitHub Actions Part of Issue #162. --- .github/workflows/ci.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..bb9dce7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Java CI with Maven + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + java-version: '8' + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B verify --file pom.xml + + # Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive + - name: Update dependency graph + uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6 From bd797cda4d305b4fdf934392dc7d1f73b7f0e4c6 Mon Sep 17 00:00:00 2001 From: "Karl M. Davis" Date: Sun, 19 Nov 2023 16:21:30 -0500 Subject: [PATCH 2/4] Fix GPG error in CI. Part of Issue #162. --- pom.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pom.xml b/pom.xml index 6366960..89e12e6 100644 --- a/pom.xml +++ b/pom.xml @@ -234,6 +234,15 @@ + + org.apache.maven.plugins + maven-gpg-plugin + + + true + + org.apache.maven.plugins maven-install-plugin From 8fc4976cc2acde660c070f5d9663cec7cc04c038 Mon Sep 17 00:00:00 2001 From: "Karl M. Davis" Date: Sun, 19 Nov 2023 16:56:27 -0500 Subject: [PATCH 3/4] Adding PostgreSQL container to CI workflow. Part of Issue #162. --- .github/workflows/ci.yml | 41 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb9dce7..76131f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,14 +19,53 @@ jobs: runs-on: ubuntu-latest + # The workflow runner will start these containers before the job's steps, and then stop them afterwards. + services: + # Label used to access the service container + postgres: + # Docker Hub image + image: postgres + # Provide the password for postgres + env: + POSTGRES_PASSWORD: postgres + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + # Opens the port on the host and service container + - 5432:5432 + steps: - - uses: actions/checkout@v3 + - name: Checkout Project + uses: actions/checkout@v3 - name: Set up JDK 8 uses: actions/setup-java@v3 with: java-version: '8' distribution: 'temurin' cache: maven + - name: Configure Maven Settings for ITs + uses: whelk-io/maven-settings-xml-action@v20 + with: + profiles: | + [ + { + "id": "rps", + "properties": { + "com.justdavis.karl.datasources.provisioner.postgresql.server.url": "jdbc:postgresql:postgres", + "com.justdavis.karl.datasources.provisioner.postgresql.server.user": "postgres", + "com.justdavis.karl.datasources.provisioner.postgresql.server.password": "postgres" + } + } + ] + active_profiles: | + [ + "rps" + ] + - name: Build with Maven run: mvn -B verify --file pom.xml From 266c0f8cdc9855f86534b96aa3c10b457a5c2251 Mon Sep 17 00:00:00 2001 From: "Karl M. Davis" Date: Sun, 19 Nov 2023 18:30:33 -0500 Subject: [PATCH 4/4] Try to resolve CI error. Per this action didn't use to support multi-module projects, but per the README, now does. Part of Issue #162. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76131f7..9af89a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,4 +71,4 @@ jobs: # Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive - name: Update dependency graph - uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6 + uses: advanced-security/maven-dependency-submission-action@v3