Skip to content

Commit e345310

Browse files
authored
Sync github actions, including release workflow (#274)
* Sync github actions, other than release actions * Add release workflow * Remove nebula * fix * Add missing workflow * Fix link * more * Updates * Sentence case * more
1 parent 36eae59 commit e345310

31 files changed

+633
-553
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"retryOn429": true
3+
}

.github/scripts/markdown_link_check_config.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

.github/templates/workflow-failed.md

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# assigns reviewers to pull requests in a similar way as CODEOWNERS, but doesn't require reviewers
2+
# to have write access to the repository
3+
# see .github/component_owners.yaml for the list of components and their owners
4+
name: Assign reviewers
5+
6+
on:
7+
# pull_request_target is needed instead of just pull_request
8+
# because repository write permission is needed to assign reviewers
9+
pull_request_target:
10+
11+
jobs:
12+
assign-reviewers:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: dyladan/component-owners@main
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Backport a pull request
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
number:
6+
description: "The pull request # to backport"
7+
required: true
8+
9+
jobs:
10+
backport:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
with:
15+
# history is needed in order to do cherry-pick
16+
fetch-depth: 0
17+
18+
- name: Set up git name
19+
run: |
20+
git config user.name opentelemetry-java-bot
21+
git config user.email [email protected]
22+
23+
- name: Create pull request
24+
env:
25+
NUMBER: ${{ github.event.inputs.number }}
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
run: |
28+
commit=$(gh pr view $NUMBER --json mergeCommit --jq .mergeCommit.oid)
29+
title=$(gh pr view $NUMBER --json title --jq .title)
30+
url=$(gh pr view $NUMBER --json url --jq .url)
31+
32+
git cherry-pick $commit
33+
git push origin HEAD:backport-$NUMBER-to-$GITHUB_REF_NAME
34+
35+
gh pr create --title "[$GITHUB_REF_NAME] $title" \
36+
--body "Clean cherry-pick of #$NUMBER to the $GITHUB_REF_NAME branch." \
37+
--head backport-$NUMBER-to-$GITHUB_REF_NAME \
38+
--base $GITHUB_REF_NAME
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
name: "PR Build"
1+
name: Build pull request
22

33
on:
44
pull_request:
5-
branches:
6-
- main
75

86
jobs:
97
build:
10-
name: build
118
runs-on: ubuntu-latest
129
steps:
1310
- uses: actions/checkout@v3
14-
with:
15-
fetch-depth: 0
1611

17-
- name: Setup Java 17
12+
- name: Set up JDK for running Gradle
1813
uses: actions/setup-java@v3
1914
with:
2015
distribution: temurin
@@ -34,42 +29,46 @@ jobs:
3429
path: jmx-metrics/build/reports/tests/test
3530

3631
integration-test:
37-
name: integration-test
3832
runs-on: ubuntu-latest
3933
steps:
4034
- uses: actions/checkout@v3
41-
with:
42-
fetch-depth: 0
4335

44-
- name: Setup Java 17
36+
- name: Set up JDK for running Gradle
4537
uses: actions/setup-java@v3
4638
with:
4739
distribution: temurin
4840
java-version: 17
4941

5042
- uses: gradle/gradle-build-action@v2
51-
name: Integration Tests
43+
name: Integration test
5244
with:
5345
arguments: --stacktrace integrationTest
5446
cache-read-only: true
5547

5648
- uses: actions/upload-artifact@v2
57-
name: Save integrationTest results
49+
name: Save integration test results
5850
if: always()
5951
with:
6052
name: integration-test-results
6153
path: jmx-metrics/build/reports/tests/integrationTest
6254

63-
# markdown-link-check is not included in the PR build because links to external urls can break at
64-
# any time, which can be confusing for contributors
55+
# this is not a required check to avoid blocking pull requests if external links break
56+
markdown-link-check:
57+
uses: ./.github/workflows/reusable-markdown-link-check.yml
58+
59+
# this is not a required check to avoid blocking pull requests if new misspellings are added
60+
# to the misspell dictionary
61+
misspell-check:
62+
uses: ./.github/workflows/reusable-misspell-check.yml
6563

66-
markdown-misspell-check:
64+
required-status-check:
65+
needs:
66+
- build
67+
- integration-test
6768
runs-on: ubuntu-latest
69+
if: always()
6870
steps:
69-
- uses: actions/checkout@v3
70-
71-
- name: Check markdown for common misspellings
72-
run: |
73-
curl -L -o ./install-misspell.sh https://git.io/misspell
74-
sh ./install-misspell.sh
75-
./bin/misspell -error ./**/*
71+
- if: |
72+
needs.build.result != 'success' ||
73+
needs.integration-test.result != 'success'
74+
run: exit 1

