Skip to content

Commit

Permalink
setup OSSF Scorecard workflow (#10224)
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu MOREL <[email protected]>
  • Loading branch information
mmorel-35 authored Jan 17, 2024
1 parent 9ec6401 commit 5a49eb0
Show file tree
Hide file tree
Showing 24 changed files with 220 additions and 101 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/auto-update-otel-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
latest-version: ${{ steps.check-versions.outputs.latest-version }}
already-opened: ${{ steps.check-versions.outputs.already-opened }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- id: check-versions
name: Check versions
Expand Down Expand Up @@ -43,14 +43,16 @@ jobs:
echo "already-opened=$already_opened" >> $GITHUB_OUTPUT
update-otel-sdk:
permissions:
contents: write # for Git to git push
runs-on: ubuntu-latest
if: |
needs.check-versions.outputs.current-version != needs.check-versions.outputs.latest-version &&
needs.check-versions.outputs.already-opened != 'true'
needs:
- check-versions
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Update version
env:
Expand All @@ -64,13 +66,13 @@ jobs:
run: .github/scripts/gha-free-disk-space.sh

- name: Set up JDK for running Gradle
uses: actions/setup-java@v4
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
distribution: temurin
java-version: 17.0.6

- name: Update license report
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@982da8e78c05368c70dac0351bb82647a9e9a5d2 # v2.11.1
with:
arguments: generateLicenseReport

Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ on:
description: "The pull request # to backport"
required: true

permissions:
contents: read

jobs:
backport:
permissions:
contents: write # for Git to git push
runs-on: ubuntu-latest
steps:
- run: |
Expand All @@ -16,7 +21,7 @@ jobs:
exit 1
fi
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
# history is needed to run git cherry-pick below
fetch-depth: 0
Expand Down
67 changes: 35 additions & 32 deletions .github/workflows/build-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,26 @@ on:
GE_CACHE_PASSWORD:
required: false

permissions:
contents: read

jobs:
spotless:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Free disk space
run: .github/scripts/gha-free-disk-space.sh

- name: Set up JDK for running Gradle
uses: actions/setup-java@v4
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
distribution: temurin
java-version: 17.0.6

- name: Spotless
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@982da8e78c05368c70dac0351bb82647a9e9a5d2 # v2.11.1
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
Expand All @@ -53,26 +56,26 @@ jobs:
gradle-wrapper-validation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- uses: gradle/[email protected]
- uses: gradle/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4 # v1.1.0

license-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Free disk space
run: .github/scripts/gha-free-disk-space.sh

- name: Set up JDK for running Gradle
uses: actions/setup-java@v4
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
distribution: temurin
java-version: 17.0.6

- name: Generate license report
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@982da8e78c05368c70dac0351bb82647a9e9a5d2 # v2.11.1
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
Expand Down Expand Up @@ -107,7 +110,7 @@ jobs:
extra-dependency-management-enforcement:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Dependency check
run: |
Expand All @@ -130,13 +133,13 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Free disk space
run: .github/scripts/gha-free-disk-space.sh

- name: Set up JDK for running Gradle
uses: actions/setup-java@v4
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
distribution: temurin
java-version: 17.0.6
Expand All @@ -146,7 +149,7 @@ jobs:
sed -i "s/org.gradle.jvmargs=/org.gradle.jvmargs=-Xmx3g /" gradle.properties
- name: Build
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@982da8e78c05368c70dac0351bb82647a9e9a5d2 # v2.11.1
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
Expand All @@ -173,7 +176,7 @@ jobs:
fi
- name: Upload agent jar
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0
with:
path: javaagent/build/libs/opentelemetry-javaagent-*-SNAPSHOT.jar

Expand Down Expand Up @@ -201,34 +204,34 @@ jobs:
vm: openj9
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Free disk space
run: .github/scripts/gha-free-disk-space.sh

- id: setup-test-java
name: Set up JDK ${{ matrix.test-java-version }}-${{ matrix.vm }} for running tests
uses: actions/setup-java@v4
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
# using zulu because new releases get published quickly
distribution: ${{ matrix.vm == 'hotspot' && 'zulu' || 'adopt-openj9'}}
java-version: ${{ matrix.test-java-version }}

- name: Set up JDK for running Gradle
uses: actions/setup-java@v4
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
distribution: temurin
java-version: 17.0.6

# vaadin 14 tests fail with node 18
- name: Set up Node
uses: actions/setup-node@v4
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
with:
node-version: 16

# vaadin tests use pnpm
- name: Cache pnpm modules
uses: actions/cache@v3
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-test-cache-pnpm-modules
Expand All @@ -241,7 +244,7 @@ jobs:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@982da8e78c05368c70dac0351bb82647a9e9a5d2 # v2.11.1
with:
# "check" is needed to activate all tests for listing purposes
# listTestsInPartition writes test tasks that apply to the given partition to a file named
Expand All @@ -261,7 +264,7 @@ jobs:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@982da8e78c05368c70dac0351bb82647a9e9a5d2 # v2.11.1
with:
# spotless is checked separately since it's a common source of failure
arguments: >
Expand All @@ -278,15 +281,15 @@ jobs:

- name: Upload deadlock detector artifacts if any
if: failure()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0
with:
name: deadlock-detector-test-${{ matrix.test-java-version }}-${{ matrix.vm }}-${{ matrix.test-partition }}
path: /tmp/deadlock-detector-*
if-no-files-found: ignore

- name: Upload jvm crash dump files if any
if: failure()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0
with:
name: javacore-test-${{ matrix.test-java-version }}-${{ matrix.test-partition }}
path: |
Expand Down Expand Up @@ -323,19 +326,19 @@ jobs:
run: git config --system core.longpaths true
if: matrix.os == 'windows-latest'

- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Free disk space
run: .github/scripts/gha-free-disk-space.sh

- name: Set up JDK for running Gradle
uses: actions/setup-java@v4
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
distribution: temurin
java-version: 17.0.6

- name: Set up Gradle cache
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@982da8e78c05368c70dac0351bb82647a9e9a5d2 # v2.11.1
with:
# only push cache for one matrix option per OS since github action cache space is limited
cache-read-only: ${{ inputs.cache-read-only || matrix.smoke-test-suite != 'tomcat' }}
Expand All @@ -359,7 +362,7 @@ jobs:

- name: Upload jvm crash dump files if any
if: failure()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0
with:
name: javacore-smoke-test-${{ matrix.smoke-test-suite }}-${{ matrix.os }}
# we expect crash dumps either in root director or in smoke-tests
Expand All @@ -380,19 +383,19 @@ jobs:
gradle-plugins:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Free disk space
run: .github/scripts/gha-free-disk-space.sh

- name: Set up JDK for running Gradle
uses: actions/setup-java@v4
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
distribution: temurin
java-version: 17.0.6

- name: Build
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@982da8e78c05368c70dac0351bb82647a9e9a5d2 # v2.11.1
with:
arguments: build ${{ inputs.no-build-cache && '--no-build-cache' || '' }}
build-root-directory: gradle-plugins
Expand All @@ -401,19 +404,19 @@ jobs:
examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Free disk space
run: .github/scripts/gha-free-disk-space.sh

- name: Set up JDK for running Gradle
uses: actions/setup-java@v4
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
distribution: temurin
java-version: 17.0.6

- name: Set up Gradle cache
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@982da8e78c05368c70dac0351bb82647a9e9a5d2 # v2.11.1
with:
cache-read-only: ${{ inputs.cache-read-only }}

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ jobs:
# skipping release branches because the versions in those branches are not snapshots
if: github.ref_name == 'main' && github.repository == 'open-telemetry/opentelemetry-java-instrumentation'
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Free disk space
run: .github/scripts/gha-free-disk-space.sh

- name: Set up JDK for running Gradle
uses: actions/setup-java@v4
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
distribution: temurin
java-version: 17.0.6
Expand All @@ -83,7 +83,7 @@ jobs:
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@982da8e78c05368c70dac0351bb82647a9e9a5d2 # v2.11.1
with:
arguments: assemble publishToSonatype
# gradle enterprise is used for the build cache
Expand All @@ -96,7 +96,7 @@ jobs:
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@982da8e78c05368c70dac0351bb82647a9e9a5d2 # v2.11.1
with:
build-root-directory: gradle-plugins
arguments: build publishToSonatype
Expand Down
Loading

0 comments on commit 5a49eb0

Please sign in to comment.