Skip to content

Commit

Permalink
Remove CCI and add release GHA release workflow (#333)
Browse files Browse the repository at this point in the history
* Remove CCI and add release GHA release workflow

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>

* Fix

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>

* Fix

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>

* Fix

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>

* enable others

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
  • Loading branch information
pavolloffay committed Jul 12, 2021
1 parent 168a449 commit c415f52
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 192 deletions.
134 changes: 0 additions & 134 deletions .circleci/config.yml

This file was deleted.

128 changes: 90 additions & 38 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,73 @@
name: release
on:
create:
tags:
- ^[0-9]+\.[0-9]+\.[0-9]+
tags: ['^[0-9]+\.[0-9]+\.[0-9]+']

jobs:
test:
runs-on: ubuntu-20.04
steps:
# Set fetch-depth: 0 to fetch commit history and tags for use in version calculation
- name: Check out code
uses: actions/checkout@v2.3.4
with:
fetch-depth: 0
submodules: true

- name: create checksum file
uses: hypertrace/github-actions/checksum@main

- name: Cache packages
id: cache-packages
uses: actions/cache@v2
with:
path: ~/.gradle
key: gradle-packages-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/checksum.txt') }}
restore-keys: |
gradle-packages-${{ runner.os }}-${{ github.job }}
gradle-packages-${{ runner.os }}
- name: build
run: make build
env:
JVM_OPTS: -Xmx1g
TERM: dumb

smoke-test:
runs-on: ubuntu-20.04
strategy:
matrix:
suite: [ "glassfish", "jetty", "liberty", "tomcat", "tomee", "wildfly", "other" ]
fail-fast: true
steps:
# Set fetch-depth: 0 to fetch commit history and tags for use in version calculation
- name: Check out code
uses: actions/checkout@v2.3.4
with:
fetch-depth: 0
submodules: true

- name: create checksum file
uses: hypertrace/github-actions/checksum@main

- name: Cache packages
id: cache-packages
uses: actions/cache@v2
with:
path: ~/.gradle
key: gradle-packages-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/checksum.txt') }}
restore-keys: |
gradle-packages-${{ runner.os }}-${{ github.job }}
gradle-packages-${{ runner.os }}
- name: smoke-test
run: make smoke-test SMOKE_TEST_SUITE=${{ matrix.suite }}
env:
JVM_OPTS: -Xmx1g
TERM: dumb

release:
needs: [ test, smoke-test ]
runs-on: ubuntu-20.04
steps:
# Set fetch-depth: 0 to fetch commit history and tags for use in version calculation
Expand All @@ -28,41 +90,31 @@ jobs:
gradle-packages-${{ runner.os }}-${{ github.job }}
gradle-packages-${{ runner.os }}
# - name: build
# run: make build
# env:
# JVM_OPTS: -Xmx1g
# TERM: dumb
- name: Release jars
run: |
echo "Releasing version:" && ./gradlew printVersion clean
ORG_GRADLE_PROJECT_signingKey=$(echo $SIGNING_KEY | base64 -d) ./gradlew publish
./gradlew closeAndReleaseRepository
env:
JVM_OPTS: -Xmx1g
TERM: dumb
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.ORG_GRADLE_PROJECT_OSSRHUSERNAME }}
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.ORG_GRADLE_PROJECT_OSSRHPASSWORD }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEYID }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
SIGNING_KEY: ${{ secrets.MAVEN_SIGNING_KEY }}

# - name: Set signing key
# run: echo "ORG_GRADLE_PROJECT_signingKey=$(echo $SIGNING_KEY | base64 -d)" >> $GITHUB_ENV
# env:
# SIGNING_KEY: ${{ secrets.MAVEN_SIGNING_KEY }}
#
# - name: Print signing key
# run: echo $ORG_GRADLE_PROJECT_signingKey
- name: Release docker image
run: |
echo $DOCKER_PASSWORD | docker login --username $DOCKER_USERNAME --password-stdin
DOCKER_TAG=${GITHUB_REF##*/} make docker docker-push
env:
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_PUBLISH_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_PUBLISH_TOKEN }}

# - name: publish to maven
# run: ./gradlew publish closeAndReleaseRepository
# env:
# JVM_OPTS: -Xmx1g
# TERM: dumb
# ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.ORG_GRADLE_PROJECT_OSSRHUSERNAME }}
# ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.ORG_GRADLE_PROJECT_OSSRHPASSWORD }}
# ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEYID }}
# ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
# SIGNING_KEY: ${{ secrets.MAVEN_SIGNING_KEY }}
# ORG_GRADLE_PROJECT_signingKey: ${{ secrets.MAVEN_SIGNING_KEY }}
#
# - name: Set release version env
# run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
#
# - name: List build artifacts
# run: ls ./javaagent/build/libs
#
# - name: Create github release
# uses: fnkr/github-action-ghr@v1
# if: startsWith(github.ref, 'refs/tags/')
# env:
# GHR_PATH: ./javaagent/build/libs
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload jars to release page
run: |
export TAG=${GITHUB_REF##*/}
gh release create ${TAG} --title "Release ${TAG}" javaagent/build/libs/*-all.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[![CircleCI](https://circleci.com/gh/hypertrace/javaagent.svg?style=svg&circle-token=b562d40d95cc5906f445004c4a96b666250d260b)](https://circleci.com/gh/hypertrace/javaagent)

# Hypertrace OpenTelemetry Java agent

Hypertrace distribution of [OpenTelemetry Java agent](https://github.com/open-telemetry/opentelemetry-java-instrumentation).
Expand Down
22 changes: 5 additions & 17 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,11 @@ the last tag version with `-SNAPSHOT` is used.

## Release CI job

The release CI job performs the following actions:
1. creates git tag for the next version
2. publishes artifacts to remove github repository with the new version
3. pushes the new git tag to the origin repository
The release CI job performs following actions:
1. runs unit and smoke tests
2. publishes java artifacts to maven repository
3. publishes docker image
4. creates GitHub release and uploads java agent to assets

Run `./gradlew publishToMavenLocal` and `ls ~/.m2/repository/org/hypertrace/agent` to find out which
artifacts are being published.

## Configuration

* Add SSH key
* Generate SSH key `ssh-keygen -t rsa -b 4096 -m PEM -C <email>` without passphrase
* Add private key to CircleCI project settings with `github.com` domain: https://app.circleci.com/settings/project/github/hypertrace/javaagent/ssh
* Add public key to Github project deploy keys and check "allow write access" https://github.com/hypertrace/javaagent/settings/keys
* Add fingerprint from CircleCI project settings to `./circleci/config.yml`
* Configure CI to release on `release-` tag or merge to the main branch.
* Configure CI to have access to bintray. E.g. add `hypertrace-publishing` context to the publish job.
* Configure gradle
* Add `org.hypertrace.version-settings` [Hypertrace version plugin](https://github.com/hypertrace/hypertrace-gradle-version-settings-plugin)
* Add `org.hypertrace.publish-plugin` [Hypertrace publish plugin](https://github.com/hypertrace/hypertrace-gradle-publish-plugin)
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import org.hypertrace.gradle.publishing.License.APACHE_2_0;
plugins {
`java-library`
id("com.diffplug.spotless") version "5.2.0" apply false
id("org.hypertrace.publish-maven-central-plugin") version "1.0.2" apply false
id("org.hypertrace.publish-maven-central-plugin") version "1.0.4" apply false
id("org.hypertrace.ci-utils-plugin") version "0.3.0"
id("org.gradle.test-retry") version "1.2.0" apply false
}
Expand Down

0 comments on commit c415f52

Please sign in to comment.