-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from appoptics/NH-3952-gh-actions
NH-3952: Github Actions
- Loading branch information
Showing
5 changed files
with
89 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,43 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle | ||
|
||
# This workflow builds the NightHawk agent, run the tests, then publish a new release. | ||
# You'll need to bump the version by modifying `ext.versions.agent` property in the build.gradle file | ||
# then manually run this workflow to cut off a new release. The release name will be in the form of | ||
# "v+versionNumber". For example, if `ext.versions.agent` = 0.5.1, the release name will be "v0.5.1". | ||
name: Java CI with Gradle | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
inputs: | ||
checkout-ref: | ||
description: branch, tag or SHA to checkout. defaults to ref or SHA of triggering event. | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.ref_name }} | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
- name: Build with Gradle | ||
uses: gradle/gradle-build-action@bc3340afc5e3cc44f2321809ac090d731c13c514 | ||
- name: Build with Gradle and Publish | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: build | ||
arguments: publish | ||
env: | ||
# These two secrets `secrets.GP_USERNAME` and `secrets.GP_TOKEN` are Github's PAT (Personal Access Token), | ||
# which are used to download private packages from Github Packages (in our case, the Joboe core libs from https://github.com/librato/joboe) | ||
# Gradle fetches the dependencies from Github Packages with this user/token pair, see build.gradle for the repositories config. | ||
# | ||
# Currently the PAT is set up under the trace-build service account and just requires read:packages access to the Librato org. | ||
# (Check out this document about how to create a PAT: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) | ||
GP_USERNAME: ${{ secrets.GP_USERNAME }} | ||
GP_TOKEN: ${{ secrets.GP_TOKEN }} | ||
# GITHUB_TOKEN is used to publish the build artifacts (the NightHawk agent) to Github Packages. | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Set agent version env | ||
run: | | ||
echo "AGENT_VERSION=v$(cd agent/build/libs && unzip -p solarwinds-apm-agent-all.jar META-INF/MANIFEST.MF | grep Implementation-Version | awk '{ print $2 }')" >> $GITHUB_ENV | ||
- name: Release and upload artifacts | ||
run: gh release create ${{ env.AGENT_VERSION }} --title "${{ env.AGENT_VERSION }}" --target ${{ github.ref_name }} --draft agent/build/libs/*.jar | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# This workflow is triggered either by a push or by manually clicking `Run Workflow` in the Actions page. | ||
# The purpose of the workflow is to build the agent and run the tests. | ||
|
||
name: Push | ||
|
||
on: | ||
push: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.ref_name }} | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
- name: Build with Gradle and Test | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: test | ||
env: | ||
GP_USERNAME: ${{ secrets.GP_USERNAME }} | ||
GP_TOKEN: ${{ secrets.GP_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,4 @@ | ||
# explicitly list all the build directories instead of an asterisk (**/build/) to avoid possible unwanted match | ||
/instrumentation/build/ | ||
/agent/build/ | ||
/appoptics-opentelemetry-sdk-shaded/build/ | ||
/appoptics-opentelemetry-sdk/build/ | ||
/buildSrc/build/ | ||
/core-bootstrap/build/ | ||
/custom/build/ | ||
/instrumentation/appoptics-annotation/build/ | ||
/instrumentation/jdbc/build/ | ||
/instrumentation/spring/build/ | ||
/instrumentation/spring/spring-webmvc-3.1/build/ | ||
/sdk-extensions-bootstrap/build/ | ||
/sdk-extensions/build/ | ||
**/build/ | ||
**/*.log | ||
.gradle/ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters