diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 77c3b86fc..f61e895ee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,68 +18,35 @@ concurrency: jobs: build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Set up JDK for running Gradle - uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 - with: - distribution: temurin - java-version: 17 - - - name: Set up gradle - uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1 - with: - cache-read-only: ${{ github.event_name == 'pull_request' }} - - name: Gradle build and test - run: ./gradlew build -x test - - test: - name: test (${{ matrix.test-java-version }}) runs-on: ubuntu-latest strategy: matrix: - test-java-version: + dummy1: + - 1 + - 2 + - 3 + - 4 + - 5 + - 6 + - 7 - 8 - - 11 - - 17 - - 21 - - 23 + - 9 + - 10 + dummy2: + - 1 + - 2 + - 3 + - 4 + - 5 + - 6 + - 7 + - 8 + - 9 + - 10 fail-fast: false steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - id: setup-test-java - name: Set up JDK ${{ matrix.test-java-version }} for running tests - uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 - with: - # using zulu because new releases get published quickly - distribution: zulu - java-version: ${{ matrix.test-java-version }} - - - name: Set up JDK for running Gradle - uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 - with: - distribution: temurin - java-version: 17 - - - name: Set up gradle - uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1 - with: - cache-read-only: ${{ github.event_name == 'pull_request' }} - - name: Gradle test - run: > - ./gradlew test - -PtestJavaVersion=${{ matrix.test-java-version }} - -Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }} - -Porg.gradle.java.installations.auto-download=false - - integration-test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Set up JDK for running Gradle uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 with: @@ -91,90 +58,7 @@ jobs: with: cache-read-only: ${{ github.event_name == 'pull_request' }} - - name: Integration test - run: ./gradlew integrationTest - - - name: Save integration test results - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - if: always() - with: - name: integration-test-results - path: jmx-metrics/build/reports/tests/integrationTest - - markdown-link-check: - uses: ./.github/workflows/reusable-markdown-link-check.yml - - markdown-lint-check: - uses: ./.github/workflows/reusable-markdown-lint.yml - - misspell-check: - uses: ./.github/workflows/reusable-misspell-check.yml - - shell-script-check: - uses: ./.github/workflows/reusable-shell-script-check.yml - - publish-snapshots: - # 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 PR 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 - # - # note: the condition below has to be written so that '' is last since it resolves to false - # and so would not short-circuit if used in the second-last position - name: publish-snapshots${{ (github.ref_name != 'main' || github.repository != 'open-telemetry/opentelemetry-java-contrib') && ' (skipped)' || '' }} - needs: - # intentionally not blocking snapshot publishing on markdown-link-check or misspell-check - - build - - integration-test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Set up JDK for running Gradle - uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 - with: - distribution: temurin - java-version: 17 - - - name: Set up gradle - uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1 - # skipping release branches because the versions in those branches are not snapshots - # (also this skips pull requests) - if: ${{ github.ref_name == 'main' && github.repository == 'open-telemetry/opentelemetry-java-contrib' }} - - name: Build and publish snapshots - if: ${{ github.ref_name == 'main' && github.repository == 'open-telemetry/opentelemetry-java-contrib' }} - run: ./gradlew assemble publishToSonatype - env: - SONATYPE_USER: ${{ secrets.SONATYPE_USER }} - SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }} - GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} - GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }} - - required-status-check: - if: (github.event_name == 'pull_request' || github.event_name == 'merge_group') && always() - needs: - - build - - test - - integration-test - - markdown-lint-check - - misspell-check - - shell-script-check - runs-on: ubuntu-latest - steps: - # only the build and test checks are required for release branch PRs in order - # to avoid any unnecessary release branch maintenance (especially for patches) - - if: | - needs.build.result != 'success' || - needs.test.result != 'success' || - needs.integration-test.result != 'success' || - ( - !startsWith(github.base_ref, 'release/') && - ( - needs.markdown-lint-check.result != 'success' || - needs.misspell-check.result != 'success' || - needs.shell-script-check.result != 'success' - ) - ) - run: exit 1 # fail + - name: Gradle build and test +# env: +# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./gradlew build -x test diff --git a/opamp-client/build.gradle.kts b/opamp-client/build.gradle.kts index 0e33a87a6..aa5316b4a 100644 --- a/opamp-client/build.gradle.kts +++ b/opamp-client/build.gradle.kts @@ -22,6 +22,13 @@ val opampReleaseInfo = tasks.register("opampLastReleaseInfo") { group = "opamp" src("https://api.github.com/repos/open-telemetry/opamp-spec/releases/latest") dest(project.layout.buildDirectory.file("opamp/release.json")) + val token = System.getenv("GH_TOKEN") + if (token.isNullOrBlank()) { + logger.warn("No GitHub token found in environment variable GH_TOKEN. Rate limits may apply.") + } else { + header("Authorization", "Bearer $token") + header("X-GitHub-Api-Version", "2022-11-28") + } } val opampProtos = tasks.register("opampProtoDownload", download)