Java CI with Maven on Pull #221
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: | |
mongo: | |
image: mongo:7.0.7 | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd "echo 'db.runCommand("ping").ok' | mongosh --quiet" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 27017:27017 | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.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/JakartaConcurrencyServer/logs/ | |
retention-days: 1 |