1- # This workflow uses actions that are not certified by GitHub.
2- # They are provided by a third-party and are governed by
3- # separate terms of service, privacy policy, and support
4- # documentation.
5- # This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
6- # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
1+ # Automatically build the project and run any configured tests for every push
2+ # and submitted pull request. This can help catch issues that only occur on
3+ # certain platforms or Java versions, and provides a first line of defence
4+ # against bad commits.
75
86name : build
97on : [pull_request, push]
108
11- permissions :
12- contents : read
13-
149jobs :
1510 build :
16- runs-on : ubuntu-latest
11+ strategy :
12+ matrix :
13+ # Use these Java versions
14+ java : [
15+ 17, # Current Java LTS & minimum supported by Minecraft
16+ 21, # Current Java LTS
17+ ]
18+ # and run on both Linux and Windows
19+ os : [ubuntu-22.04, windows-2022]
20+ runs-on : ${{ matrix.os }}
1721 steps :
18- - uses : actions/checkout@v4
19- - name : Set up JDK 17
20- uses : actions/setup-java@v3
21- with :
22- java-version : ' 17'
23- distribution : ' temurin'
24- - name : Validate Gradle wrapper
25- uses : gradle/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4
26- - name : Build with Gradle
27- uses : gradle/gradle-build-action@982da8e78c05368c70dac0351bb82647a9e9a5d2
28- with :
29- arguments : build
30- - uses : actions/upload-artifact@v4
31- with :
32- name : Artifacts
33- path : build/libs
22+ - name : checkout repository
23+ uses : actions/checkout@v4
24+ - name : validate gradle wrapper
25+ uses : gradle/wrapper-validation-action@v1
26+ - name : setup jdk ${{ matrix.java }}
27+ uses : actions/setup-java@v4
28+ with :
29+ java-version : ${{ matrix.java }}
30+ distribution : ' microsoft'
31+ - name : make gradle wrapper executable
32+ if : ${{ runner.os != 'Windows' }}
33+ run : chmod +x ./gradlew
34+ - name : build
35+ run : ./gradlew build
36+ - name : capture build artifacts
37+ if : ${{ runner.os == 'Linux' && matrix.java == '21' }} # Only upload artifacts built from latest java on one OS
38+ uses : actions/upload-artifact@v3
39+ with :
40+ name : Artifacts
41+ path : build/libs/
0 commit comments