Skip to content

Commit

Permalink
Merge pull request #70 from coffeenet/gradle-build
Browse files Browse the repository at this point in the history
Migrate from Maven to Gradle
  • Loading branch information
punycode committed Apr 13, 2020
2 parents 9a2403f + 556009e commit efcb250
Show file tree
Hide file tree
Showing 52 changed files with 1,297 additions and 1,725 deletions.
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# These are explicitly windows files and should use crlf
*.bat text eol=crlf

65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: "CoffeeNet: CI/CD"

on:
push:
branches:
- master
pull_request:

jobs:
pipeline:
name: Pipeline
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Fetch target branch for SonarQube branch analysis
run: |
git fetch --no-tags --prune origin \
+refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
if: github.event_name == 'pull_request'
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Verify Gradle Wrapper version
uses: gradle/wrapper-validation-action@v1
- name: Recreate Gradle wrapper cache
uses: actions/cache@v1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/**/*') }}
restore-keys: |
${{ runner.os }}-gradle-wrapper-
- name: Recreate Gradle build/dependency cache
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build and verify with Gradle
run: |
if [ ! -z $SONAR_TOKEN ]; then
./gradlew --build-cache check sonarqube \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.organization=coffeenet \
-Dsonar.projectKey=rocks.coffeenet:coffeenet-starter
else
./gradlew --build-cache check
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Publish SNAPSHOT artifacts to Sonatype OSSRH
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
./gradlew -Psonatype build publishToSonatype
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
38 changes: 0 additions & 38 deletions .github/workflows/maven.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/post-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "CoffeeNet: Post Release"

on:
release:
types: [published]

jobs:
coffeenet_updater:
name: Update ${{ matrix.application }}
runs-on: ubuntu-latest
strategy:
matrix:
application:
- coffeenet/coffeenet-auth
- coffeenet/coffeenet-discovery
- coffeenet/coffeenet-config-server
- coffeenet/coffeenet-frontpage
- coffeenet/coffeenet-frontpage-plugin-rss
- coffeenet/coffeenet-frontpage-plugin-islieb
- coffeenet/coffeenet-frontpage-plugin-clock
- coffeenet/coffeenet-frontpage-plugin-api
- coffeenet/coffeenet-frontpage-plugin-influx
- coffeenet/example-projects
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Checkout ${{ matrix.application }}
uses: actions/checkout@v2
with:
repository: ${{ matrix.application }}
path: target-application
- name: Update version dependency on ${{ matrix.application }}
run: |
echo "::warning::Not implemented yet"
75 changes: 75 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: "CoffeeNet: Release Pipeline"

on:
push:
tags: 'v*'

jobs:
publish:
name: Publish artifacts
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Verify if releasing from master
run: |
git fetch --no-tags --prune origin +refs/heads/master:refs/remotes/origin/master
git merge-base --is-ancestor ${{ github.ref }} refs/heads/master
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Verify Gradle Wrapper version
uses: gradle/wrapper-validation-action@v1
- name: Recreate Gradle wrapper cache
uses: actions/cache@v1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/**/*') }}
restore-keys: |
${{ runner.os }}-gradle-wrapper-
- name: Build and verify with Gradle
run: |
./gradlew check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish artifacts to Sonatype OSSRH
run: |
./gradlew -Psonatype build publishToSonatype
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}

github:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: publish
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Extract release notes
run: |
release_notes=$(awk -v r=1 '/^##[[:space:]]+/ { n++; next }; n==r; n==r+1 { exit }' CHANGELOG.md)
if [ -z $(echo -n $release_notes | tr -d '[:space:]') ]; then
echo "::error::Release notes are empty. Shouldn't happen"
else
release_notes="${release_notes//'%'/'%25'}"
release_notes="${release_notes//$'\n'/'%0A'}"
release_notes="${release_notes//$'\r'/'%0D'}"
echo "::set-env name=RELEASE_NOTES::$release_notes"
fi
- name: Create GitHub Release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: ${{ env.RELEASE_NOTES }}
draft: false
prerelease: false
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
.idea/
target/
*.iml
coffeenet-autoconfigure/logs
coffeenet-autoconfigure/*.graphml
.flattened-pom.xml

**/.flattened-pom.xml
# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build
!/**/src/**/build
117 changes: 0 additions & 117 deletions .mvn/wrapper/MavenWrapperDownloader.java

This file was deleted.

Binary file removed .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
2 changes: 0 additions & 2 deletions .mvn/wrapper/maven-wrapper.properties

This file was deleted.

Loading

0 comments on commit efcb250

Please sign in to comment.