Modernize Gradle buildscript #71
33
.github/workflows/build.yml
vendored
Normal 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 }}
|
||||
|
||||
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
|
||||
![]() This shouldnt be needed, it should be executable on the repo. This shouldnt be needed, it should be executable on the repo.
![]() 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.
![]() 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.
|
16
.github/workflows/validate-gradle-wrapper.yml
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
![]() Id just move this into the other workflow Id just move this into the other workflow
![]() 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.
|
||||
![]() 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
|
||||
![]() Id just move this into the other workflow Id just move this into the other workflow
|
||||
# wrapper from a local gradle install.
|
||||
![]() Id just move this into the other workflow Id just move this into the other workflow
|
||||
|
||||
![]() Id just move this into the other workflow Id just move this into the other workflow
|
||||
name: validate gradle wrapper
|
||||
![]() Id just move this into the other workflow Id just move this into the other workflow
|
||||
|
||||
![]() Id just move this into the other workflow Id just move this into the other workflow
|
||||
on: [pull_request, push]
|
||||
![]() Id just move this into the other workflow Id just move this into the other workflow
|
||||
|
||||
![]() Id just move this into the other workflow Id just move this into the other workflow
|
||||
jobs:
|
||||
![]() Id just move this into the other workflow Id just move this into the other workflow
|
||||
build:
|
||||
![]() Id just move this into the other workflow Id just move this into the other workflow
|
||||
runs-on: ubuntu-20.04
|
||||
![]() Id just move this into the other workflow Id just move this into the other workflow
|
||||
steps:
|
||||
![]() Id just move this into the other workflow Id just move this into the other workflow
|
||||
- name: checkout repository
|
||||
![]() Id just move this into the other workflow Id just move this into the other workflow
|
||||
uses: actions/checkout@v2
|
||||
![]() Id just move this into the other workflow Id just move this into the other workflow
|
||||
- name: validate gradle wrapper
|
||||
![]() Id just move this into the other workflow Id just move this into the other workflow
|
||||
uses: gradle/wrapper-validation-action@v1
|
||||
![]() Id just move this into the other workflow Id just move this into the other workflow
|
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've run into platform-specific issues before, in my own projects and what I've seen in some other repos:
git
.These can be caught by running CI builds on multiple operating systems.