diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..e275ee7 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,42 @@ +name: build +on: [pull_request, push] + +jobs: + build: + strategy: + matrix: + java: [ + 21 # Minimum supported by Minecraft + ] + os: [ubuntu-20.04, windows-latest] + mod_loader: [fabric, forge, neoforge] # Add loaders to matrix + runs-on: ${{ matrix.os }} + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Validate gradle wrapper + uses: gradle/wrapper-validation-action@v1 + + - name: Setup JDK ${{ matrix.java }} + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.java }} + + - name: Make gradle wrapper executable (Linux only) + if: ${{ runner.os != 'Windows' }} + run: chmod +x ./gradlew + + - name: Build Common Module + run: ./gradlew :common:build + + # Build for specific mod loader based on matrix + - name: Build ${{ matrix.mod_loader }} Loader + run: ./gradlew :${{ matrix.mod_loader }}:build + + - name: Capture Build Artifacts + if: ${{ runner.os == 'Linux' && matrix.java == '21' }} # Only on Linux and latest Java + uses: actions/upload-artifact@v4 + with: + name: artifacts-${{ matrix.mod_loader }} + path: ${{ matrix.mod_loader }}/build/libs/