|
| 1 | +name: PR build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + runs-on: ${{ matrix.os }} |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + os: [ windows-latest, ubuntu-latest ] |
| 14 | + includeProfiler: [ false, true ] |
| 15 | + fail-fast: false |
| 16 | + steps: |
| 17 | + - name: Support longpaths |
| 18 | + run: git config --system core.longpaths true |
| 19 | + if: matrix.os == 'windows-latest' |
| 20 | + - name: Check out repository |
| 21 | + uses: actions/checkout@v2 |
| 22 | + with: |
| 23 | + fetch-depth: 0 |
| 24 | + - name: Set up Java 11 |
| 25 | + uses: actions/setup-java@v1 |
| 26 | + with: |
| 27 | + java-version: 11 |
| 28 | + - name: Init and update otel submodule |
| 29 | + run: | |
| 30 | + git submodule init |
| 31 | + git submodule update |
| 32 | + - name: Restore cache |
| 33 | + uses: burrunan/gradle-cache-action@v1 |
| 34 | + - name: Build otel-fork |
| 35 | + run: | |
| 36 | + cd otel |
| 37 | + # TODO why does this error only happen in GHA, without "-x signMavenPublication"? |
| 38 | + # "Cannot perform signing task ':instrumentation-api:signMavenPublication' because it has no configured signatory" |
| 39 | + ./gradlew publishToMavenLocal -x signMavenPublication |
| 40 | + - name: Test |
| 41 | + # TODO enable build cache, either --build-cache here, or org.gradle.caching=true in gradle.properties |
| 42 | + run: ./gradlew check -PincludeProfiler=${{ matrix.includeProfiler }} --stacktrace |
| 43 | + |
| 44 | + setup-smoke-test-matrix: |
| 45 | + runs-on: ubuntu-latest |
| 46 | + outputs: |
| 47 | + matrix: ${{ steps.set-matrix.outputs.matrix }} |
| 48 | + steps: |
| 49 | + - name: Check out repository |
| 50 | + uses: actions/checkout@v2 |
| 51 | + with: |
| 52 | + fetch-depth: 0 |
| 53 | + - name: Set up JDK 11 for running Gradle |
| 54 | + uses: actions/setup-java@v1 |
| 55 | + with: |
| 56 | + java-version: 11 |
| 57 | + - id: set-matrix |
| 58 | + # "grep -v skipWinNative" is used to skip the warning message "Skipping build of :etw:native because skipWinNative=true" |
| 59 | + run: echo "::set-output name=matrix::{\"module\":[\"$(./gradlew -q :test:smoke:testApps:listTestApps | grep -v skipWinNative | xargs echo | sed 's/ /","/g')\"]}" |
| 60 | + |
| 61 | + smoke-test: |
| 62 | + needs: setup-smoke-test-matrix |
| 63 | + runs-on: ubuntu-latest |
| 64 | + strategy: |
| 65 | + matrix: ${{fromJson(needs.setup-smoke-test-matrix.outputs.matrix)}} |
| 66 | + fail-fast: false |
| 67 | + steps: |
| 68 | + - name: Check out repository |
| 69 | + uses: actions/checkout@v2 |
| 70 | + with: |
| 71 | + fetch-depth: 0 |
| 72 | + - name: Set up Java 11 |
| 73 | + uses: actions/setup-java@v1 |
| 74 | + with: |
| 75 | + java-version: 11 |
| 76 | + - name: Init and update otel submodule |
| 77 | + run: | |
| 78 | + git submodule init |
| 79 | + git submodule update |
| 80 | + - name: Restore cache |
| 81 | + uses: burrunan/gradle-cache-action@v1 |
| 82 | + with: |
| 83 | + read-only: true |
| 84 | + - name: Build otel-fork |
| 85 | + run: | |
| 86 | + cd otel |
| 87 | + # TODO why does this error only happen in GHA, without "-x signMavenPublication"? |
| 88 | + # "Cannot perform signing task ':instrumentation-api:signMavenPublication' because it has no configured signatory" |
| 89 | + ./gradlew publishToMavenLocal -x signMavenPublication |
| 90 | + - name: Test |
| 91 | + # TODO enable build cache, either --build-cache here, or org.gradle.caching=true in gradle.properties |
| 92 | + run: ./gradlew ${{ matrix.module }}:smokeTest |
| 93 | + |
| 94 | + accept-pr: |
| 95 | + needs: [ build, smoke-test ] |
| 96 | + runs-on: ubuntu-latest |
| 97 | + if: always() |
| 98 | + steps: |
| 99 | + # run this action to get workflow conclusion |
| 100 | + # You can get conclusion by env (env.WORKFLOW_CONCLUSION) |
| 101 | + - uses: technote-space/workflow-conclusion-action@v2 |
| 102 | + - name: Fail build |
| 103 | + if: env.WORKFLOW_CONCLUSION == 'failure' # notify only if failure |
| 104 | + run: exit 1 |
0 commit comments