|
| 1 | +name: CI Pipeline |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - "**" |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + name: Build |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - name: Checkout Code |
| 17 | + uses: actions/checkout@v3 |
| 18 | + - name: Set up Java |
| 19 | + uses: actions/setup-java@v4 |
| 20 | + with: |
| 21 | + distribution: "graalvm" |
| 22 | + java-version: "21" |
| 23 | + - name: Cache Gradle Packages |
| 24 | + uses: actions/cache@v4 |
| 25 | + with: |
| 26 | + path: ~/.gradle/caches |
| 27 | + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} |
| 28 | + - name: Build Project |
| 29 | + run: ./gradlew assemble |
| 30 | + env: |
| 31 | + GRADLE_OPTS: "-Dorg.gradle.daemon=false" |
| 32 | + |
| 33 | + pmd: |
| 34 | + name: PMD Analysis |
| 35 | + runs-on: ubuntu-latest |
| 36 | + needs: build |
| 37 | + steps: |
| 38 | + - name: Checkout Code |
| 39 | + uses: actions/checkout@v3 |
| 40 | + - name: Set up Java |
| 41 | + uses: actions/setup-java@v4 |
| 42 | + with: |
| 43 | + distribution: "graalvm" |
| 44 | + java-version: "21" |
| 45 | + - name: Cache Gradle Packages |
| 46 | + uses: actions/cache@v4 |
| 47 | + with: |
| 48 | + path: ~/.gradle/caches |
| 49 | + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} |
| 50 | + - name: Run PMD Analysis |
| 51 | + run: ./gradlew pmdMain |
| 52 | + |
| 53 | + checkstyle: |
| 54 | + name: Checkstyle Analysis |
| 55 | + runs-on: ubuntu-latest |
| 56 | + needs: build |
| 57 | + steps: |
| 58 | + - name: Checkout Code |
| 59 | + uses: actions/checkout@v3 |
| 60 | + - name: Set up Java |
| 61 | + uses: actions/setup-java@v4 |
| 62 | + with: |
| 63 | + distribution: "graalvm" |
| 64 | + java-version: "21" |
| 65 | + - name: Cache Gradle Packages |
| 66 | + uses: actions/cache@v4 |
| 67 | + with: |
| 68 | + path: ~/.gradle/caches |
| 69 | + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} |
| 70 | + - name: Run Checkstyle |
| 71 | + run: ./gradlew checkstyleMain |
| 72 | + |
| 73 | + unit-test: |
| 74 | + name: Unit Tests |
| 75 | + runs-on: ubuntu-latest |
| 76 | + needs: build |
| 77 | + steps: |
| 78 | + - name: Checkout Code |
| 79 | + uses: actions/checkout@v3 |
| 80 | + - name: Set up Java |
| 81 | + uses: actions/setup-java@v4 |
| 82 | + with: |
| 83 | + distribution: "graalvm" |
| 84 | + java-version: "21" |
| 85 | + - name: Cache Gradle Packages |
| 86 | + uses: actions/cache@v4 |
| 87 | + with: |
| 88 | + path: ~/.gradle/caches |
| 89 | + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} |
| 90 | + - name: Run Unit Tests |
| 91 | + run: ./gradlew test |
| 92 | + |
| 93 | + integration-test: |
| 94 | + name: Integration Tests |
| 95 | + runs-on: ubuntu-latest |
| 96 | + needs: build |
| 97 | + # Do not run since integration tests are not working |
| 98 | + if: false |
| 99 | + steps: |
| 100 | + - name: Checkout Code |
| 101 | + uses: actions/checkout@v3 |
| 102 | + - name: Set up Java |
| 103 | + uses: actions/setup-java@v4 |
| 104 | + with: |
| 105 | + distribution: "graalvm" |
| 106 | + java-version: "21" |
| 107 | + - name: Cache Gradle Packages |
| 108 | + uses: actions/cache@v4 |
| 109 | + with: |
| 110 | + path: ~/.gradle/caches |
| 111 | + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} |
| 112 | + - name: Run Integration Tests |
| 113 | + run: ./gradlew integrationTest |
| 114 | + - uses: actions/upload-artifact@v4 # upload test results |
| 115 | + if: success() || failure() # run this step even if previous step failed |
| 116 | + with: |
| 117 | + name: test-results-integration |
| 118 | + path: build/reports/tests/integrationTest/index.html |
| 119 | + |
| 120 | + # Combine test reports if needed |
| 121 | + test-report: |
| 122 | + name: Test Report |
| 123 | + runs-on: ubuntu-latest |
| 124 | + # Do not run since integration tests are not working |
| 125 | + if: false |
| 126 | + needs: [unit-test, integration-test] |
| 127 | + steps: |
| 128 | + - uses: dorny/test-reporter@v1 |
| 129 | + with: |
| 130 | + artifact: /test-results-(.*)/ # artifact name |
| 131 | + name: java-junit # Name of the check run which will be created |
| 132 | + path: "*.html" # Path to test results (inside artifact .zip) |
| 133 | + reporter: jest-junit # Format of test results |
| 134 | + |
| 135 | + test: |
| 136 | + name: test end node |
| 137 | + runs-on: ubuntu-latest |
| 138 | + needs: [build, pmd, checkstyle, unit-test] |
| 139 | + steps: |
| 140 | + - run: echo "finished test stage" # this is a indirection to the previous test steps |
| 141 | + |
| 142 | + docker-image-native: |
| 143 | + name: Docker image native |
| 144 | + if: github.event_name == 'push' && github.ref_name == 'main' |
| 145 | + needs: [test] |
| 146 | + runs-on: ubuntu-latest |
| 147 | + steps: |
| 148 | + - name: Checkout Code |
| 149 | + uses: actions/checkout@v3 |
| 150 | + - name: Build and Push Image |
| 151 | + uses: ./.github/actions/build-and-deploy-quarkus-native |
| 152 | + with: |
| 153 | + platforms: "linux/amd64,linux/arm64/v8" |
| 154 | + docker-username: ${{ secrets.DOCKER_USERNAME }} |
| 155 | + docker-password: ${{ secrets.DOCKER_PASSWORD }} |
| 156 | + image-name: ${{ vars.DOCKER_NATIVE_IMAGE_NAME }} |
| 157 | + image-tag: "latest" |
| 158 | + |
| 159 | + docker-image-jvm: |
| 160 | + name: Docker image JVM |
| 161 | + if: github.event_name == 'push' && github.ref_name == 'main' |
| 162 | + needs: [test] |
| 163 | + runs-on: ubuntu-latest |
| 164 | + steps: |
| 165 | + - name: Checkout Code |
| 166 | + uses: actions/checkout@v3 |
| 167 | + - name: Build and Push Image |
| 168 | + uses: ./.github/actions/build-and-deploy-quarkus-jvm |
| 169 | + with: |
| 170 | + platforms: "linux/amd64,linux/arm64/v8" |
| 171 | + docker-username: ${{ secrets.DOCKER_USERNAME }} |
| 172 | + docker-password: ${{ secrets.DOCKER_PASSWORD }} |
| 173 | + image-name: ${{ vars.DOCKER_JVM_IMAGE_NAME }} |
| 174 | + image-tag: "latest" |
0 commit comments