Skip to content

Commit

Permalink
CI Updates (#1285)
Browse files Browse the repository at this point in the history
* CI Updates

- Add: GitHub actions CI.
- Add: Code Coverage.
- Add: Static code scanning.
- Fix: Travis-CI

* Updated AgriCore

- Fix: Bad test in AgriCore causing failed builds.
- Add: Updated readme to reflect known gradle compilation isssues.

* Fix VSCode Task

- Fix: Gradle `genVSCodeRuns` task now works properly.
- Fix: Removed bad exception classes from InfinityLib that aren't valid on OpenJDK.
  • Loading branch information
RlonRyan committed Jan 19, 2021
1 parent b12fa98 commit d3d5651
Show file tree
Hide file tree
Showing 9 changed files with 335 additions and 35 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '15 5 * * 6'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language: [ 'java' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Checkout submodules
run: git submodule update --init --recursive

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
44 changes: 44 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# 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 ]
pull_request:
branches: [ master ]

jobs:

validate:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1.0.3

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Checkout submodules
run: git submodule update --init --recursive
- 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: Build with Gradle
run: ./gradlew assemble -S
- name: Test with Gradle
run: ./gradlew check -S
- name: Publish Code Coverage Report
run: bash <(curl -s https://codecov.io/bash)
- name: JUnit Report
uses: mikepenz/action-junit-report@v1.2.1
68 changes: 54 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,37 +1,77 @@
# Ignore Rundirs.
run/

# Ignore IDE Files.
# =============================================================================
# AgriCraft .gitignore
# =============================================================================

# -----------------------------------------------------------------------------
# IDE Ignores
# -----------------------------------------------------------------------------

# Eclipse
eclipse/
.nb-gradle/

# JetBrains
.idea/

# Netbeans
.nb-gradle
.nb-gradle-properties
nbproject

# VSCode
.vscode
.classpath
.project
.settings/
.settings

# -----------------------------------------------------------------------------
# Gradle Ignores
# -----------------------------------------------------------------------------

# Ignore Gradle Stuff
gradle.properties
.gradle/

# Ignore Git
.git/

# Ignore Build Files
build/
dist/
out/
logs/
bin/

*.iml
*.ipr
*.iws
Schematic_to_Java*
schematics/
# -----------------------------------------------------------------------------
# ForgeGradle Ignores
# -----------------------------------------------------------------------------

# Ignore Rundirs.
run/

# -----------------------------------------------------------------------------
# AgriCraft Ignores
# -----------------------------------------------------------------------------

# Ignore Dependencies
libs/
AgriCraft_Dependencies.rar
dependencies.zip
*.bak
*.bak

# -----------------------------------------------------------------------------
# General Ignores
# -----------------------------------------------------------------------------

# Ignore Git
.git/

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Mac Junk
.DS_Store

# Unknown Ignores
*.iml
*.ipr
*.iws
Schematic_to_Java*
schematics/
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ before_install:

# Prepare the workspace.
install:
- ./gradlew setupCIWorkspace -S
- ./gradlew assemble -S

# Build the Project.
script:
- ./gradlew build -S
- ./gradlew check -S

# Push success to CurseForge for release.
# after_success:
Expand Down
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# AgriCraft [![build]][build-link] ![branch][] ![minecraft][] [![curse]][curse-link]
# AgriCraft ![branch] [![build]][build-link] [![coverage]][coverage-link] [![curse]][curse-link]

Agricultural farming extended.

Expand All @@ -24,18 +24,42 @@ However before reporting a bug please update to the latest version of the mod to
If you want to post bug reports for older versions, make sure to tell me what version you are using and the version of Forge you are using.
If you report a bug and I request more feedback, the label 'Awaiting reply' will be added, if I have had no response for 5 days after adding that label, the issue will be closed.


## Technical Documentation [![wiki]][wiki-link]

AgriCraft is documented in the official GitHub wiki. Note that
this kind of information is, most of the time, only needed by pack creators and not the average user.

## Compilation Notes

The latest versions of ForgeGradle require some tweaking to get builds working. The two most important things to note are as follows:

1. ForgeGradle does not like JDKs newer than JDK8. To develop install [openjdk8](https://adoptopenjdk.net/?variant=openjdk8&jvmVariant=hotspot), and update `gradle.propeties` to contain the following:
```
org.gradle.java.home = C:\\Program Files\\AdoptOpenJDK\\jdk-8.0.275.1-hotspot
```

2. The default JVM heap size is too small to handle decompilation of MineCraft. Builds fail without increasing the heap size that Gradle allocates for the build. Update `gradle.propeties` to contain the following:
```
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
```

> Note: We do not provide a default `gradle.properties` file as it is discouraged by the Gradle documentation, given that the file may contain maven login information and the likes.
[branch]:https://img.shields.io/badge/branch-master-aaaaff.svg "GitHub Branch"

[build-link]:https://travis-ci.org/AgriCraft/AgriCraft
[build]:https://travis-ci.org/AgriCraft/AgriCraft.svg?branch=master "Travis-CI Build Status"
[branch]:https://img.shields.io/badge/branch-master-aaaaff.svg "GitHub Branch"

[coverage]:https://codecov.io/gh/AgriCraft/AgriCore/branch/master/graph/badge.svg?token=DIEBA4U1AH
[coverage-link]:https://codecov.io/gh/AgriCraft/AgriCore

[minecraft]:https://agricraft.github.io/versions/1.12/minecraft.svg "Minecraft Version"
[curse-link]:http://agricraft.github.io/curse

[curse-link]:https://agricraft.github.io/curse
[curse]:http://cf.way2muchnoise.eu/full_agricraft_downloads.svg "CurseForge"

[contact-link]:https://agricraft.github.io/contact
[contact]:https://agricraft.github.io/images/contact.svg "InfinityRaider Contact"

Expand Down
Loading

0 comments on commit d3d5651

Please sign in to comment.