Skip to content

Commit

Permalink
feat(build): add semantic versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
Silthus committed May 3, 2020
1 parent b9a1795 commit cdedcfd
Show file tree
Hide file tree
Showing 18 changed files with 5,896 additions and 123 deletions.
6 changes: 6 additions & 0 deletions .github/auto-merge.yml
@@ -0,0 +1,6 @@
minApprovals:
NONE: 0
requiredLabels:
- dependencies
updateBranch: true
mergeMethod: rebase
83 changes: 43 additions & 40 deletions .github/workflows/gradle.yml
@@ -1,45 +1,48 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Java CI with Gradle

on:
push:
branches:
- master
- next
pull_request:
branches:
- master
- next

name: Build
on: [push, pull_request]
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Cache Gradle packages
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle

- name: Build
run: ./gradlew build

- name: Upload build artifacts
uses: actions/upload-artifact@v1
with:
name: Plugin
path: build/libs
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11

- name: Set up NodeJS
uses: actions/setup-node@v1
with:
node-version: 14

- name: Cache Gradle packages
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle

- uses: actions/checkout@v1

- name: Build
run: ./gradlew
- name: Upload build artifacts
uses: actions/upload-artifact@v1
with:
name: Plugin
path: build/libs

- name: Upload Test Report
uses: actions/upload-artifact@v1
if: always()
with:
name: build reports
path: build/reports

- name: Release
run: |
yarn install
yarn semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
189 changes: 189 additions & 0 deletions .gitignore
Expand Up @@ -14,3 +14,192 @@ build/
working/*
!working/server.properties
/.idea/

# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2

.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.pnp.*
4 changes: 4 additions & 0 deletions .nvmrc
@@ -0,0 +1,4 @@
14

# semantic-release 4.0 recommends to use 10 or above
# https://github.com/commitizen/cz-cli/pull/649
50 changes: 41 additions & 9 deletions build.gradle
@@ -1,7 +1,37 @@
buildscript {
repositories {
mavenCentral()
}
}

plugins {
id 'com.github.johnrengelman.shadow' version '5.1.0'
id 'kr.entree.spigradle' version '1.2.1'
id 'java'
id 'jacoco'
id 'net.ltgt.apt-eclipse' version '0.21'
id 'com.diffplug.gradle.spotless' version '3.28.1'
id 'net.ltgt.errorprone' version '1.1.1'
id 'se.patrikerdes.use-latest-versions' version '0.2.13'
id 'com.github.ben-manes.versions' version '0.28.0'
}

apply from: "$rootDir/gradle/jacoco.gradle"
apply from: "$rootDir/gradle/spotless.gradle"
apply from: "$rootDir/gradle/errorprone.gradle"
apply from: "$rootDir/gradle/publish.gradle"

sourceCompatibility = 11
targetCompatibility = 11

ext {
//Define one of the supported mc versions
mcVersion = project.property("mcVersion")
packageName = project.property("packageName")
junitVersion = '5.6.2'
guavaVersion = '29.0-jre'
immutablesVersion = '2.8.7'
errorproneVersion = '2.3.4'
}

group project.property("group")
Expand All @@ -14,8 +44,7 @@ spigot {
// depends = ['']
}

sourceCompatibility = 1.8
targetCompatibility = 1.8


compileJava {
options.encoding = 'UTF-8'
Expand Down Expand Up @@ -48,15 +77,11 @@ repositories {
maven { url = "https://repo.aikar.co/content/groups/aikar/" }
}

ext {
//Define one of the supported mc versions
mcVersion = project.property("mcVersion")
packageName = project.property("packageName")
}

dependencies {
//Adds the spigot api to your plugin
compileOnly "org.spigotmc:spigot-api:${mcVersion}-R0.1-SNAPSHOT"
compileOnly "org.immutables:value:${immutablesVersion}:annotations"
annotationProcessor "org.immutables:value:${immutablesVersion}"

//Add your dependencies here
compile "co.aikar:acf-bukkit:0.5.0-SNAPSHOT"
Expand All @@ -65,6 +90,7 @@ dependencies {
testCompile "org.mockito:mockito-core:3.+"
testImplementation 'junit:junit:4.12'
testImplementation 'com.github.seeseemelk:MockBukkit-v1.15:0.3.0-SNAPSHOT'
errorprone "com.google.errorprone:error_prone_core:${errorproneVersion}"
}

test {
Expand Down Expand Up @@ -93,7 +119,11 @@ task copyPluginYaml(type: Copy, dependsOn: spigotPluginYaml) {
into(sourceSets.main.resources.srcDirs[0])
}

task deploy(type: Copy, dependsOn: ['cleanPlugin', 'jar']) {
task deploy(type: Copy, dependsOn: [
'cleanPlugin',
'spotlessApply',
'jar'
]) {
group 'deploy'
description 'Exports you plugin to the plugin directory in your test server'

Expand Down Expand Up @@ -141,3 +171,5 @@ task setupServer {

new URL(url).withInputStream { i -> server.withOutputStream { it << i } }
}

defaultTasks 'spotlessApply', 'build', 'deploy'

0 comments on commit cdedcfd

Please sign in to comment.