Skip to content

Commit

Permalink
Merge 48d309a into a4cd63b
Browse files Browse the repository at this point in the history
  • Loading branch information
musketyr committed Jul 13, 2021
2 parents a4cd63b + 48d309a commit 7325e54
Show file tree
Hide file tree
Showing 31 changed files with 510 additions and 251 deletions.
1 change: 1 addition & 0 deletions .asciidoctorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
:root-dir: {asciidoctorconfigdir}
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false

[*.yml]
# YAML should be space separated see https://en.wikipedia.org/wiki/YAML#Pitfalls_and_implementation_defects
indent_style = space
indent_size = 2
7 changes: 0 additions & 7 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.8

- uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: eskatos/gradle-command-action@v1
with:
arguments: check coveralls --stacktrace
Expand Down
43 changes: 27 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,46 @@ name: Release

on:
release:
types: [published]
types: [ published ]
jobs:
release:
name: Release
runs-on: ubuntu-latest
env:
GRADLE_OPTS: "-Xmx6g -Xms4g"
GRGIT_USER: musketyr
GRGIT_PASS: ${{ secrets.PERSONAL_TOKEN }}
steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Semantic Version
id: version
uses: ncipollo/semantic-version-action@v1
- uses: eskatos/gradle-command-action@v1
with:
arguments: bintrayUpload -PbintrayUsername=${{ secrets.BINTRAY_USER }} -PbintrayApiKey=${{ secrets.BINTRAY_KEY }} -Pversion=${{ steps.version.outputs.tag }} -Prelease=true
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Semantic Version
id: version
uses: ncipollo/semantic-version-action@v1
- name: Decode PGP
id: write_file
uses: timheuer/base64-to-file@v1
with:
fileName: 'secret.pgp'
encodedString: ${{ secrets.SIGNING_SECRET_KEY_BASE64 }}
- uses: eskatos/gradle-command-action@v1
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_SECRET_KEY_PATH: ${{ steps.write_file.outputs.filePath }}
with:
arguments: gitPublishPush publishToSonatype closeAndReleaseSonatypeStagingRepository -Pversion=${{ steps.version.outputs.tag }} -Prelease=true -Dorg.ajoberstar.grgit.auth.username=${{ secrets.AGORAPULSE_BOT_PERSONAL_TOKEN }} --stacktrace
ping:
name: Notify Upstream Repositories
runs-on: ubuntu-latest
needs: [release]
needs: [ release ]
strategy:
matrix:
repository:
- agorapulse/agorapulse-bom
- agorapulse/agorapulse-oss
steps:
- uses: actions/checkout@v1
- name: Semantic Version
Expand All @@ -39,7 +50,7 @@ jobs:
- name: Dispatch to ${{ matrix.repository }}
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.PERSONAL_TOKEN }}
token: ${{ secrets.AGORAPULSE_BOT_PERSONAL_TOKEN }}
repository: ${{ matrix.repository }}
event-type: ap-new-version-released-event
client-payload: '{ "group": "com.agorapulse", "module": "micronaut-segment", "version": "${{ steps.version.outputs.tag }}", "property" : "micronaut.segment.version", "github" : ${{ toJson(github) }} }'
36 changes: 36 additions & 0 deletions .github/workflows/segment-libraries-watcher.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
on:
schedule:
- cron: '30 0 * * *'
jobs:
update-bom:
name: Updates Version and Opens PR
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Fetch Segment Maven descriptor
run: curl https://repo1.maven.org/maven2/com/segment/analytics/java/analytics/maven-metadata.xml -o /tmp/maven-descriptor.xml
- name: Extract the latest version
uses: QwerMike/xpath-action@v1
id: xpath
with:
filename: '/tmp/maven-descriptor.xml'
expression: '/metadata/versioning/latest/text()'
- name: Upgrade Segment Version Number
run: |
sed -i 's/segmentLibrariesVersion.*/segmentLibrariesVersion = ${{ steps.xpath.outputs.result }}/' gradle.properties
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Upgraded to Segment Analytics ${{ steps.xpath.outputs.result }}
title: '[Upgrade] Upgraded to the Segment Analytics ${{ steps.xpath.outputs.result }}'
body: |
There is a newer version ${{ steps.xpath.outputs.result }} of Segment Analytics is available. The dependency has been updated.
labels: chore,upgrade
assignees: musketyr
branch: upgrade/segment-analytics
- name: Check outputs
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
13 changes: 13 additions & 0 deletions .lazybones/stored-params.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#Lazybones saved template parameters
#Tue Apr 13 09:06:19 CEST 2021
name=Micronaut Segment
id=micronaut-segment
dev.name=Vladimir Orany
dev.id=musketyr
bintray.repo=�libs
bintray.org=agorapulse
desc=Micronaut Segment Library
pkg=com.agorapulse.micronaut.segment
vendor=Agorapulse
group=com.agorapulse
org=agorapulse
13 changes: 13 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
= Micronaut Segment

