|
10 | 10 | name: build
|
11 | 11 |
|
12 | 12 | on: [push, pull_request, workflow_dispatch]
|
13 |
| -# workflow_dispatch should make manually triggered ci/cd possible |
14 |
| -# workflow file (like this) with `workflow_dispatch` after on should exist on the **master** or default branch, |
15 |
| -# or there will be no ui for a manual trigger. https://github.community/t/workflow-dispatch-event-not-working/128856/2 |
| 13 | + # workflow_dispatch should make manually triggered ci/cd possible |
| 14 | + # workflow file (like this) with `workflow_dispatch` after on should exist on the **master** or default branch, |
| 15 | + # or there will be no ui for a manual trigger. https://github.community/t/workflow-dispatch-event-not-working/128856/2 |
| 16 | + |
| 17 | +env: |
| 18 | + REPORTS_LOCATIONS: | |
| 19 | + pravega-sensor-collector/build/reports |
| 20 | +
|
16 | 21 |
|
17 | 22 | jobs:
|
18 | 23 | build:
|
19 | 24 | name: Build
|
20 | 25 | runs-on: ubuntu-20.04
|
21 | 26 | steps:
|
| 27 | + - name: Build Information |
| 28 | + run: echo Building a '${{ github.event_name }}' for target '${{ github.ref }}'. |
22 | 29 | - name: Checkout
|
23 | 30 | uses: actions/checkout@v2
|
24 |
| - |
25 |
| - - name: Set up JDK |
26 |
| - uses: actions/setup-java@v2 |
| 31 | + - uses: actions/setup-java@v2 |
27 | 32 | with:
|
28 |
| - distribution: 'zulu' |
29 |
| - java-version: '11' # major or semver Java version will be acceptable, see https://github.com/marketplace/actions/setup-java-jdk#basic |
30 |
| - |
31 |
| - - name: Build |
| 33 | + distribution: 'temurin' |
| 34 | + java-version: '11' |
| 35 | + - name: Test build-installer.sh |
32 | 36 | run: ./scripts/build-installer.sh
|
| 37 | + - name: Clean |
| 38 | + if: ${{ startsWith(github.ref, 'refs/heads/') }} |
| 39 | + run: ./gradlew clean ${{env.GRADLE_OPTS}} |
| 40 | + - name: Compile & Checkstyle |
| 41 | + run: ./gradlew jar compileTest checkstyleMain checkstyleTest --parallel ${{env.GRADLE_OPTS}} |
| 42 | + - name: Spotbugs |
| 43 | + run: ./gradlew spotbugsMain spotbugsTest |
| 44 | + - name: Tar Reports |
| 45 | + run: tar --use-compress-program zstd -cf reports-${{github.job}}.tzst `echo ${{env.REPORTS_LOCATIONS}}` |
| 46 | + - name: Upload Reports |
| 47 | + uses: actions/upload-artifact@v2 |
| 48 | + with: |
| 49 | + name: ${{github.job}}-reports |
| 50 | + retention-days: 4 |
| 51 | + path: reports-${{github.job}}.tzst |
| 52 | + # Uncomment these two lines if you need ssh access to debug a build. |
| 53 | + # - name: Setup upterm session |
| 54 | + # uses: lhotari/action-upterm@v1 |
| 55 | + |
| 56 | + |
| 57 | + unit_test: |
| 58 | + name: PSC Unit Tests |
| 59 | + needs: build |
| 60 | + runs-on: ubuntu-20.04 |
| 61 | + steps: |
| 62 | + - name: Checkout |
| 63 | + uses: actions/checkout@v2 |
| 64 | + - uses: actions/setup-java@v2 |
| 65 | + with: |
| 66 | + distribution: 'temurin' |
| 67 | + java-version: '11' |
| 68 | + - name: Unit tests |
| 69 | + run: ./gradlew pravega-sensor-collector:test --parallel ${{env.GRADLE_OPTS}} |
| 70 | + - name: Tar Reports |
| 71 | + run: tar --use-compress-program zstd -cf reports-${{github.job}}.tzst `echo ${{env.REPORTS_LOCATIONS}}` |
| 72 | + - name: Upload Reports |
| 73 | + if: always() |
| 74 | + uses: actions/upload-artifact@v2 |
| 75 | + with: |
| 76 | + name: ${{github.job}}-reports |
| 77 | + retention-days: 4 |
| 78 | + path: reports-${{github.job}}.tzst |
33 | 79 |
|
34 |
| - - name: Set env |
35 |
| - if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') |
36 |
| - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV |
37 | 80 |
|
38 |
| - - name: Release |
39 |
| - if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') |
40 |
| - uses: softprops/action-gh-release@v1 |
41 |
| - env: |
42 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 81 | + # DO NOT RENAME THIS JOB. Mergers to master branch are gated on this completing successfully. |
| 82 | + build_and_test_complete: |
| 83 | + name: CI Complete |
| 84 | + needs: [build, unit_test] |
| 85 | + runs-on: ubuntu-20.04 |
| 86 | + steps: |
| 87 | + - name: Check Build Status |
| 88 | + run: echo Build, static analysis, unit and integration tests successful. |
| 89 | + - name: Checkout |
| 90 | + uses: actions/checkout@v2 |
43 | 91 | with:
|
44 |
| - files: ./pravega-sensor-collector/build/distributions/pravega-sensor-collector-*.tgz |
45 |
| - draft: true |
46 |
| - name: pravega-sensor-collector ${{ env.RELEASE_VERSION }} |
| 92 | + fetch-depth: 2 |
| 93 | + - name: Download code coverage reports |
| 94 | + uses: actions/download-artifact@v2 |
| 95 | + - name: Untar reports |
| 96 | + run: ( ls */reports-*.tzst | xargs -n1 tar --use-compress-program zstd --keep-newer-files -xf ) |
| 97 | + - name: Upload to Codecov |
| 98 | + uses: codecov/codecov-action@v1 |
| 99 | + |
0 commit comments