Skip to content

Commit

Permalink
Merge pull request #168 from karlmdavis/issue-162-ci-github-actions
Browse files Browse the repository at this point in the history
Setup CI workflow using GitHub Actions
  • Loading branch information
karlmdavis authored Nov 19, 2023
2 parents 47f57a9 + 266c0f8 commit d2e3419
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# 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

# 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:
- 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

# 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@v3
9 changes: 9 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,15 @@
</formats>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<configuration>
<!-- Disable GPG signing of JARs as we're no longer deploying them to Maven Central (and the
signing isn't needed or working for CI). -->
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
Expand Down

0 comments on commit d2e3419

Please # to comment.