Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…y-java into exp-histogram-benchmark
  • Loading branch information
jack-berg committed Nov 30, 2022
2 parents a89a4fe + 2a231d7 commit 5d9f6d5
Show file tree
Hide file tree
Showing 222 changed files with 3,545 additions and 1,754 deletions.
34 changes: 34 additions & 0 deletions .github/scripts/draft-change-log-entries.sh
@@ -0,0 +1,34 @@
#!/bin/bash -e

version=$("$(dirname "$0")/get-version.sh")

if [[ $version =~ ([0-9]+)\.([0-9]+)\.0 ]]; then
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
else
echo "unexpected version: $version"
exit 1
fi

if [[ $minor == 0 ]]; then
prior_major=$((major - 1))
prior_minor=$(sed -n "s/^## Version $prior_major\.\([0-9]\+\)\..*/\1/p" CHANGELOG.md | head -1)
if [[ -z $prior_minor ]]; then
# assuming this is the first release
range=
else
range="v$prior_major.$prior_minor.0..HEAD"
fi
else
range="v$major.$((minor - 1)).0..HEAD"
fi

echo "## Unreleased"
echo

git log --reverse \
--perl-regexp \
--author='^(?!dependabot\[bot\] )' \
--pretty=format:"- %s" \
"$range" \
| sed -E 's,\(#([0-9]+)\)$,\n ([#\1](https://github.com/open-telemetry/opentelemetry-java/pull/\1)),'
2 changes: 1 addition & 1 deletion .github/scripts/markdown-link-check-with-retry.sh
Expand Up @@ -6,7 +6,7 @@ retry_count=3

for file in "$@"; do
for i in $(seq 1 $retry_count); do
if markdown-link-check --config "$(dirname "$0")/markdown-link-check-config.json" \
if markdown-link-check --config "$(dirname "$0")/../config/markdown-link-check-config.json" \
"$file"; then
break
elif [[ $i -eq $retry_count ]]; then
Expand Down
44 changes: 44 additions & 0 deletions .github/scripts/merge-change-log-after-release.sh
@@ -0,0 +1,44 @@
#!/bin/bash -e

# this script merges release notes for $VERSION into CHANGELOG.md
# the release date for $VERSION should be available in $RELEASE_DATE
# and the release notes for $VERSION should be available in /tmp/changelog-section.md

if [[ $VERSION =~ ^[0-9]+\.[0-9]+\.0 ]]; then
# this was not a patch release, so the version exists already in the CHANGELOG.md

# update the release date
sed -Ei "s/## Version $VERSION .*/## Version $VERSION ($RELEASE_DATE)/" CHANGELOG.md

# the entries are copied over from the release branch to support workflows
# where change log entries may be updated after preparing the release branch

{
# copy the portion above the release, up to and including the heading
sed -n "0,/^## Version $VERSION /p" CHANGELOG.md
# copy the release notes for $VERSION
cat /tmp/changelog-section.md
# copy the portion below the release
sed -n "0,/^## Version $VERSION /d;0,/^## Version /{/^## Version/!d};p" CHANGELOG.md
} > /tmp/CHANGELOG.md

# update the real CHANGELOG.md
cp /tmp/CHANGELOG.md CHANGELOG.md

else
# this was a patch release, so the version does not exist already in the CHANGELOG.md

{
# copy the portion above the top-most release, not including the heading
sed -n "0,/^## Version /{ /^## Version /!p }" CHANGELOG.md
# add the heading
echo "## Version $VERSION ($RELEASE_DATE)"
# copy the release notes for $VERSION
cat /tmp/changelog-section.md
# copy the portion starting from the top-most release
sed -n "/^## Version /,\$p" CHANGELOG.md
} > /tmp/CHANGELOG.md

# update the real CHANGELOG.md
cp /tmp/CHANGELOG.md CHANGELOG.md
fi
6 changes: 3 additions & 3 deletions .github/workflows/backport.yml
Expand Up @@ -28,16 +28,16 @@ jobs:
env:
NUMBER: ${{ github.event.inputs.number }}
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
GH_TOKEN: ${{ secrets.BOT_TOKEN }}
run: |
commit=$(gh pr view $NUMBER --json mergeCommit --jq .mergeCommit.oid)
title=$(gh pr view $NUMBER --json title --jq .title)
branch="opentelemetrybot/backport-${NUMBER}-to-${GITHUB_REF_NAME//\//-}"
git checkout -b $branch
git cherry-pick $commit
git push origin HEAD:$branch
git push --set-upstream origin $branch
gh pr create --title "[$GITHUB_REF_NAME] $title" \
--body "Clean cherry-pick of #$NUMBER to the \`$GITHUB_REF_NAME\` branch." \
--head $branch \
--base $GITHUB_REF_NAME
29 changes: 14 additions & 15 deletions .github/workflows/build.yml
Expand Up @@ -34,8 +34,6 @@ jobs:
coverage: true
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- id: setup-java-test
name: Set up Java ${{ matrix.test-java-version }} for tests
Expand All @@ -60,14 +58,18 @@ jobs:
-Porg.gradle.java.installations.paths=${{ steps.setup-java-test.outputs.path }},${{ steps.setup-java.outputs.path }}
- name: Check for diff
# The jApiCmp diff compares current to latest, which isn't appropriate for release branches
if: ${{ !startsWith(github.ref_name, 'release/') && !startsWith(github.base_ref, 'release/') }}
run: |
if git diff --quiet
# need to "git add" in case any generated files did not already exist
git add docs/apidiffs
if git diff --cached --quiet
then
echo "No diff detected."
else
echo "Diff detected - did you run './gradlew jApiCmp'?"
echo $(git diff --name-only)
echo $(git diff)
echo $(git diff --cached --name-only)
echo $(git diff --cached)
exit 1
fi
Expand All @@ -81,13 +83,12 @@ jobs:
path: all/build/reports/jacoco/test/html

