|
| 1 | +name: Build and push |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - master |
| 6 | + pull_request: |
| 7 | + branches: |
| 8 | + - master |
| 9 | +env: |
| 10 | + JFROG_USER: ${{ secrets.ARTIFACTORY_AUTH_USER }} |
| 11 | + JFROG_PASS: ${{ secrets.ARTIFACTORY_AUTH_TOKEN }} |
| 12 | + |
| 13 | +jobs: |
| 14 | + maven-package: |
| 15 | + if: "!contains(github.event.head_commit.message, 'ci skip')" |
| 16 | + runs-on: ubuntu-24.04 |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + fetch-depth: 0 |
| 21 | + - name: Install xmlstarlet |
| 22 | + run: | |
| 23 | + sudo rm -rf /var/lib/apt/lists/* |
| 24 | + sudo apt-get update |
| 25 | + sudo apt-get -y install xmlstarlet |
| 26 | + - name: Copy maven settings |
| 27 | + run: | |
| 28 | + wget https://raw.githubusercontent.com/entur/ror-maven-settings/master/.m2/settings.xml -O .github/workflows/settings.xml |
| 29 | + - uses: actions/setup-java@v4 |
| 30 | + with: |
| 31 | + java-version: 17.0.15 |
| 32 | + distribution: temurin |
| 33 | + - name: Cache Maven dependencies |
| 34 | + uses: actions/cache@v4 |
| 35 | + with: |
| 36 | + path: ~/.m2/repository |
| 37 | + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
| 38 | + restore-keys: | |
| 39 | + ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
| 40 | + ${{ runner.os }}-maven- |
| 41 | + ${{ runner.os }}- |
| 42 | +
|
| 43 | + - name: Run maven build |
| 44 | + run: mvn package -s .github/workflows/settings.xml |
| 45 | + - name: Sonar Scan |
| 46 | + env: |
| 47 | + SONAR_TOKEN: ${{ secrets.ENTUR_SONAR_PASSWORD }} |
| 48 | + SONAR_PROJECT_NAME: ${{ github.event.repository.name }} |
| 49 | + SONAR_PROJECT_KEY: entur_${{ github.event.repository.name }} |
| 50 | + run: | |
| 51 | + mvn -Psonar -s .github/workflows/settings.xml \ |
| 52 | + org.jacoco:jacoco-maven-plugin:prepare-agent verify \ |
| 53 | + org.jacoco:jacoco-maven-plugin:report sonar:sonar \ |
| 54 | + -Dmaven.main.skip \ |
| 55 | + -DskipTests \ |
| 56 | + -Dsonar.projectKey=${SONAR_PROJECT_KEY} \ |
| 57 | + -Dsonar.organization=enturas-github \ |
| 58 | + -Dsonar.projectName=${SONAR_PROJECT_NAME} \ |
| 59 | + -Dsonar.host.url=https://sonarcloud.io \ |
| 60 | + -Dsonar.token=${SONAR_TOKEN} |
| 61 | +
|
0 commit comments