Skip to content

Commit

Permalink
ci: Added test and package steps to Github Actions (#61)
Browse files Browse the repository at this point in the history
* doc: Added ISSUE_TEMPLATE content that was missing
* ci: Release workflow
* release: Bumped version of project to 1.6.0
  • Loading branch information
carlosroman authored Oct 23, 2020
1 parent db408b6 commit eaf29cb
Show file tree
Hide file tree
Showing 20 changed files with 355 additions and 62 deletions.
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: "Bug report \U0001F41B"
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---

[NOTE]: # ( ^^ Provide a general summary of the issue in the title above. ^^ )

## Description
[NOTE]: # ( Describe the problem you're encountering. )
[TIP]: # ( Do NOT share sensitive information, whether personal, proprietary, or otherwise! )

## Expected Behavior
[NOTE]: # ( Tell us what you expected to happen. )

## [NR Diag](https://docs.newrelic.com/docs/using-new-relic/cross-product-functions/troubleshooting/new-relic-diagnostics) results
[NOTE]: # ( Provide any other relevant log data. )
[TIP]: # ( Scrub logs and diagnostic information for sensitive information )

## Steps to Reproduce
[NOTE]: # ( Please be as specific as possible. )
[TIP]: # ( Link a sample application that demonstrates the issue. )

## Your Environment
[TIP]: # ( Include as many relevant details about your environment as possible including the running version of New Relic software and any relevant configurations. )

## Additional context
[TIP]: # ( Add any other context about the problem here. For example, relevant community posts or support tickets. )
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Troubleshooting
url: https://github.com/newrelic/nri-redis/blob/master/README.md#support
about: Check out the README for troubleshooting directions
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
priority: ''
---

## Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

## Feature Description
A clear and concise description of the feature you want or need.

## Describe Alternatives
A clear and concise description of any alternative solutions or features you've considered. Are there examples you could link us to?

## Additional context
Add any other context here.

## Priority
Please help us better understand this feature request by choosing a priority from the following options:
[Nice to Have, Really Want, Must Have, Blocker]
15 changes: 0 additions & 15 deletions .github/workflows/build.yml

This file was deleted.

112 changes: 112 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
---
name: Prerelease pipeline

on:
release:
types:
- prereleased
tags:
- 'v*'

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_MAIL: '[email protected]' # [email protected]
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_PRIVATE_KEY_BASE64: ${{ secrets.GPG_PRIVATE_KEY_BASE64 }} # base64 encoded
PFX_CERTIFICATE_BASE64: ${{ secrets.PFX_CERTIFICATE_BASE64 }} # base64 encoded
PFX_PASSPHRASE: ${{ secrets.PFX_PASSPHRASE }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
TAG: ${{ github.event.release.tag_name }}

jobs:

test:
name: Run tests
runs-on: ubuntu-18.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Restore gradle cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: '11'
java-package: jdk
- name: Build with Gradle
run: ./gradlew build --info --stacktrace

package-linux:
name: Run Linux package task
runs-on: ubuntu-18.04
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Restore gradle cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: '11'
java-package: jdk
- name: Package with Gradle
run: ./gradlew package --warn --stacktrace
- name: Install debsigs
run: sudo apt-get install -y debsigs
- name: Sign packages
run: ./script/sign.sh
- name: Upload release asset to GitHub Release
run: script/upload_to_linux_release.sh ./build/distributions/nrjmx ${{ env.TAG }}

package-windows:
name: Run Windows package task
runs-on: windows-2019
strategy:
matrix:
arch: [ amd64 ]
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Restore gradle cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: '11'
java-package: jdk
- name: Build jlink code
run: ./gradlew jlink --info --stacktrace
- name: Get PFX certificate from GH secrets
run: '[IO.File]::WriteAllBytes("wincert.pfx", [Convert]::FromBase64String($env:PFX_CERTIFICATE_BASE64))'
- name: Install cert
run: Import-PfxCertificate -FilePath wincert.pfx -Password (ConvertTo-SecureString -String $env:PFX_PASSPHRASE -AsPlainText -Force) -CertStoreLocation Cert:\CurrentUser\My
- name: Create MSI
run: ./win_build.ps1 -arch ${{ matrix.arch }} -version ${{ env.TAG }}
- name: Upload release asset to GitHub Release
shell: bash
run: script/upload_to_release.sh ./target/msi/Release/nrjmx-${{ matrix.arch }} ${{ env.TAG }}
41 changes: 30 additions & 11 deletions .github/workflows/push_pr.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
---
name: Java CI - PR
name: Push/PR pipeline

on: [ pull_request ]
on:
push:
branches:
- '**'
tags-ignore:
- '**'

env:
GPG_MAIL: '[email protected]' # [email protected]
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_PRIVATE_KEY_BASE64: ${{ secrets.GPG_PRIVATE_KEY_BASE64 }} # base64 encoded
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

jobs:

test:
runs-on: ubuntu-20.04
name: Run tests
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v2
- name: Restore gradle cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
Expand All @@ -21,17 +40,17 @@ jobs:
run: ./gradlew build --info --stacktrace
- name: Package with Gradle
run: ./gradlew package --warn --stacktrace
- name: Push bin to GH workflow artifacts cache
uses: actions/upload-artifact@v2
with:
name: dist-linux
path: build/distributions
- name: Install debsigs
run: sudo apt-get install -y debsigs
- name: Sign packages
run: ./script/sign.sh

snyk:
name: Run security checks via snyk
runs-on: ubuntu-20.04
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v2
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/gradle-jdk11@master
env:
Expand Down
1 change: 0 additions & 1 deletion .java-version

This file was deleted.

2 changes: 1 addition & 1 deletion bin/nrjmx.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@echo off
java -jar "C:\Program Files\New Relic\nrjmx\nrjmx.jar" %*
"%~dp0/bin/nrjmx.bat"
44 changes: 32 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -124,28 +124,48 @@ tasks.register<Zip>("jlinkDistZip") {
tasks.register<Tar>("jlinkDistTar") {
dependsOn(tasks.jlink, "downloadJmxTerm", "jmxtermScripts")
destinationDirectory.set(file("${buildDir}/distributions"))
archiveFileName.set("${project.name}-${project.version}-jlink.tar.bz2")
compression = Compression.BZIP2
archiveFileName.set("${project.name}-${project.version}-jlink.tar.gz")
compression = Compression.GZIP

into("${project.name}-${project.version}")
from("LICENSE") {
into("usr/share/doc/nrjmx")
}

from("LICENSE")
from("README.md")
from("${buildDir}/image")
from("README.md") {
into("usr/share/doc/nrjmx")
}

from("${buildDir}/image") {
into("usr/lib/nrjmx")
}

from("${buildDir}/jmxterm/lib") {
include("jmxterm-uber.jar")
into("lib")
into("usr/lib/nrjmx/lib")
}

from("${buildDir}/jmxterm/bin") {
into("bin")
into("usr/lib/nrjmx/bin")
fileMode = 0x1ED
}

from("src/rpm/usr/bin") {
into("usr/bin")
include("**")
fileMode = 0x1ED
}
}

tasks.buildDeb {
dependsOn(tasks.jlink, "downloadJmxTerm", "jmxtermScripts")

setRelease("1")
setArch("amd64")
setOs(LINUX)
setVendor("New Relic Infrastructure Team <[email protected]>")
setPackageGroup("Application/System")
setLicense("Apache 2.0")

from("${buildDir}/jmxterm") {
include("lib/jmxterm-uber.jar")
into("/usr/lib/${project.name}")
Expand All @@ -168,15 +188,15 @@ tasks.buildDeb {
}

tasks.buildRpm {
dependsOn(tasks.jlink, "downloadJmxTerm", "jmxtermScripts")

setRelease("1")
setArch(X86_64)
setOs(LINUX)
setVendor("New Relic Infrastructure Team <[email protected]>")
setPackageGroup("Application/System")
setLicense("Apache 2.0")

dependsOn(tasks.jlink, "downloadJmxTerm", "jmxtermScripts")

from("${buildDir}/jmxterm") {
include("lib/jmxterm-uber.jar")
into("/usr/lib/${project.name}")
Expand Down Expand Up @@ -210,8 +230,8 @@ tasks.distZip {

tasks.distTar {
dependsOn("downloadJmxTerm", "jmxtermScripts")
archiveExtension.set("tar.bz2")
compression = Compression.BZIP2
archiveExtension.set("tar.gz")
compression = Compression.GZIP

from("${buildDir}/jmxterm") {
include("**")
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
group=nrjmx
version=1.6.0-SNAPSHOT
version=1.6.0
description=The New Relic JMX tool provides a command line tool to connect to a JMX server and retrieve the MBeans it exposes
jmxTermVersion=1.0.2
13 changes: 2 additions & 11 deletions pkg/windows/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,16 @@

<Feature Id="ProductFeature" Title="NRJMX" Level="1">
<ComponentRef Id="CMP_V1_NRJMX_DIRECTORY"/>
<ComponentGroupRef Id="CMP_GRP_NRJMX_JAR"/>
<ComponentGroupRef Id="CMP_GRP_NRJMX_BAT"/>
<ComponentGroupRef Id="JlinkFiles"/>
</Feature>
</Product>

<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="CompanyFolder" Name="New Relic">
<Directory Id="NrjmxDirectory" Name="nrjmx">
</Directory>
<Directory Id="NrjmxDirectory" Name="nrjmx" />
</Directory>
</Directory>
</Directory>
Expand All @@ -48,14 +47,6 @@
</Fragment>

<Fragment>
<ComponentGroup Id="CMP_GRP_NRJMX_JAR" Directory="NrjmxDirectory">
<Component Id="CMP_NRJMX_JAR" Guid="9ac6648a-d7e4-4c85-8240-8208bddc57b5" Win64="yes">
<File Id="FILE_NRJMX_JAR"
Source="$(var.JarPath)nrjmx-$(env.NRJMX_VERSION).jar"
Name="nrjmx.jar"
KeyPath="yes"/>
</Component>
</ComponentGroup>
<ComponentGroup Id="CMP_GRP_NRJMX_BAT" Directory="NrjmxDirectory">
<Component Id="CMP_NRJMX_BAT" Guid="fb3b675c-4905-45bd-a37f-8a9fb9dc2baf" Win64="yes">
<File Id="FILE_NRJMX_BAT"
Expand Down
Loading

0 comments on commit eaf29cb

Please sign in to comment.