markdown-link-check:
# release branches are excluded to avoid unnecessary maintenance if external links break
# release branches are excluded to avoid unnecessary maintenance
if: ${{ !startsWith(github.ref_name, 'release/') }}
uses: ./.github/workflows/reusable-markdown-link-check.yml

misspell-check:
# release branches are excluded to avoid unnecessary maintenance if new misspellings are added
# to the misspell dictionary
# release branches are excluded to avoid unnecessary maintenance
if: ${{ !startsWith(github.ref_name, 'release/') }}
uses: ./.github/workflows/reusable-misspell-check.yml

Expand All @@ -107,8 +108,6 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- id: setup-java
name: Set up Java
Expand All @@ -130,11 +129,11 @@ jobs:
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}

required-status-check:
# markdown-link-check is not required so that pull requests will not be blocked if external
# links break
# similarly misspell-check is not required so that pull requests will not be blocked if new
# misspellings are added to the misspell dictionary
needs: build
# markdown-link-check is not required so pull requests are not blocked if external links break
# misspell-check is not required so pull requests are not blocked if the misspell dictionary is
# updated
needs:
- build
runs-on: ubuntu-latest
if: always()
steps:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/codeql-daily.yml
Expand Up @@ -2,6 +2,7 @@ name: CodeQL (daily)

on:
schedule:
# Daily at 01:30 (UTC)
- cron: '30 1 * * *'
workflow_dispatch:

Expand Down Expand Up @@ -33,6 +34,7 @@ jobs:

open-issue-on-failure:
# open an issue on failure because it can be easy to miss CI failure notifications
needs: analyze
if: failure()
needs:
- analyze
if: failure() && github.run_attempt == 1
uses: ./.github/workflows/reusable-open-issue-on-failure.yml
6 changes: 3 additions & 3 deletions .github/workflows/prepare-patch-release.yml
Expand Up @@ -45,14 +45,14 @@ jobs:
- name: Create pull request
env:
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
GH_TOKEN: ${{ secrets.BOT_TOKEN }}
run: |
message="Prepare release $VERSION"
branch="opentelemetrybot/prepare-release-${VERSION}"
git checkout -b $branch
git commit -a -m "$message"
git push origin HEAD:$branch
git push --set-upstream origin $branch
gh pr create --title "[$GITHUB_REF_NAME] $message" \
--body "$message." \
--head $branch \
--base $GITHUB_REF_NAME
21 changes: 12 additions & 9 deletions .github/workflows/prepare-release-branch.yml
Expand Up @@ -8,7 +8,8 @@ jobs:
steps:
- uses: actions/checkout@v3

- run: |
- name: Verify prerequisites
run: |
if [[ $GITHUB_REF_NAME != main ]]; then
echo this workflow should only be run against main
exit 1
Expand All @@ -21,7 +22,8 @@ jobs:
create-pull-request-against-release-branch:
runs-on: ubuntu-latest
needs: prereqs
needs:
- prereqs
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -55,21 +57,22 @@ jobs:
- name: Create pull request against the release branch
env:
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
GH_TOKEN: ${{ secrets.BOT_TOKEN }}
run: |
message="Prepare release $VERSION"
branch="opentelemetrybot/prepare-release-${VERSION}"
git checkout -b $branch
git commit -a -m "$message"
git push origin HEAD:$branch
git push --set-upstream origin $branch
gh pr create --title "[$RELEASE_BRANCH_NAME] $message" \
--body "$message." \
--head $branch \
--base $RELEASE_BRANCH_NAME
create-pull-request-against-main:
runs-on: ubuntu-latest
needs: prereqs
needs:
- prereqs
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -102,15 +105,15 @@ jobs:
- name: Create pull request against main
env:
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
GH_TOKEN: ${{ secrets.BOT_TOKEN }}
run: |
message="Update version to $NEXT_VERSION"
body="Update version to \`$NEXT_VERSION\`."
branch="opentelemetrybot/update-version-to-${NEXT_VERSION}"
git checkout -b $branch
git commit -a -m "$message"
git push origin HEAD:$branch
git push --set-upstream origin $branch
gh pr create --title "$message" \
--body "$body" \
--head $branch \
--base main

0 comments on commit 5d9f6d5

Please sign in to comment.