Skip to content

Commit

Permalink
Added JavaDoc to Pipeline
Browse files Browse the repository at this point in the history
Added CheckStyle
Added EditorConfig
  • Loading branch information
rjhancock committed Sep 18, 2024
1 parent efd9232 commit a34257d
Show file tree
Hide file tree
Showing 6 changed files with 526 additions and 8 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true
charset = "utf-8"

[*.java]
indent_style = "space"
indent_size = 4
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 100 # Google Style Guide
curly_bracket_next_line = false
spaces_around_operators = true
spaces_around_brackets = "both"
indent_brace_style = "K&R"
wildcard_import_limit = 10
continuation_indent_size = 4 # Google Style Guid
6 changes: 0 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,6 @@ jobs:
fail_ci_if_error: false
verbose: true

# - name: Upload Zip Release
# uses: actions/upload-artifact@v4
# with:
# name: mml-release-zip-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}
# path: ./megameklab/megameklab/build/distributions/*.zip

- name: Upload TarGZ Release
uses: actions/upload-artifact@v4
with:
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/javadoc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: JavaDoc Generation

on:
pull_request:
branches: [master]

env:
GRADLE_OPTS: "-Dscan.link.VCS=${{ github.event.pull_request.html_url }}"

jobs:
ci_cd:
runs-on: ${{ matrix.os }}

outputs:
mmRepo: ${{ steps.find_mm.outputs.mmRepo }}
mmBranch: ${{ steps.find_mm.outputs.mmBranch }}

strategy:
matrix:
os: [ubuntu-latest] # For CI/CD running on *nix is sufficient
java-distribution: [temurin]
java-version: [17]
fail-fast: false

steps:
- name: Checking out MegaMekLab
uses: actions/checkout@v4
with:
path: megameklab

- name: Find the Right MegaMek Branch
id: find_mm
shell: bash {0}
run: |
git ls-remote --exit-code --heads ${{ github.event.pull_request.head.repo.owner.html_url }}/megamek.git ${{ github.event.pull_request.head.ref }}
if [ "$?" == "0" ]
then
echo "mmRepo=${{ github.event.pull_request.head.repo.owner.login }}/megamek" >> $GITHUB_OUTPUT
echo "mmBranch=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT
else
echo "mmRepo=MegaMek/megamek" >> $GITHUB_OUTPUT
echo "mmBranch=master" >> $GITHUB_OUTPUT
fi
exit 0
- name: Checkout MegaMek
uses: actions/checkout@v4
with:
repository: ${{ steps.find_mm.outputs.mmRepo }}
ref: ${{ steps.find_mm.outputs.mmBranch }}
path: megamek

- name: Set up ${{ matrix.java-distribution }} JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4
with:
distribution: ${{ matrix.java-distribution }}
java-version: ${{ matrix.java-version }}

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Build with Gradle
working-directory: megameklab
run: ./gradlew javadoc
21 changes: 19 additions & 2 deletions megameklab/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import java.time.LocalDateTime

plugins {
id 'application'
id 'checkstyle'
id 'com.palantir.git-version' version '3.1.0'
id 'edu.sc.seis.launch4j' version '3.0.6'
id "io.sentry.jvm.gradle" version "4.11.0"
id 'jacoco'
id 'java'
id "io.sentry.jvm.gradle" version "4.11.0"
id 'com.palantir.git-version' version '3.1.0'
id 'org.ec4j.editorconfig' version '0.1.0'
}

java {
Expand Down Expand Up @@ -89,6 +91,12 @@ application {
mainClass = 'megameklab.MegaMekLab'
}

checkstyle {
toolVersion '10.18.1'
configFile file("config/checkstyle/checkstyle.xml")
ignoreFailures false
}

jar {
archiveFileName = "MegaMekLab.jar"
manifest {
Expand Down Expand Up @@ -259,3 +267,12 @@ task cleanAll() {
dependsOn gradle.includedBuild('megamek').task(':megamek:clean')
dependsOn clean
}

tasks.withType(Checkstyle) {
minHeapSize = "200m"
maxHeapSize = "1g"
reports {
xml.required = false
html.required = true
}
}
Loading

0 comments on commit a34257d

Please sign in to comment.