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

134 lines
5.1 KiB
YAML

name: CI build
on:
push:
branches:
- main
- v[0-9]+.[0-9]+.x
workflow_dispatch:
jobs:
build:
uses: ./.github/workflows/reusable-build.yml
secrets:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
test:
uses: ./.github/workflows/reusable-test.yml
secrets:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
testLatestDeps:
# 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.ref_name, 'v') }}
uses: ./.github/workflows/reusable-test-latest-deps.yml
secrets:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
smoke-test:
uses: ./.github/workflows/reusable-smoke-test.yml
secrets:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
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.ref_name, 'v') }}
uses: ./.github/workflows/reusable-muzzle.yml
examples:
uses: ./.github/workflows/reusable-examples.yml
markdown-link-check:
# release branches are excluded
# because links to external urls can break at any time which requires unnecessary release branch
# maintenance, especially for patches (and also because the README.md javaagent download link
# has to be updated on release branches before the release download has been published)
if: ${{ !startsWith(github.ref_name, 'v') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check markdown links
# using retry because of sporadic external site failures
uses: nick-invision/retry@v2.6.0
with:
# timing out has not been a problem
timeout_minutes: 15
# give external site some time to hopefully recover
retry_wait_seconds: 120
max_attempts: 5
command: |
npm install -g markdown-link-check
find . -type f \
-name '*.md' \
-not -path './.github/*' \
-not -path './node_modules/*' \
-print0 \
| xargs -0 -n1 markdown-link-check --config .github/scripts/markdown_link_check_config.json
markdown-misspell-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check markdown for common misspellings
run: |
curl -L -o ./install-misspell.sh https://git.io/misspell
sh ./install-misspell.sh
./bin/misspell -error ./**/*
snapshot:
runs-on: ubuntu-latest
# intentionally not blocking snapshot publishing on testLatestDeps
# 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
#
# also not blocking snapshot publishing on markdown-link-check because links to external urls
# can break at any time
needs: [ build, test, smoke-test, examples, muzzle, markdown-misspell-check ]
if: ${{ github.ref_name == 'main' && github.repository == 'open-telemetry/opentelemetry-java-instrumentation' }}
steps:
- uses: actions/checkout@v3
- name: Set up JDK for running Gradle
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 17
- name: Build and publish artifact snapshots
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
uses: gradle/gradle-build-action@v2
with:
arguments: assemble publishToSonatype
- name: Build and publish gradle plugin snapshots
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
uses: gradle/gradle-build-action@v2
with:
arguments: build publishToSonatype
build-root-directory: gradle-plugins