--
image::https://img.shields.io/maven-central/v/com.agorapulse/micronaut-segment.svg?label=Maven%20Central[link="https://search.maven.org/search?q=g:%22com.agorapulse%22%20AND%20a:%22micronaut-segment%22",float="left"]
image::https://github.com/agorapulse/micronaut-segment/workflows/Check/badge.svg["Build Status", link="https://github.com/agorapulse/micronaut-segment/actions?query=workflow%3ACheck"float="left"]
image::https://coveralls.io/repos/github/agorapulse/micronaut-segment/badge.svg?branch=master[link=https://coveralls.io/github/agorapulse/micronaut-segment?branch=master",float="left"]
--

'''

http://segment.com[Segment] integration for http://micronaut.io[Micronaut].

See https://agorapulse.github.io/micronaut-segment[Full Documentation].
110 changes: 66 additions & 44 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@
*/
plugins {
id 'org.kordamp.gradle.groovy-project'
id 'org.kordamp.gradle.bintray'
id 'org.kordamp.gradle.checkstyle'
id 'org.kordamp.gradle.codenarc'
id 'org.kordamp.gradle.coveralls'
id 'io.github.gradle-nexus.publish-plugin'
}

if (!project.hasProperty('bintrayUsername')) ext.bintrayUsername = '**UNDEFINED**'
if (!project.hasProperty('bintrayApiKey')) ext.bintrayApiKey = '**UNDEFINED**'
if (!project.hasProperty('ossrhUsername')) ext.ossrhUsername = System.getenv('SONATYPE_USERNAME') ?: '**UNDEFINED**'
if (!project.hasProperty('ossrhPassword')) ext.ossrhPassword = System.getenv('SONATYPE_PASSWORD') ?: '**UNDEFINED**'
if (!project.hasProperty('signingKeyId')) ext.signingKeyId = System.getenv('SIGNING_KEY_ID') ?: '**UNDEFINED**'
if (!project.hasProperty('signingPassword')) ext.signingPassword = System.getenv('SIGNING_PASSWORD') ?: '**UNDEFINED**'
if (!project.hasProperty('signingSecretKey')) ext.signingSecretKey = System.getenv('SIGNING_SECRET_KEY_PATH') ? rootProject.file(System.getenv('SIGNING_SECRET_KEY_PATH')).text : '**UNDEFINED**'

config {
release = (rootProject.findProperty('release') ?: false).toBoolean()
Expand Down Expand Up @@ -69,23 +72,16 @@ config {
}

publishing {
signing = false
signing {
enabled = true
keyId = signingKeyId
secretKey = signingSecretKey
password = signingPassword
}
releasesRepository = 'localRelease'
snapshotsRepository = 'localSnapshot'
}

bintray {
credentials {
username = bintrayUsername
password = bintrayApiKey
}
// TODO: replace
userOrg = 'agorapulse'
repo = 'libs'
name = 'micronaut-segment'
publish = true
}

quality {
checkstyle {
toolVersion = '8.27'
Expand All @@ -112,52 +108,78 @@ config {

}

nexusPublishing {
repositories {
sonatype {
username = ossrhUsername
password = ossrhPassword
}
}
}

allprojects {
repositories {
jcenter()
mavenCentral()
maven { url "https://dl.bintray.com/agorapulse/libs" }
maven { url "https://repo.spring.io/release" }
}

license {
exclude '**/*.json'
exclude '***.yml'
}
}
gradleProjects {
subprojects {
dirs(['examples', 'libs']) {
dependencies {
annotationProcessor platform("io.micronaut:micronaut-bom:$micronautVersion")
annotationProcessor "io.micronaut:micronaut-inject-java"

api platform("io.micronaut:micronaut-bom:$micronautVersion")
api "io.micronaut:micronaut-runtime-groovy"
api "io.micronaut:micronaut-validation"

compileOnly "io.micronaut:micronaut-inject-groovy"

testImplementation("org.spockframework:spock-core") {
exclude group: "org.codehaus.groovy", module: "groovy-all"
}

testImplementation "io.micronaut.test:micronaut-test-spock"
testImplementation "io.micronaut:micronaut-inject-groovy"
testImplementation 'net.bytebuddy:byte-buddy:1.10.1'
testImplementation 'org.objenesis:objenesis:3.0.1'
}

subprojects { subproject ->
if (subproject.name == 'guide') return

apply plugin: 'groovy'
// useful for Micronaut
tasks.withType(GroovyCompile) {
groovyOptions.forkOptions.jvmArgs.add('-Dgroovy.parameters=true')
}

dependencies {
// add your global dependencies
}
// useful for Micronaut
tasks.withType(JavaCompile){
options.encoding = "UTF-8"
options.compilerArgs.add('-parameters')
}

// useful for Micronaut
tasks.withType(GroovyCompile) {
groovyOptions.forkOptions.jvmArgs.add('-Dgroovy.parameters=true')
}
// location independent tests (useful for stable CI builds)
tasks.withType(Test){
systemProperty 'user.timezone', 'UTC'
systemProperty 'user.language', 'en'
}

// useful for Micronaut
tasks.withType(JavaCompile){
options.encoding = "UTF-8"
options.compilerArgs.add('-parameters')
}
// useful for IntelliJ
task cleanOut(type: Delete) {
delete file('out')
}

// location independent tests (useful for stable CI builds)
tasks.withType(Test){
systemProperty 'user.timezone', 'UTC'
systemProperty 'user.language', 'en'
clean.dependsOn cleanOut
}
}
}
subprojects { subproject ->
if (subproject.name == 'guide') return

// useful for IntelliJ
task cleanOut(type: Delete) {
delete file('out')
}

clean.dependsOn cleanOut
}

check.dependsOn('aggregateCheckstyle', 'aggregateCodenarc', 'aggregateAllTestReports', 'coveralls')
49 changes: 49 additions & 0 deletions docs/guide/guide.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2019-2021 Agorapulse.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

config {
docs {
guide {
publish {
enabled = true
}
}
}
}

configurations {
asciidoctorExtensions
}

dependencies {
asciidoctorExtensions 'com.bmuschko:asciidoctorj-tabbed-code-extension:0.3'
}

asciidoctor {
configurations 'asciidoctorExtensions'

baseDirFollowsSourceDir()

attributes = [
'gradle-version': project.gradle.gradleVersion,
'source-highlighter': 'prettify',
'root-dir': rootDir,
'project-slug': slug
]

}
1 change: 1 addition & 0 deletions docs/guide/src/docs/asciidoc/.asciidoctorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
:includedir: {asciidoctorconfigdir}
Empty file.
13 changes: 13 additions & 0 deletions docs/guide/src/docs/asciidoc/configuration.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

[[_configuration]]
= Configuration

You need to provide `segment.api-key` configuration property to send information to Segment.

[source,yaml]
----
segment:
api-key: some-key
----

You can rely on `SegmentService` bean being always present but if the API key is missing then no-op implementation is provided.
Loading

0 comments on commit 7325e54

Please sign in to comment.