.github/workflows/build.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- v[0-9]+.[0-9]+.x
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Set up JDK for running Gradle
17+
uses: actions/setup-java@v3
18+
with:
19+
distribution: temurin
20+
java-version: 17
21+
22+
- name: Build
23+
uses: gradle/gradle-build-action@v2
24+
with:
25+
arguments: --stacktrace build
26+
27+
- name: Save unit test results
28+
uses: actions/upload-artifact@v2
29+
if: always()
30+
with:
31+
name: test-results
32+
path: jmx-metrics/build/reports/tests/test
33+
34+
integration-test:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v3
38+
39+
- name: Set up JDK for running Gradle
40+
uses: actions/setup-java@v3
41+
with:
42+
distribution: temurin
43+
java-version: 17
44+
45+
- name: Integration test
46+
uses: gradle/gradle-build-action@v2
47+
with:
48+
arguments: --stacktrace integrationTest
49+
50+
- name: Save integration test results
51+
uses: actions/upload-artifact@v2
52+
if: always()
53+
with:
54+
name: integration-test-results
55+
path: jmx-metrics/build/reports/tests/integrationTest
56+
57+
markdown-link-check:
58+
# release branches are excluded to avoid unnecessary maintenance if external links break
59+
if: ${{ !startsWith(github.ref_name, 'v') }}
60+
uses: ./.github/workflows/reusable-markdown-link-check.yml
61+
62+
misspell-check:
63+
# release branches are excluded to avoid unnecessary maintenance if new misspellings are added
64+
# to the misspell dictionary
65+
if: ${{ !startsWith(github.ref_name, 'v') }}
66+
uses: ./.github/workflows/reusable-misspell-check.yml
67+
68+
publish-snapshots:
69+
needs:
70+
# intentionally not blocking snapshot publishing on markdown-link-check, or misspell-check
71+
- build
72+
- integration-test
73+
runs-on: ubuntu-latest
74+
if: ${{ github.repository == 'open-telemetry/opentelemetry-java-contrib' }}
75+
steps:
76+
- uses: actions/checkout@v3
77+
78+
- name: Set up JDK for running Gradle
79+
uses: actions/setup-java@v3
80+
with:
81+
distribution: temurin
82+
java-version: 17
83+
84+
- uses: gradle/gradle-build-action@v2
85+
name: Publish
86+
with:
87+
arguments: --stacktrace snapshot
88+
env:
89+
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
90+
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
91+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
92+
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: Nightly CodeQL analysis
22

33
on:
4-
workflow_dispatch:
54
schedule:
65
- cron: '30 1 * * *'
6+
workflow_dispatch:
77

88
jobs:
99
analyze:
@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v3
1414

15-
- name: Setup Java 17
15+
- name: Set up Java 17
1616
uses: actions/setup-java@v2
1717
with:
1818
distribution: temurin
@@ -31,24 +31,10 @@ jobs:
3131
# skipping build cache is needed so that all modules will be analyzed
3232
arguments: assemble --no-build-cache
3333

34-
- name: Perform CodeQL Analysis
34+
- name: Perform CodeQL analysis
3535
uses: github/codeql-action/analyze@v1
3636

3737
issue:
38-
name: Open issue on failure
3938
needs: analyze
40-
runs-on: ubuntu-latest
41-
if: always()
42-
steps:
43-
# run this action to get workflow conclusion
44-
# You can get conclusion by env (env.WORKFLOW_CONCLUSION)
45-
- uses: technote-space/[email protected]
46-
47-
- uses: actions/checkout@v3
48-
49-
- uses: JasonEtco/[email protected]
50-
if: env.WORKFLOW_CONCLUSION == 'failure' # notify only if failure
51-
env:
52-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53-
with:
54-
filename: .github/templates/workflow-failed.md
39+
if: failure()
40+
uses: ./.github/workflows/reusable-create-issue-for-failure.yml

.github/workflows/component-owners.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Gradle wrapper validation
2+
on:
3+
pull_request:
4+
paths:
5+
- '**/gradle/wrapper/**'
6+
push:
7+
paths:
8+
- '**/gradle/wrapper/**'
9+
10+
jobs:
11+
validation:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- uses: gradle/[email protected]

0 commit comments

Comments
 (0)