opentelemetry-java-instrume.../.github/workflows/release-gradle-plugins.yml

158 lines
5.1 KiB
YAML

# Releases a new minor / major version of gradle plugins from a release branch
name: Release Gradle Plugins
on:
workflow_dispatch:
inputs:
release-branch-name:
description: The release branch to use, e.g. v1.9.x
required: true
version:
# TODO (trask) this is redundant
description: The version of the release, e.g. 1.9.0 (without the "v" prefix)
required: true
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
test-java-version:
- 8
- 11
- 15
steps:
- uses: actions/checkout@v2.3.4
with:
ref: ${{ github.event.inputs.release-branch-name }}
- id: setup-test-java
name: Set up JDK ${{ matrix.test-java-version }} for running tests
uses: actions/setup-java@v2
with:
distribution: adopt
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: Test
uses: gradle/gradle-build-action@v2
with:
arguments: test -PtestJavaVersion=${{ matrix.test-java-version }} -Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }} -Porg.gradle.java.installations.auto-download=false
# testLatestDeps is intentionally not included in the release workflows
# 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
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
steps:
- name: Support longpaths
run: git config --system core.longpaths true
if: matrix.os == 'windows-2019'
- uses: actions/checkout@v2.3.4
with:
ref: ${{ github.event.inputs.release-branch-name }}
- 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:
arguments: ":smoke-tests:test -PsmokeTestSuite=${{ matrix.smoke-test-suite }}"
# muzzle is intentionally not included in the release workflows
# because any time a new library version is released to maven central it can fail,
# and this is not a reason to hold up the release
examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
with:
ref: ${{ github.event.inputs.release-branch-name }}
- 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
- 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
release:
needs: [ test, smoke-test, examples ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
with:
ref: ${{ github.event.inputs.release-branch-name }}
- name: Set up JDK 11 for running Gradle
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 11
- name: Build and publish gradle plugins
uses: gradle/gradle-build-action@v2
env:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
with:
# Don't use publishToSonatype since we don't want to publish the marker artifact
arguments: build publishPlugins publishPluginMavenPublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository
build-root-directory: gradle-plugins