|
| 1 | +# This workflow uses actions that are not certified by GitHub. |
| 2 | +# They are provided by a third-party and are governed by |
| 3 | +# separate terms of service, privacy policy, and support |
| 4 | +# documentation. |
| 5 | +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time |
| 6 | +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle |
| 7 | + |
| 8 | +name: Release Pipeline |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v2 |
| 16 | + |
| 17 | + - name: Set up JDK 11 |
| 18 | + uses: actions/setup-java@v2 |
| 19 | + with: |
| 20 | + java-version: '11' |
| 21 | + distribution: 'microsoft' |
| 22 | + |
| 23 | + - name: set JDK_11 environment variable test compiling and running |
| 24 | + env: |
| 25 | + ACTIONS_ALLOW_UNSECURE_COMMANDS: true |
| 26 | + run: echo ::set-env name=JDK_11::$(echo $JAVA_HOME) |
| 27 | + |
| 28 | + - name: Set up JDK 8 |
| 29 | + uses: actions/setup-java@v2 |
| 30 | + with: |
| 31 | + java-version: '8' |
| 32 | + distribution: 'temurin' |
| 33 | + |
| 34 | + - name: Setup Gradle |
| 35 | + uses: gradle/gradle-build-action@v2 |
| 36 | + |
| 37 | + - name: Build with Gradle |
| 38 | + run: ./gradlew build -x test |
| 39 | + |
| 40 | + - name: Run SpotBugs |
| 41 | + run: ./gradlew spotbugsMain spotbugsTest |
| 42 | + continue-on-error: false |
| 43 | + |
| 44 | + - name: Upload SpotBugs reports |
| 45 | + uses: actions/upload-artifact@v4 |
| 46 | + with: |
| 47 | + name: SpotBugs Reports |
| 48 | + path: '**/build/reports/spotbugs' |
| 49 | + if-no-files-found: ignore |
| 50 | + |
| 51 | + - name: Run Unit Tests with Gradle |
| 52 | + run: | |
| 53 | + export JAVA_HOME=$JDK_11 |
| 54 | + ./gradlew clean test || echo "UNIT_TEST_FAILED=true" >> $GITHUB_ENV |
| 55 | + continue-on-error: true |
| 56 | + |
| 57 | + - name: Upload test reports if tests failed |
| 58 | + if: env.UNIT_TEST_FAILED == 'true' |
| 59 | + uses: actions/upload-artifact@v4 |
| 60 | + with: |
| 61 | + name: Unit Test Reports |
| 62 | + path: '**/build/reports/tests/test' |
| 63 | + if-no-files-found: ignore # Prevents errors if no reports exist |
| 64 | + |
| 65 | + - name: Fail the job if unit tests failed |
| 66 | + if: env.UNIT_TEST_FAILED == 'true' |
| 67 | + run: exit 1 |
| 68 | + |
| 69 | + # TODO: Move the sidecar into a central image repository |
| 70 | + - name: Initialize Durable Task Sidecar |
| 71 | + run: docker run --name durabletask-sidecar -p 4001:4001 --env 'DURABLETASK_SIDECAR_LOGLEVEL=Debug' -d peterstone2019/durabletask-sidecar:latest start --backend Emulator |
| 72 | + |
| 73 | + - name: Display Durable Task Sidecar Logs |
| 74 | + run: nohup docker logs --since=0 durabletask-sidecar > durabletask-sidecar.log 2>&1 & |
| 75 | + |
| 76 | + # wait for 10 seconds, so sidecar container can be fully up, this will avoid intermittent failing issues for integration tests causing by failed to connect to sidecar |
| 77 | + - name: Wait for 10 seconds |
| 78 | + run: sleep 10 |
| 79 | + |
| 80 | + - name: Integration Tests with Gradle |
| 81 | + run: ./gradlew integrationTest || echo "TEST_FAILED=true" >> $GITHUB_ENV |
| 82 | + continue-on-error: true |
| 83 | + |
| 84 | + - name: Kill Durable Task Sidecar |
| 85 | + run: docker kill durabletask-sidecar |
| 86 | + |
| 87 | + - name: Upload Durable Task Sidecar Logs |
| 88 | + uses: actions/upload-artifact@v4 |
| 89 | + with: |
| 90 | + name: Durable Task Sidecar Logs |
| 91 | + path: durabletask-sidecar.log |
| 92 | + |
| 93 | + - name: Archive test report |
| 94 | + uses: actions/upload-artifact@v4 |
| 95 | + with: |
| 96 | + name: Integration test report |
| 97 | + path: client/build/reports/tests/integrationTest |
| 98 | + |
| 99 | + - name: Upload JAR output |
| 100 | + uses: actions/upload-artifact@v4 |
| 101 | + with: |
| 102 | + name: Package |
| 103 | + path: client/build/libs |
| 104 | + |
| 105 | + - name: Fail the job if tests failed |
| 106 | + if: env.TEST_FAILED == 'true' |
| 107 | + run: exit 1 |
| 108 | + |
| 109 | + - name: Publish to local |
| 110 | + run: ./gradlew publishToMaven |
0 commit comments