Modernize Gradle buildscript #71

Merged
zml2008 merged 4 commits from feature/gradle-modernization into master 2020-11-10 22:11:54 +00:00
2 changed files with 49 additions and 0 deletions
Showing only changes of commit afea5b64a1 - Show all commits

33
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,33 @@
# Automatically build the project and run any configured tests for every push
# and submitted pull request. This can help catch issues that only occur on
# certain platforms or Java versions, and provides a first line of defence
# against bad commits.
name: build
on: [pull_request, push]
jobs:
build:
strategy:
matrix:
# Use these Java versions
java: [
1.8, # Minimum supported by Minecraft
11, # Current Java LTS
15 # Latest version
]
# and run on both Linux and Windows
os: [ubuntu-20.04, windows-latest]
runs-on: ${{ matrix.os }}
modmuss50 commented 2020-11-02 10:56:52 +00:00 (Migrated from github.com)
Review

I would just do ubuntu only, I dont think building on windows provides any benefit. Building on windows would double the amount of stuff to download, and increase the amount github has to build (I know its free, but dont want to wase it for the sake of it)

I would just do ubuntu only, I dont think building on windows provides any benefit. Building on windows would double the amount of stuff to download, and increase the amount github has to build (I know its free, but dont want to wase it for the sake of it)
zml2008 commented 2020-11-03 05:58:05 +00:00 (Migrated from github.com)
Review

I've run into platform-specific issues before, in my own projects and what I've seen in some other repos:

  • checkstyle doesn't normalize path separators in its suppressions file, so that can end up only working on one OS
  • some parts of path handling differ, between different line separators and handling of symlinks -- though these would only really be caught by unit tests
  • When developing on a case-insensitive filesystem (like windows has), renaming a class or folder in a way that only changes its case will not be captured by git.

These can be caught by running CI builds on multiple operating systems.

I've run into platform-specific issues before, in my own projects and what I've seen in some other repos: - checkstyle doesn't normalize path separators in its suppressions file, so that can end up only working on one OS - some parts of path handling differ, between different line separators and handling of symlinks -- though these would only really be caught by unit tests - When developing on a case-insensitive filesystem (like windows has), renaming a class or folder in a way that only changes its case will not be captured by `git`. These can be caught by running CI builds on multiple operating systems.
steps:
- name: checkout repository
uses: actions/checkout@v2
- name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: build
run: ./gradlew build
modmuss50 commented 2020-11-02 10:57:15 +00:00 (Migrated from github.com)
Review

This shouldnt be needed, it should be executable on the repo.

This shouldnt be needed, it should be executable on the repo.
JamiesWhiteShirt commented 2020-11-02 16:12:49 +00:00 (Migrated from github.com)
Review

Depending on the method used to replicate this repo, the file mode may be lost. I don't think it should be removed.

Depending on the method used to replicate this repo, the file mode may be lost. I don't think it should be removed.
zml2008 commented 2020-11-03 05:41:09 +00:00 (Migrated from github.com)
Review

Yeah, windows generally doesn't preserve file permissions -- I've had it happen a few times before when setting up gradle wrapper.

There's no harm to keeping it there -- it'll basically be a no-op if the repo is set up correctly, but removes one more thing that could go wrong.

Yeah, windows generally doesn't preserve file permissions -- I've had it happen a few times before when setting up gradle wrapper. There's no harm to keeping it there -- it'll basically be a no-op if the repo is set up correctly, but removes one more thing that could go wrong.

View File

@ -0,0 +1,16 @@
modmuss50 commented 2020-11-02 10:55:34 +00:00 (Migrated from github.com)
Review

Id just move this into the other workflow

Id just move this into the other workflow
modmuss50 commented 2020-11-02 10:55:34 +00:00 (Migrated from github.com)
Review

Id just move this into the other workflow

Id just move this into the other workflow
# Ensure the gradle wrapper in the repository has not been tampered with.
modmuss50 commented 2020-11-02 10:55:34 +00:00 (Migrated from github.com)
Review

Id just move this into the other workflow

Id just move this into the other workflow
# If this check fails, something is seriously wrong -- try creating a new
modmuss50 commented 2020-11-02 10:55:34 +00:00 (Migrated from github.com)
Review

Id just move this into the other workflow

Id just move this into the other workflow
# wrapper from a local gradle install.
modmuss50 commented 2020-11-02 10:55:34 +00:00 (Migrated from github.com)
Review

Id just move this into the other workflow

Id just move this into the other workflow
modmuss50 commented 2020-11-02 10:55:34 +00:00 (Migrated from github.com)
Review

Id just move this into the other workflow

Id just move this into the other workflow
name: validate gradle wrapper
modmuss50 commented 2020-11-02 10:55:34 +00:00 (Migrated from github.com)
Review

Id just move this into the other workflow

Id just move this into the other workflow
modmuss50 commented 2020-11-02 10:55:34 +00:00 (Migrated from github.com)
Review

Id just move this into the other workflow

Id just move this into the other workflow
on: [pull_request, push]
modmuss50 commented 2020-11-02 10:55:34 +00:00 (Migrated from github.com)
Review

Id just move this into the other workflow

Id just move this into the other workflow
modmuss50 commented 2020-11-02 10:55:34 +00:00 (Migrated from github.com)
Review

Id just move this into the other workflow

Id just move this into the other workflow
jobs:
modmuss50 commented 2020-11-02 10:55:34 +00:00 (Migrated from github.com)
Review

Id just move this into the other workflow

Id just move this into the other workflow
build:
modmuss50 commented 2020-11-02 10:55:34 +00:00 (Migrated from github.com)
Review

Id just move this into the other workflow

Id just move this into the other workflow
runs-on: ubuntu-20.04
modmuss50 commented 2020-11-02 10:55:34 +00:00 (Migrated from github.com)
Review

Id just move this into the other workflow

Id just move this into the other workflow
steps:
modmuss50 commented 2020-11-02 10:55:34 +00:00 (Migrated from github.com)
Review

Id just move this into the other workflow

Id just move this into the other workflow
- name: checkout repository
modmuss50 commented 2020-11-02 10:55:34 +00:00 (Migrated from github.com)
Review

Id just move this into the other workflow

Id just move this into the other workflow
uses: actions/checkout@v2
modmuss50 commented 2020-11-02 10:55:34 +00:00 (Migrated from github.com)
Review

Id just move this into the other workflow

Id just move this into the other workflow
- name: validate gradle wrapper
modmuss50 commented 2020-11-02 10:55:34 +00:00 (Migrated from github.com)
Review

Id just move this into the other workflow

Id just move this into the other workflow
uses: gradle/wrapper-validation-action@v1
modmuss50 commented 2020-11-02 10:55:34 +00:00 (Migrated from github.com)
Review

Id just move this into the other workflow

Id just move this into the other workflow