Merge remote-tracking branch 'github/master' #401
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
on: | |
push: | |
branches: [ master ] | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
MAVEN_NASHORN: "" | |
DOCKER_RESOURCES: ./model/src/test/resources/docker | |
jobs: | |
build-jdk11: | |
name: Test view on Docker (jdk-11) | |
runs-on: ubuntu-latest | |
env: | |
JSQL_DOCKERFILE: 3.8.1-jdk-11-slim | |
MAVEN_NASHORN: -Dnashorn.args=--no-deprecation-warning | |
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: Build project container | |
run: docker build -t jsql:latest --build-arg JSQL_DOCKERFILE -f $DOCKER_RESOURCES/Dockerfile.jsql . | |
- name: Unit tests | |
run: $DOCKER_RESOURCES/scripts/run-on-docker-no-network.sh 'cd view/ && mvn clean install -P tests' | |
build: | |
name: Tests on Docker | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- jdk: 3.8.6-eclipse-temurin-18 | |
nashorn: "" | |
- jdk: 3.9.3-eclipse-temurin-20 | |
nashorn: "" | |
env: | |
JSQL_DOCKERFILE: ${{ matrix.jdk }} | |
MAVEN_NASHORN: ${{ matrix.nashorn }} | |
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 | |
# Profile usage for skipITs/skipTests (env var MAVEN_OPS not working) | |
# Note: 'mvn sonar:sonar' not working, modules reports not found, use 'mvn verify sonar:sonar' for reliability | |
# Note: gh actions sonarsource/sonarqube-scan-action not working properly => analysis not reliable | |
run: | | |
$DOCKER_RESOURCES/scripts/run-on-docker.sh ' | |
mvn clean install -P tests \ | |
sonar:sonar \ | |
org.pitest:pitest-maven:mutationCoverage\ | |
surefire-report:report \ | |
surefire-report:failsafe-report-only \ | |
javadoc:javadoc \ | |
versions:dependency-updates-report | |
' | |
- name: Databases statistics | |
run: $DOCKER_RESOURCES/scripts/verify.sh | |
- name: Copy files and coverage reports from container | |
# Sonar scans unmerged reports, Codacy/Codecov requires scanning each files (or reports merged) | |
run: | | |
mkdir -p shared-resources/model shared-resources/view | |
docker cp docker_jsql-container:view/. shared-resources/view | |
docker cp docker_jsql-container:model/. shared-resources/model | |
docker cp docker_jsql-container:pom.xml shared-resources | |
- name: Codecov scan | |
run: cd shared-resources && bash <(curl -s https://codecov.io/bash) || true | |
- name: Codacy scan | |
run: cd shared-resources && bash <(curl -Ls https://coverage.codacy.com/get.sh) || true | |
- name: Publish coverage | |
run: | | |
git checkout docs | |
git config user.name "Github Actions" | |
git config user.email [email protected] | |
git pull -s ours # ignore remote changes when updated by parallel jobs | |
for i in view model; do | |
rm -r $i/target/site/ $i/target/pit-reports/ || echo 'Folder(s) not found' | |
FOLDER=$i/target/site bash -c 'mkdir -p $FOLDER/ && cp -r shared-resources/$FOLDER/. $FOLDER/' | |
FOLDER=$i/target/pit-reports bash -c 'mkdir -p $FOLDER/ && cp -r shared-resources/$FOLDER/. $FOLDER/' | |
# folders view/target model/target contain other build files from 'Install Maven dependencies' | |
git add -f $i/target/site $i/target/pit-reports | |
done; | |
git commit -m "Publish jacoco, javadoc, surefire, dependencies and pitest reports" | |
git push | |
codeql: | |
name: CodeQL | |
uses: ./.github/workflows/run-codeql.yml | |
release: | |
needs: [build-jdk11, build, codeql] | |
name: Publish | |
uses: ./.github/workflows/release.yml | |
secrets: inherit |