Skip to content

Java CI with Maven on Pull #5

Java CI with Maven on Pull

Java CI with Maven on Pull #5

Workflow file for this run

# 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/actions/automating-builds-and-tests/building-and-testing-java-with-maven
name: Java CI with Maven on Pull
on:
pull_request:
branches: [ "main" ]
push:
branches: [ "actions"] #Allows testing Actions changes in a fork
schedule:
- cron: "0 12 * * 1-5"
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
services:
cloudant:
#Update Readme to match
image: couchdb:3.4.2
env:
COUCHDB_USER: admin
COUCHDB_PASSWORD: password
# Set health checks to wait until couchdb has started
options: >-
--health-cmd "curl -f http://localhost:5984/_up || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5984:5984
steps:
- name: Create system databases
run: |
curl -X PUT http://admin:password@localhost:5984/_users
curl -X PUT http://admin:password@localhost:5984/_replicator
curl -X PUT http://admin:password@localhost:5984/_global_changes
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up JDK 21
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
with:
java-version: 21
distribution: 'temurin'
cache: maven
- name: Compile App and Tests
run: |
mvn -B compiler:compile
mvn -B compiler:testCompile
- name: Create Server and Deploy App
run: |
mvn -B liberty:create
mvn -B liberty:deploy
- name: Start Server
run: mvn -B liberty:start
- name: Run Integration Tests
run: mvn -B failsafe:integration-test
- name: Stop Server
run: mvn -B liberty:stop
- name: Verify Integration Test Results
run: mvn -B failsafe:verify
- name: Archive Liberty logs
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: liberty-logs
path: target/liberty/wlp/usr/servers/CloudantServer/logs/
retention-days: 1