Skip to content

Commit

Permalink
Prepare for Github actions building and release
Browse files Browse the repository at this point in the history
- Add GH actions workflows for Build and Release
- Remove maven as build framework
- Use JReleaser to release to both Maven Central and GitHub
  • Loading branch information
jdeppe-pivotal committed Jan 16, 2025
1 parent da89b9d commit b6466cc
Show file tree
Hide file tree
Showing 10 changed files with 206 additions and 777 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build and Test
on:
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'liberica'

- name: Setup Maven
uses: s4u/[email protected]
with:
githubServer: false
servers: |
[{
"id": "gemfire-broadcom-repo",
"username": "${{ secrets.SUPPORT_BROADCOM_COM_USERNAME }}",
"password": "${{ secrets.SUPPORT_BROADCOM_COM_PASSWORD }}"
}]
- name: Build and Test
shell: bash
run: |
./mvnw compile test
55 changes: 55 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Release

on:
workflow_dispatch:
push:
tags:
- v*

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

jobs:
publish:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'liberica'

- name: Setup Maven
uses: s4u/[email protected]
with:
githubServer: false
servers: |
[{
"id": "gemfire-broadcom-repo",
"username": "${{ secrets.SUPPORT_BROADCOM_COM_USERNAME }}",
"password": "${{ secrets.SUPPORT_BROADCOM_COM_PASSWORD }}"
},{
"id": "central",
"username": "${{ secrets.SONATYPE_ROBOT_USERNAME }}",
"password": "${{ secrets.SONATYPE_ROBOT_PASSWORD }}"
}]
- name: Build and Test
shell: bash
env:
MAVEN_GPG_KEY_FINGERPRINT: ${{ secrets.SIGNING_KEY_ID }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.SIGNING_KEY_PASSWORD }}
run: |
set -e -o pipefail
echo -n '${{ secrets.SIGNING_KEY_TGZ }}' | base64 -d | tar zxf - -C ${HOME} --exclude '*.lock'
RELEASE_RC=0
./gradlew -x test build publish jRelease --stacktrace || RELEASE_RC=$?
rm -rf ${HOME}/.gnupg
exit $RELEASE_RC
Binary file removed .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
18 changes: 0 additions & 18 deletions .mvn/wrapper/maven-wrapper.properties

This file was deleted.

6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# GemFire Distributed Types

