Merge pull request #225 from neicnordic/dependabot/maven/org.springfr… #572
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
name: Java CI | |
on: | |
push: | |
jobs: | |
doa: | |
name: DOA test with ${{ matrix.storagetype }} and outbox | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
storagetype: [s3, posix] | |
java-version: [17] | |
env: | |
SSL_ENABLED: false | |
BROKER_HOST: localhost | |
BROKER_VALIDATE: false | |
DB_INSTANCE: localhost | |
ROOT_CERT_PATH: test/rootCA.pem | |
CERT_PATH: test/localhost-client.pem | |
CERT_KEY: test/localhost-client-key.der | |
POSTGRES_PASSWORD: password | |
OPENID_CONFIGURATION_URL: http://localhost:8000/openid-configuration | |
USERINFO_ENDPOINT_URL: http://localhost:8000/userinfo | |
CRYPT4GH_PRIVATE_KEY_PATH: test/crypt4gh.sec.pem | |
CRYPT4GH_PRIVATE_KEY_PASSWORD_PATH: test/crypt4gh.pass | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set S3 env variables | |
if: matrix.storagetype == 's3' | |
run: | | |
echo "OUTBOX_TYPE=S3" >> $GITHUB_ENV | |
echo "S3_OUT_ENDPOINT=localhost" >> $GITHUB_ENV | |
echo "S3_OUT_PORT=9000" >> $GITHUB_ENV | |
echo "S3_OUT_SECURE=false" >> $GITHUB_ENV | |
- name: Set posix env variables | |
if: matrix.storagetype == 'posix' | |
run: | | |
echo "OUTBOX_TYPE=POSIX" >> $GITHUB_ENV | |
echo "OUTBOX_LOCATION=$PWD/%s/files/" >> $GITHUB_ENV | |
- name: Docker Stack Deploy for ${{ matrix.storagetype }} storage | |
run: | | |
docker swarm init | |
docker stack deploy DOA --compose-file docker-compose-${{ matrix.storagetype }}-outbox.yml | |
- name: Set up JDK 17 | |
uses: actions/[email protected] | |
with: | |
distribution: zulu | |
java-version: ${{ matrix.java-version }} | |
- name: Sleep and Status check | |
run: | | |
sleep 30 | |
docker service list | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: create maven settings.xml | |
uses: s4u/[email protected] | |
with: | |
servers: | | |
[{ | |
"id":"github-clearinghouse", | |
"username": "${{github.actor}}", | |
"password": "${{ secrets.GITHUB_TOKEN }}" | |
}, | |
{ | |
"id":"github-crypt4gh", | |
"username": "${{github.actor}}", | |
"password": "${{ secrets.GITHUB_TOKEN }}" | |
}] | |
- name: Spring Boot Run | |
run: nohup mvn -gs ~/.m2/settings.xml spring-boot:run --no-transfer-progress > nohup.out & | |
- name: Wait for app to start | |
run: | | |
RETRY_TIMES=0 | |
until lsof -i -P -n | grep ":8080"; | |
do | |
RETRY_TIMES=$((RETRY_TIMES+1)); | |
if [ $RETRY_TIMES -eq 30 ]; then exit 1; fi | |
sleep 10; | |
done | |
- name: Test | |
run: mvn -gs ~/.m2/settings.xml test --no-transfer-progress | |
- name: Spring Boot Run Logs | |
if: failure() | |
run: cat nohup.out | |
- name: Docker Service Logs | |
if: failure() | |
run: | | |
docker service logs DOA_db | |
docker service logs DOA_mockauth |