Skip to content

Refactor workflow to prevent duplicated publish #474

Refactor workflow to prevent duplicated publish

Refactor workflow to prevent duplicated publish #474

Workflow file for this run

on:
push:
branches: [ master ]
env:
MAVEN_NASHORN: ""
MAVEN_BYTEBUDDY: ""
DOCKER_RESOURCES: ./model/src/test/resources/docker
jobs:
build-jdk11:
uses: ./.github/workflows/build-jdk11.yml
with:
DOCKER_RESOURCES: ./model/src/test/resources/docker
build-additional:
uses: ./.github/workflows/build-additional.yml
with:
DOCKER_RESOURCES: ./model/src/test/resources/docker
codeql:
uses: ./.github/workflows/codeql.yml
build:
name: Tests on Docker
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- jdk: 3.8.6-eclipse-temurin-18
nashorn: ''
bytebuddy: ''
isPublishing: 'true'
- jdk: 3.9.3-eclipse-temurin-20
nashorn: ''
bytebuddy: ''
isPublishing: 'false'
- jdk: 3.9.7-eclipse-temurin-21
nashorn: ''
bytebuddy: '-Dnet.bytebuddy.experimental=true'
isPublishing: 'false'
# Groovy not compatible jdk22: gmavenplus-plugin JsonUtilSpock.groovy Unsupported class file major version 66
# - jdk: 3.9.7-eclipse-temurin-22
# nashorn: ""
# bytebuddy: "-Dbytebuddy.experimental=true"
env:
JSQL_DOCKERFILE: ${{ matrix.jdk }}
MAVEN_NASHORN: ${{ matrix.nashorn }}
# experimental enabled on jdk21 to prevent 'Mockito cannot mock this class: class org.jsoup.nodes.Document'
MAVEN_BYTEBUDDY: ${{ matrix.bytebuddy }}
IS_PUBLISHING: ${{ matrix.isPublishing }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Disable shallow clone to prevent Sonar warning
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 18
- name: Set Maven dependencies cache
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Install Maven dependencies
run: mvn clean install -DskipTests dependency:tree
- name: Run databases and LAMP
run: |
docker-compose -f $DOCKER_RESOURCES/docker-compose.yml build --parallel
docker-compose -f $DOCKER_RESOURCES/docker-compose.yml up -d
- name: List images and containers
run: docker images && docker container ls
- name: Database health checks and configuration
run: |
$DOCKER_RESOURCES/scripts/healthcheck/healthcheck.sh
$DOCKER_RESOURCES/scripts/buff.sh
$DOCKER_RESOURCES/scripts/verify.sh
- name: Build project container
run: docker build -t jsql:latest --build-arg JSQL_DOCKERFILE -f $DOCKER_RESOURCES/Dockerfile.jsql .
- name: Unit and integration tests with Sonar scan
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# profile to skipITs/skipTests (env var MAVEN_OPS not working)
# mvn goal site last to apply skin to generated reports
# remove goal pmd:pmd: random StackOverflowError
run: |
$DOCKER_RESOURCES/scripts/run-on-docker.sh '
mvn clean install \
--no-transfer-progress \
-Dorg.slf4j.simpleLogger.log.org.sonarsource.scanner.maven.SonarQubeMojo=error \
-P tests \
sonar:sonar \
org.pitest:pitest-maven:mutationCoverage \
jxr:jxr \
javadoc:javadoc \
surefire-report:report \
surefire-report:failsafe-report-only \
dependency:analyze-report \
spotbugs:check \
versions:dependency-updates-report \
checkstyle:checkstyle \
site
'
- name: Databases statistics
run: $DOCKER_RESOURCES/scripts/verify.sh
- uses: ./.github/workflows/publish-scan.yml
if: ${{ env.IS_PUBLISHING == 'true' }}
release:
needs: [build-jdk11, build, build-additional, codeql]
uses: ./.github/workflows/release.yml
secrets: inherit