[![maven](https://img.shields.io/maven-central/v/dev.gemfire/gemfire-distributed-types)](https://central.sonatype.com/artifact/dev.gemfire/gemfire-distributed-types/overview)
![build](https://github.com/gemfire/gemfire-distributed-types/actions/workflows/build.yaml/badge.svg)
[![javadoc](https://javadoc.io/badge2/dev.gemfire/gemfire-distributed-types/javadoc.svg)](https://javadoc.io/doc/dev.gemfire/gemfire-distributed-types)

### What is this?
Expand Down Expand Up @@ -124,7 +126,7 @@ verify that the extension has been found and initialized.

### Building

Building artifacts locally is best done using gradle. You will need to set the environment variables
Building artifacts locally is done using gradle. You will need to set the environment variables
`COMMERCIAL_MAVEN_USERNAME` and `COMMERCIAL_MAVEN_PASSWORD` to the username and access token
required by the Broadcom Maven repository:

Expand All @@ -134,6 +136,8 @@ export COMMERCIAL_MAVEN_PASSWORD=<ACCESS TOKEN>
./gradlew publishToMavenLocal extensionDistZip
```

This will also create the required `.gfm` file in `build/distributions/`.

### Implementation details

These types are primarily implemented using a partitioned region and function calls. Operations are
Expand Down
162 changes: 107 additions & 55 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@ plugins {
id 'java-library'
id 'distribution'
id 'maven-publish'
id 'org.jreleaser' version '1.16.0'
}

// COMPILE THINGS ////////////////////////////////////////////

import groovy.xml.*
import org.gradle.util.VersionNumber

final jbossModuleName = "${project.group}.${project.name}:${VersionNumber.parse(project.version).major}"

targetCompatibility = '1.8'

group 'dev.gemfire'
Expand All @@ -26,48 +34,13 @@ repositories {
}
}

publishing {
publications {
maven(MavenPublication) {
pom {
name = "${project.group}:${project.name}"
description = 'A collection of distributed types for use wih GemFire'
url = 'https://github.com/gemfire/gemfire-distributed-typed'
developers {
developer {
name = 'Jens Deppe'
email = '[email protected]'
organization = 'Broadcom'
organizationUrl = 'https://broadcom.com'
}
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
scm {
url = 'https://github.com/gemfire/gemfire-distributed-types'
connection = 'scm:git:git://github.com/gemfire/gemfire-distributed-types.git'
developerConnection = 'scm:git:ssh://github.com:gemfire/gemfire-distributed-types.git'
}
}

from components.java
}
}
java {
withSourcesJar()
withJavadocJar()
}

repositories {
maven {
name = "Broadcom"
url = project.findProperty("publishRepository")
credentials {
username = System.getenv("PUBLISH_MAVEN_USERNAME")
password = System.getenv("PUBLISH_MAVEN_PASSWORD")
}
}
}
test {
useJUnit()
}

configurations {
Expand All @@ -89,20 +62,6 @@ dependencies {
testImplementation('com.vmware.gemfire:gemfire-dunit:10.1.1')
}

java {
withSourcesJar()
withJavadocJar()
}

test {
useJUnit()
}

import groovy.xml.*
import org.gradle.util.VersionNumber

final jbossModuleName = "${project.group}.${project.name}:${VersionNumber.parse(project.version).major}"

tasks.register("generateModuleXml") { task ->
final file = file(task.temporaryDir.toPath().resolve("module.xml"))
doLast {
Expand All @@ -127,6 +86,8 @@ tasks.register("generateModuleXml") { task ->
outputs.file(file)
}

// BUNDLING THINGS ////////////////////////////////

distributions {
extension {
distributionBaseName = distributionPrefix
Expand All @@ -144,6 +105,97 @@ distributions {
}
}

// RELEASE THINGS ////////////////////////////////

jreleaser {
project {
description = 'GemFire Distributed Types'
copyright = 'Copyright 2024 Broadcom. All rights reserved.'
website = 'must not be blank'
docsUrl = 'must not be blank'
license = 'must not be blank'
authors = ['must not be blank']
}
signing {
active = 'ALWAYS'
armored = true
verify = false
mode = 'COMMAND'
}

deploy {
maven {
mavenCentral {
sonatype {
active = 'ALWAYS'
url = 'https://central.sonatype.com/api/v1/publisher'
stagingRepository('build/staging-deploy')
applyMavenCentralRules = true
stage = 'UPLOAD'
}
}
}
}

distributions {
extension {
distributionType = 'BINARY'
artifact {
path = 'build/distributions/gemfire-distributed-types-0.1.2.gfm'
}
}
}

release {
github {
repoOwner = 'gemfire'
name = 'gemfire-distributed-types'
draft = true
skipTag = false
}
}
}

publishing {
publications {
maven(MavenPublication) {
pom {
name = "${project.group}:${project.name}"
description = 'A collection of distributed types for use wih GemFire'
url = 'https://github.com/gemfire/gemfire-distributed-typed'
developers {
developer {
name = 'Jens Deppe'
email = '[email protected]'
organization = 'Broadcom'
organizationUrl = 'https://broadcom.com'
}
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
scm {
url = 'https://github.com/gemfire/gemfire-distributed-types'
connection = 'scm:git:git://github.com/gemfire/gemfire-distributed-types.git'
developerConnection = 'scm:git:ssh://github.com:gemfire/gemfire-distributed-types.git'
}
}

from components.java
artifact tasks.named('extensionDistZip')
}
}

repositories {
maven {
url = layout.buildDirectory.dir('staging-deploy')
}
}
}

extensionDistZip {
eachFile { file ->
String path = file.relativePath
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 @@ -4,6 +4,6 @@

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit b6466cc

Please sign in to comment.