Verified Commit 23b20e92 authored by Yannick Schinko's avatar Yannick Schinko
Browse files

Initial commit!

[ci skip]
parent 5abac7be
Pipeline #381 skipped
# Auto detect text files and perform LF normalization
* text=auto
# Detect correct language
*.gradle linguist-language=Groovy
# Contribution Guidelines
We will always have a need for developers to help us improve this project. There is no such thing as a perfect project and things can always be improved. If you
are a developer and are interested in helping then please do not hesitate. Just make sure you follow our guidelines.
<!-- TOC depthFrom:2 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->
- [Cloning and Setting up](#cloning-and-setting-up)
- [Cloning](#cloning)
- [Adding Hooks](#adding-hooks)
- [Setting up a Dev Env](#setting-up-a-dev-env)
- [Translating](#translating)
- [Code Style](#code-style)
- [Adding Code](#adding-code)
- [Adding Resources](#adding-resources)
<!-- /TOC -->
## Cloning and Setting up
### Prerequisites
All my projects currently use Java 8 (as that's what the MC community stuck to).
So make sure you have a Java 8 JDK installed!
If the `java` command is not stemming from that Java 8 JDK installation, you can set the environment variable `JAVA_HOME` to the path of the JDK installation.
Gradle will properly pick it up and you will not run into issues.
**If you are running into weird issues while building first verify this!**
### Cloning
Since this repository has a submodule you'll need to add the `--recursive` flag. So clone it like this:
```
mc_dev $ git clone --recursive https://github.com/AuraDevelopmentTeam/<project>.git
```
Should you have forgotten to to do that, don't worry you can easily fix it by running this command:
```
mc_dev/<project> $ git submodule update --init --recursive
```
#### Adding Hooks
I highly recommend adding some hooks to automatically checkout the right version of the submodule when you change versions, update the repo, etc.
To do that juts run the provided gradle task: `./gradlew addGitHooks`.
All it does is copy the hooks from `GradleCommon/hooks` to `.git/hooks`.
## Translating
If you wish to add a translation or expand an existing one, I have another super useful gradle task for you! Just run `./gradlew checkTranslations`. This will
compare all translations to the base translation and make sure there aren't any extraneous or missing translation keys. So if you're adding the `ab_YZ`
translation and after running the task a `ab_YZ.lang.txt` file appears in the base directory, then you did something wrong. However this file will contain a
full report of the mismatched keys.
## Code Style
### Adding Code
We strictly follow the [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html).
To make it easier for you we have provided the configuration files for Eclipse and IntelliJ in `/GradleCommon/formatter`. Also we have included a gradle task
that will format the code to the precise standard! So please run `./gradlew spotlessApply` before committing.
### Adding Resources
When adding PNG files make sure to save them with 24 or 32 bits and run `./gradlew optimizePng` (you'll need to have `optipng` available in your path though).
Finally when you add JSON files be sure to run `./gradlew formatJson` to ensure a clean formatting.
patreon: AuraDev
name: Code Checks
on: [push, pull_request]
env:
GRADLE_OPTS: >-
-Dorg.gradle.internal.launcher.welcomeMessageEnabled=false
GRADLE_CMD_OPTS: >-
-PbranchName="${{ github.ref }}"
--console=plain
--continue
--no-build-cache
--no-daemon
--parallel
jobs:
spotless:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-java@v1
with:
java-version: 8
java-package: jdk
architecture: x64
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Check code formatting
run: ./gradlew ${{ env.GRADLE_CMD_OPTS }} spotlessCheck
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-java@v1
with:
java-version: 8
java-package: jdk
architecture: x64
- name: Checkout submodules
run: git submodule update --init --recursive
- uses: burrunan/gradle-cache-action@v1
name: Cache .gradle
with:
# Disable caching of $HOME/.gradle/caches/*.*/generated-gradle-jars
save-generated-gradle-jars: false
# Disable caching of ~/.gradle/caches/build-cache-*
save-local-build-cache: false
# Enable caching of ~/.gradle/caches/modules-*
save-gradle-dependencies-cache: true
# Enable caching of ~/.m2/repository/
save-maven-dependencies-cache: true
- name: Build all files
run: ./gradlew ${{ env.GRADLE_CMD_OPTS }} assemble compileTest
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
needs: [build]
steps:
- run: |
ref="${github_ref////-}"
echo "ref=$ref" >> $GITHUB_ENV
env:
github_ref: ${{ github.ref }}
shell: bash
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-java@v1
with:
java-version: 8
java-package: jdk
architecture: x64
- name: Checkout submodules
run: git submodule update --init --recursive
# This is to ensure unit tests with MariaDB4j don't fail
- name: Symlinks for MacOS
if: ${{ runner.os == 'MacOS' }}
run: |
sudo ln -s /usr/lib/libssl.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
sudo ln -s /usr/lib/libcrypto.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
- uses: burrunan/gradle-cache-action@v1
name: Cache .gradle
with:
# Disable caching of $HOME/.gradle/caches/*.*/generated-gradle-jars
save-generated-gradle-jars: false
# Disable caching of ~/.gradle/caches/build-cache-*
save-local-build-cache: false
# Enable caching of ~/.gradle/caches/modules-*
save-gradle-dependencies-cache: true
# Enable caching of ~/.m2/repository/
save-maven-dependencies-cache: true
- name: Run all Tests
id: gradle_tests
run: ./gradlew ${{ env.GRADLE_CMD_OPTS }} -x spotlessCheck build
- uses: actions/upload-artifact@v2
if: success() || failure()
with:
name: ${{ env.ref }}_code-checks_${{ matrix.os }}
path: |
**/build/test-results/test/TEST-*.xml
**/build/reports/spotbugs/*.xml
name: Code Checks Reports
on:
workflow_run:
workflows: ["Code Checks"]
types:
- completed
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- run: |
ref="${github_ref////-}"
echo "ref=$ref" >> $GITHUB_ENV
env:
github_ref: ${{ github.ref }}
shell: bash
- uses: dawidd6/action-download-artifact@v2
with:
workflow: code_checks.yml
name: ${{ env.ref }}_code-checks_${{ matrix.os }}
- name: Publish JUnit Test Reports
if: success() || failure()
uses: mikepenz/action-junit-report@v1
with:
report_paths: '**/build/test-results/test/TEST-*.xml'
github_token: ${{ github.token }}
check_name: 'JUnit Test Report (OS: ${{ matrix.os }})'
- name: Publish SpotBugs Reports
if: success() || failure()
uses: jwgmeligmeyling/spotbugs-github-action@v1.2
with:
path: '**/build/reports/spotbugs/*.xml'
token: ${{ github.token }}
name: 'SpotBugs Report (OS: ${{ matrix.os }})'
name: Language File Checks
on:
push:
paths:
- '**/resources/assets/*/lang/*.lang'
pull_request:
paths:
- '**/resources/assets/*/lang/*.lang'
workflow_dispatch:
env:
GRADLE_OPTS: >-
-Dorg.gradle.internal.launcher.welcomeMessageEnabled=false
GRADLE_CMD_OPTS: >-
-PbranchName="${{ github.ref }}"
--console=plain
--continue
--no-build-cache
--no-daemon
--parallel
jobs:
checkTranslations:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-java@v1
with:
java-version: 8
java-package: jdk
architecture: x64
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Check code formatting
run: ./gradlew ${{ env.GRADLE_CMD_OPTS }} checkTranslations
- name: Print checkTranslations report files
if: failure()
run: tail -n +1 *.lang.txt
#- name: Publish Language File Checks
# if: success() || failure()
# uses: actions/upload-artifact@v2
# with:
# name: checkTranslations
# path: '**.lang.txt'
#################
## Gradle
#################
.gradle/
build/
gradle-app.setting
# Test reports
*-TestReport*
# Coverage reports
*-CoverageReport*
# Spotbugs reports
*-SpotbugsReport*
# MC related folders
run/
logs/
#################
## Eclipse
#################
*.pydevproject
.project
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# PDT-specific
.buildpath
#################
## IntelliJ
#################
.idea/
*.iml
*.ipr
*.iws
#############
## Windows detritus
#############
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Mac crap
.DS_Store
#################
## Dev Env
#################
run
*.lang.txt
variables:
GIT_SUBMODULE_STRATEGY: recursive
CACHE_KEY: "$CI_COMMIT_REF_NAME $CI_COMMIT_SHA"
ORIG_ARTIFACTS1: "$CI_PROJECT_DIR/**/build/libs/*.jar*"
ORIG_ARTIFACTS2: "$CI_PROJECT_DIR/**/build/distributions/*.zip*"
ARTIFACTS1: "$CI_PROJECT_DIR/*.jar*"
ARTIFACTS2: "$CI_PROJECT_DIR/*.zip*"
TEST_REPORTS: "$CI_PROJECT_DIR/*-TestReport.zip"
TEST_DATA: "$CI_PROJECT_DIR/**/build/test-results/*/TEST-*.xml"
JACOCO_DATA: "$CI_PROJECT_DIR/**/build/jacoco/*"
TRANSLATION_REPORTS: "$CI_PROJECT_DIR/**/*.lang.txt"
COVERAGE_REPORTS: "$CI_PROJECT_DIR/*-CoverageReport.zip"
SPOTBUGS_REPORTS: "$CI_PROJECT_DIR/*-SpotbugsReport.zip"
JAVADOCS: "$CI_PROJECT_DIR/*-javadoc.jar"
GRADLE_OPTS: >
-Dorg.gradle.project.branchName="$CI_COMMIT_REF_NAME"
cache:
policy: pull
key: "$CACHE_KEY"
untracked: true
before_script:
- shopt -s globstar
- shopt -s nullglob
stages:
- build
- test
- report
- deploy
build:
stage: build
tags:
- linux
- shell
cache:
policy: push
key: "$CACHE_KEY"
untracked: true
script:
- ./gradlew --console=plain assemble compileTest
- cp $ORIG_ARTIFACTS1 $ORIG_ARTIFACTS2 .
retry: 2
when: on_success
artifacts:
paths:
- $ARTIFACTS1
- $ARTIFACTS2
test:
stage: test
tags:
- linux
- shell
cache:
policy: pull-push
key: "$CACHE_KEY"
untracked: true
needs:
- job: build
artifacts: false
script:
- ./gradlew --continue --console=plain test
retry: 2
when: on_success
artifacts:
when: always
paths:
- $TEST_REPORTS
- $JACOCO_DATA
reports:
junit:
- $TEST_DATA
checkFormatting:
stage: test
tags:
- linux
- shell
needs: []
script:
- ./gradlew --continue --console=plain spotlessCheck
allow_failure: true
when: on_success
checkTranslations:
stage: test
tags:
- linux
- shell
needs: []
script:
- ./gradlew --continue --console=plain checkTranslations
allow_failure: true
when: on_success
artifacts:
when: on_failure
paths:
- $TRANSLATION_REPORTS
coverage:
stage: report
tags:
- linux
- shell
needs:
- job: test
artifacts: true
script:
- ./gradlew --continue --console=plain -x test coverage
coverage: "/Covered (\\d{1,3}\\.\\d{2}%) of instructions for all projects\\./"
allow_failure: true
when: on_success
artifacts:
when: always
paths:
- $COVERAGE_REPORTS
spotbugs:
stage: report
tags:
- linux
- shell
needs:
- job: build
artifacts: false
script:
- ./gradlew --continue --console=plain spotbugs
allow_failure: true
when: on_success
artifacts:
when: always
paths:
- $SPOTBUGS_REPORTS
deploySnapshot:
stage: deploy
tags:
- linux
- shell
needs:
- job: build
artifacts: true
script:
- ./gradlew --console=plain uploadArchives $(echo "$CI_COMMIT_MESSAGE" | grep -qF "[release]" && echo releaseSnapshot)
retry: 2
when: always
except:
- tags
deploy:
stage: deploy
tags:
- linux
- shell
needs:
- job: build
artifacts: true
script:
- ./gradlew --console=plain release
retry: 2
when: always
only:
- tags
sendCoverage:
stage: deploy
tags:
- linux
- shell
needs:
- job: coverage
artifacts: true
script:
- ./gradlew --console=plain sendCoverageToCodacy
retry: 2
when: on_success
pages:
stage: deploy
tags:
- linux
- shell
needs:
- job: build
artifacts: true
- job: test
artifacts: true
- job: checkTranslations
artifacts: true
- job: coverage
artifacts: true
- job: spotbugs
artifacts: true
script:
- for file in $JAVADOCS; do dir="public/javadoc/$(basename "$file" | cut -d. -f1 | rev | cut -d- -f1 --complement | rev)"; mkdir -p "$dir"; unzip "$file" -d "$dir"; done
- for file in $TEST_REPORTS; do dir="public/test/$(basename "$file" | rev | cut -d- -f1 --complement | rev)"; mkdir -p "$dir"; unzip "$file" -d "$dir"; done
- for file in $TRANSLATION_REPORTS; do dir="public/checkTranslations/$(basename "$(dirname "$file")")"; mkdir -p "$dir"; cp "$file" "$dir"; done
- for file in $COVERAGE_REPORTS; do dir="public/coverage/$(basename "$file" | rev | cut -d- -f1 --complement | rev)"; mkdir -p "$dir"; unzip "$file" -d "$dir"; done
- for file in $SPOTBUGS_REPORTS; do dir="public/spotbugs/$(basename "$file" | rev | cut -d- -f1 --complement | rev)"; mkdir -p "$dir"; unzip "$file" -d "$dir"; done
- GradleCommon/scripts/make_directory_listings.sh
- find public -type f -regex '.*\.\(html?\|te?xt\|js\|css\|jpe?g\|png\|gif\)$' -exec gzip -fk9 {} \;
when: always
artifacts:
paths:
- public
[submodule "GradleCommon"]
path = GradleCommon
url = https://github.com/AuraDevelopmentTeam/GradleCommon.git
language: java
dist: trusty
jdk:
- oraclejdk8
- openjdk8
git:
depth: false
env:
GRADLE_OPTS: >-
-Dorg.gradle.internal.launcher.welcomeMessageEnabled=false
GRADLE_CMD_OPTS: >-
--console=plain
--continue
--no-daemon
--parallel
install: "./gradlew $GRADLE_CMD_OPTS assemble compileTest"
script: "./gradlew $GRADLE_CMD_OPTS build"
Subproject commit 0f1fcd933b1e3da7ac92dd67a795899724f0f0af
apply from: "GradleCommon/common.gradle"
repositories {
// Additional repositories
}
dependencies {
// Additional dependencies
}
# All commented out settings show their default value and can be left out, if they will not be changed.
# Values in parentheses (only for default values) will be filled with the evaluated value.
# Plugin Name is preferably set in the settings.gradle file.
# If Forge:
# org.gradle.jvmargs=-Xmx3G
type=none
pluginId=emptyproject
# pluginName=(project.name)
# baseGroup=team.aura_dev
# description=Empty description