name: CI Pipeline on: push: branches: - develop - 'feature**' pull_request: branches: - develop create: tags: - '*' jobs: build: runs-on: ubuntu-latest container: image: maven:3-amazoncorretto-17-alpine steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 # Full history for SonarCloud - name: Cache Maven packages uses: actions/cache@v4 with: path: ~/.m2 key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-m2 - name: Build with Maven run: | echo "Running package..." mvn clean package # - name: Prepare Pages (javadoc) # run: | # echo "Preparing Pages from docs/ (javadoc)" # mkdir -p public # cp -rv docs/* public/ || true # mkdir -p public/apidocs # cp -rv target/reports/apidocs public/ || true - name: Upload build artifacts uses: actions/upload-artifact@v4 with: name: build-artifacts path: | target/ public/ - name: Upload test reports uses: actions/upload-artifact@v4 if: always() with: name: test-reports path: target/surefire-reports/*.xml on_commits: runs-on: ubuntu-latest needs: build if: | github.event_name == 'pull_request' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/feature') steps: - name: On commit actions run: echo "on_commit DONE" # sonarcloud_scan: # runs-on: ubuntu-latest # container: # image: maven:3-amazoncorretto-17-alpine # needs: build # if: | # github.event_name == 'pull_request' || # github.ref == 'refs/heads/develop' || # startsWith(github.ref, 'refs/tags/') # # steps: # - name: Checkout code # uses: actions/checkout@v4 # with: # fetch-depth: 0 # # - name: Cache Maven packages # uses: actions/cache@v4 # with: # path: ~/.m2 # key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} # restore-keys: ${{ runner.os }}-m2 # # - name: Cache SonarCloud packages # uses: actions/cache@v4 # with: # path: .sonar/cache # key: ${{ runner.os }}-sonar # restore-keys: ${{ runner.os }}-sonar # # - name: Download build artifacts # uses: actions/download-artifact@v4 # with: # name: build-artifacts # path: . # # - name: SonarCloud Scan # env: # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} # run: | # mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \ # -Dsonar.projectKey=th-schwarz_CloudflareDNS-java \ # -Dsonar.organization=th-schwarz \ # -Dsonar.host.url=${SONAR_HOST_URL}