opentelemetry-java-instrume.../.github/workflows/pr.yml

258 lines
8.0 KiB
YAML

name: PR build
on: pull_request
concurrency:
group: ci-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- name: Set up JDK 11 for running Gradle
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 11
- name: Start deadlock detector
run: .github/scripts/deadlock-detector.sh
- name: Build
uses: gradle/gradle-build-action@v2
with:
# javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
arguments: build -x javadoc
cache-read-only: true
- name: Upload deadlock detector artifacts if any
if: always()
uses: actions/upload-artifact@v2
with:
name: deadlock-detector-build
path: /tmp/deadlock-detector-*
if-no-files-found: ignore
- name: Upload jvm crash dump files if any
if: always()
uses: actions/upload-artifact@v2
with:
name: javacore-build
path: |
"**/hs_err_pid*.log"
"**/javacore.*.txt"
"**/Snap.*.trc"
"**/core.*.dmp"
"**/jitdump.*.dmp"
if-no-files-found: ignore
build-gradle-plugins:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- name: Set up JDK 11 for running Gradle
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 11
- name: Build
uses: gradle/gradle-build-action@v2
with:
cache-read-only: true
arguments: build
build-root-directory: gradle-plugins
test:
runs-on: ubuntu-latest
strategy:
matrix:
test-java-version:
- 8
- 11
- 15
vm:
- hotspot
- openj9
fail-fast: false
steps:
- uses: actions/checkout@v2.3.4
- id: setup-test-java
name: Set up JDK ${{ matrix.test-java-version }}-${{ matrix.vm }} for running tests
uses: actions/setup-java@v2
with:
distribution: adopt-${{ matrix.vm }}
java-version: ${{ matrix.test-java-version }}
- name: Set up JDK 11 for running Gradle
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 11
- name: Start deadlock detector
run: .github/scripts/deadlock-detector.sh
- name: Test
uses: gradle/gradle-build-action@v2
with:
arguments: test -PtestJavaVersion=${{ matrix.test-java-version }} -PtestJavaVM=${{ matrix.vm }} -Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }} -Porg.gradle.java.installations.auto-download=false
cache-read-only: true
- name: Upload deadlock detector artifacts if any
if: always()
uses: actions/upload-artifact@v2
with:
name: deadlock-detector-test-${{ matrix.test-java-version }}
path: /tmp/deadlock-detector-*
if-no-files-found: ignore
- name: Upload jvm crash dump files if any
if: always()
uses: actions/upload-artifact@v2
with:
name: javacore-test-${{ matrix.test-java-version }}
path: |
"**/hs_err_pid*.log"
"**/javacore.*.txt"
"**/Snap.*.trc"
"**/core.*.dmp"
"**/jitdump.*.dmp"
if-no-files-found: ignore
testLatestDeps:
# testLatestDeps is not included in the PR workflow by default
# because any time a new library version is released to maven central
# it can fail due to test code incompatibility with the new library version,
# or due to slight changes in emitted telemetry, which can be confusing for contributors
# (muzzle can also fail when a new library version is released to maven central
# but that happens much less often)
#
# the condition is on the steps below instead of here on the job, because skipping the job
# causes the job to show up as canceled in the GitHub UI which prevents the build section from
# collapsing when everything (else) is green
#
# and the name is updated when the steps below are skipped which makes what's happening clearer
# in the GitHub UI
name: testLatestDeps${{ !contains(github.event.pull_request.labels.*.name, 'test latest deps') && ' (skipped)' || ''}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- name: Set up JDK 11 for running Gradle
if: ${{ contains(github.event.pull_request.labels.*.name, 'test latest deps') }}
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 11
- name: Test
if: ${{ contains(github.event.pull_request.labels.*.name, 'test latest deps') }}
uses: gradle/gradle-build-action@v2
with:
arguments: test -PtestLatestDeps=true
cache-read-only: true
smoke-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- windows-2019
- ubuntu-latest
smoke-test-suite:
- jetty
- liberty
- payara
- tomcat
- tomee
- websphere
- wildfly
- other
exclude:
- os: windows-2019
smoke-test-suite: websphere
fail-fast: false
steps:
- name: Support longpaths
run: git config --system core.longpaths true
if: matrix.os == 'windows-2019'
- uses: actions/checkout@v2.3.4
- name: Set up JDK 11 for running Gradle
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 11
- name: Test
uses: gradle/gradle-build-action@v2
with:
cache-read-only: true
arguments: ":smoke-tests:test -PsmokeTestSuite=${{ matrix.smoke-test-suite }}"
muzzle:
# release branches are excluded
# because any time a new library version is released to maven central it can fail
# which requires unnecessary release branch maintenance, especially for patches
if: ${{ !startsWith(github.base_ref, 'v') }}
uses: ./.github/workflows/muzzle.yml
examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- name: Set up JDK 11 for running Gradle
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 11
- name: Set up gradle cache
uses: gradle/gradle-build-action@v2
with:
cache-read-only: true
- name: Local publish of artifacts
# javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
run: ./gradlew publishToMavenLocal -x javadoc
- name: Local publish of gradle plugins
# javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
run: ./gradlew publishToMavenLocal -x javadoc
working-directory: gradle-plugins
- name: Build distro
run: ./gradlew build --init-script ../../.github/scripts/local.init.gradle.kts
working-directory: examples/distro
- name: Build extension
run: ./gradlew build --init-script ../../.github/scripts/local.init.gradle.kts
working-directory: examples/extension
- name: Run muzzle check against extension
run: ./gradlew muzzle --init-script ../../.github/scripts/local.init.gradle.kts
working-directory: examples/extension
# markdown-link-check is not included in the PR build because links to external urls can break at
# any time, which can be confusing for contributors
accept-pr:
needs: [ build, test, smoke-test, muzzle, examples ]
runs-on: ubuntu-latest
if: always()
steps:
# run this action to get workflow conclusion
# You can get conclusion by env (env.WORKFLOW_CONCLUSION)
- uses: technote-space/workflow-conclusion-action@v2.2
- name: Fail build
if: env.WORKFLOW_CONCLUSION == 'failure' # notify only if failure
run: exit 1