[all] : Configure gitlab for distribution #54
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: maven-build | |
on: | |
workflow_dispatch: | |
# schedule: | |
# - cron: '0 10 * * 1' | |
push: | |
branches: | |
- master | |
- develop | |
paths-ignore: | |
- '.github/workflows/sonarcloud.yml' | |
- '.run/**' | |
- '.m2/**' | |
- '.repo/**' | |
env: | |
# Github Additional Configuration | |
GITHUB_REPO_NAME: ${{ github.event.repository.name }} | |
GITHUB_ACTOR: ${{ github.actor }} | |
GITHUB_PROJECT_DIR: ${{ github.workspace }} | |
GITHUB_TARGET_DIR: ${{ github.workspace }}/target | |
GITHUB_BRANCH_NAME: ${{ github.ref_name }} | |
GITHUB_UPLOAD_DIR: ${{ github.workspace }}/target/staging | |
GITHUB_UPLOAD_NAME: ${{ github.event.repository.name }}.zip | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PCK_READ_TOKEN: ${{ secrets.PCK_READ_TOKEN }} | |
PCK_WRITE_TOKEN: ${{ secrets.PCK_WRITE_TOKEN }} | |
# Gitlab Configuration | |
GLAB_READ_TOKEN: ${{ secrets.GLAB_READ_TOKEN }} | |
GLAB_WRITE_TOKEN: ${{ secrets.GLAB_WRITE_TOKEN }} | |
GLAB_DEPLOY_TOKEN: ${{ secrets.GLAB_DEPLOY_TOKEN }} | |
# Maven Common Configuration | |
MVN_HOME_DIR: ~/.m2 | |
MVN_REPO_JOB_DIR: ${{ github.workspace }}/.repo | |
MVN_SETTING_JOB_FILE: ${{ github.workspace }}/.m2/settings.xml | |
MVN_SETT_OPTS: -V -B | |
MVN_SETS_OPTS: -V -B -s${{ github.workspace }}/.m2/settings.xml | |
MVN_REPO_OPTS: -DdepGitlab -Dmaven.repo.local=${{ github.workspace }}/.repo | |
# Maven Test Configuration | |
MVN_TEST_OPTS_N: "-DskipTests=true -DskipITs=true -Dmaven.test.failure.ignore=true" | |
MVN_TEST_OPTS_Y: "-DskipTests=false -DskipITs=false -Dmaven.test.failure.ignore=true" | |
# Maven Deploy Configuration | |
MVN_DEPLOY_OPTS: "-DfastBuild -DretryFailedDeploymentCount=5" | |
# Sonarcloud Configuration | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN}} | |
SONAR_CACHE_DIR: "${HOME}/.sonar/cache" | |
SONAR_HOST_URL: "https://sonarcloud.io" | |
MVN_SONAR_OPTS: "-Dsonar.qualitygate.wait=false -Dsonar.login=\"${{ secrets.SONAR_TOKEN}}\"" | |
# Codacy Configuration | |
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
CODACY_API_TOKEN: ${{ secrets.CODACY_API_TOKEN }} | |
MVN_CODACY_OPTS: -DcoverageReportFile=target/jacoco/comm/jacoco.xml -DprojectToken=${{ secrets.CODACY_PROJECT_TOKEN }} -DapiToken=${{ secrets.CODACY_API_TOKEN }} | |
# Coveralls Configuration | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
MVN_COVERALLS_OPTS: -Dbranch=${{ github.ref_name }} -DrepoToken=${{ secrets.COVERALLS_REPO_TOKEN }} | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
version: [17] | |
distribution: [adopt] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4.1.1 | |
with: | |
fetch-depth: 0 | |
- name: setup JDK | |
uses: actions/setup-java@v4.0.0 | |
with: | |
java-version: '${{ matrix.version }}' | |
distribution: '${{ matrix.distribution }}' | |
architecture: x64 | |
- name: cache maven packages | |
uses: actions/cache@v4.0.0 | |
with: | |
path: ${{ env.MVN_REPO_JOB_DIR }} | |
key: ${{ matrix.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ matrix.os }}-m2 | |
- name: maven build | |
run: bash ${{ env.GITHUB_PROJECT_DIR}}/.mvn/.build.sh -do | |
- name: upload artifact | |
uses: actions/upload-artifact@v4.3.0 | |
with: | |
name: ${{ env.GITHUB_UPLOAD_NAME }} | |
path: ${{ env.GITHUB_UPLOAD_DIR }} | |
if-no-files-found: warn | |
retention-days: 3 |