Skip to content

Commit

Permalink
Integrate with GitHub actions workflow and maven fix for compilation (#…
Browse files Browse the repository at this point in the history
…19)

Inetgrating with github action workflow. maven changes to link to correct url.
Also add the download and build status tag
  • Loading branch information
ssen-li authored Dec 9, 2020
1 parent 056a733 commit 8b102c9
Show file tree
Hide file tree
Showing 9 changed files with 212 additions and 5 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: pull request build workflow

on:
pull_request

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
# bring in all history because the gradle versions plugin needs to "walk back" to the closest ancestor tag
fetch-depth: 0
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Gradle
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
# add --info or --debug below for more details when trying to understand issues
run: ./gradlew clean build --stacktrace --no-daemon
26 changes: 26 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: push to master request build workflow
# This should be a merge from another branch not direct push

on:
push:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v2
with:
# bring in all history because the gradle versions plugin needs to "walk back" to the closest ancestor tag
fetch-depth: 0
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Gradle
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
# add --info or --debug below for more details when trying to understand issues
run: ./gradlew clean build --stacktrace --no-daemon
40 changes: 40 additions & 0 deletions .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: release a new tag build workflow

on:
create:
tags:
- '*'

jobs:

build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
# bring in all history because the gradle versions plugin needs to "walk back" to the closest ancestor tag
fetch-depth: 0
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Gradle
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
# add --info or --debug below for more details when trying to understand issues
run: ./gradlew clean build --stacktrace --no-daemon

- name: Branch tag
id: branch_tag
run: echo ::set-output name=RELEASE_TAG::${GITHUB_REF#refs/tags/}
- name: Publish to Bintray
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
SOURCE_TAG: ${{ steps.branch_tag.outputs.RELEASE_TAG }}
run: |
chmod +x ./scripts/publishToBintray.sh
./scripts/publishToBintray.sh
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# tehuti

[![Download](https://api.bintray.com/packages/linkedin/maven/tehuti/images/download.svg)](https://bintray.com/linkedin/maven/tehuti/_latestVersion)

[![Build Status](https://github.com/tehuti-io/tehuti/workflows/push%20to%20master%20request%20build%20workflow/badge.svg)](https://github.com/tehuti-io/tehuti/actions?query=workflow%3A%22push+to+master+request+build+workflow%22)


Tehuti is a simple metrics library providing statistical measurement, reporting and quota functionalities.

Please subscribe to the [mailing list](https://groups.google.com/forum/#!forum/tehuti) to ask questions or discuss development.
Expand Down
94 changes: 91 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@

buildscript {
repositories {
jcenter()
}
dependencies {
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4"
}
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'


repositories {
mavenCentral()
maven { url "https://repo.maven.apache.org/maven2" }
}

dependencies {
Expand Down Expand Up @@ -110,13 +123,88 @@ if (project.hasProperty("signing.enabled") && project.property("signing.enabled"
}
}

publishing {
publications {
maven(MavenPublication) {
groupId project.group
artifactId project.name
version project.version

println "######artifact details $groupId:$artifactId:$version"
from components.java

artifact sourcesJar
artifact javadocJar
artifact testJar
artifact testSourcesJar

pom {
name = 'Tehuti'
description = 'Tehuti is a simple metrics library providing statistical measurement, reporting and quota functionalities.'
url = 'http://tehuti.io'

licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'FelixGV'
name = 'Felix GV'
email = 'fgv@linkedin.com'
organization = 'LinkedIn'
organizationUrl = 'linkedin.com'
}
}
scm {
connection = 'scm:git:git@github.com:tehuti-io/tehuti.git'
developerConnection = 'scm:git:git@github.com:tehuti-io/tehuti.git'
url = 'https://github.com/tehuti-io/tehuti'
}
}
}
}
}

bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')

dryRun = project.hasProperty("bintray.dryRun") //useful for testing
publications = ['maven']

pkg {
repo = 'maven'
name = 'tehuti'
userOrg = 'linkedin'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/tehuti-io/tehuti.git'
version {
name = project.version
}
publish = true
}
publish = true
}


bintrayUpload {
doFirst {
println "Publishing $jar.baseName to Bintray (dryRun: $dryRun, repo: $repoName, publish: $publish)"
}
}

idea {
module {
downloadJavadoc = true
downloadSources = true
}
}

task wrapper(type: Wrapper) {
gradleVersion = '1.12'
wrapper {
gradleVersion = '6.5.1'
distributionType = Wrapper.DistributionType.ALL
}

2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
group=io.tehuti
archivesBaseName=tehuti
version=0.7.6
version=0.8.7

signing.enabled=false
signing.keyId=
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip
22 changes: 22 additions & 0 deletions scripts/publishToBintray.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

result=${PWD##*/}
if [[ "$result" = "scripts" ]]
then
echo "script must be run from root project folder, not $PWD"
exit 1
else
echo "we are in $PWD and tag is $SOURCE_TAG"

if [[ $SOURCE_TAG =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]
then
echo "tag $SOURCE_TAG looks like a semver so proceeding with bintray publish"
git status
git describe --tags
#enable below to test the bintrayUpload process, it wouldn't do the actual uploading
#./gradlew bintrayUpload -Pbintray.dryRun --info
./gradlew bintrayUpload --info
else
echo "tag $SOURCE_TAG is NOT a valid semantic version (x.y.z) so not publishing to bintray"
fi
fi
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'tehuti'

0 comments on commit 8b102c9

Please sign in to comment.