Updated setup #207
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Build" | |
| on: | |
| push: | |
| branches: | |
| - "**" | |
| pull_request: | |
| branches: | |
| - "**" | |
| - "!master" | |
| jobs: | |
| generate-build-matrix: | |
| runs-on: ubuntu-latest | |
| name: Generate build matrix | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - name: "Checkout repository" | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: "Generate matrix for the run job" | |
| id: set-matrix | |
| run: ./.github/scripts/generate-run-matrix.sh | |
| build: | |
| runs-on: ubuntu-latest | |
| name: Run build | |
| timeout-minutes: 30 | |
| steps: | |
| - name: "Checkout repository" | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: "Set up JDK" | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 21 | |
| distribution: temurin | |
| - name: "Setup gradle" | |
| uses: gradle/actions/setup-gradle@v4 | |
| with: | |
| cache-read-only: false | |
| gradle-version: wrapper | |
| add-job-summary: 'on-failure' | |
| - name: "Change active version" | |
| run: ./gradlew :stonecutterSwitchTo${{ matrix.version }} | |
| - name: "Parse gradle properties" | |
| id: gradle-properties | |
| run: ./.github/scripts/parse-gradle-properties.sh ${{ matrix.version }} | |
| - name: "Run build" | |
| run: ./gradlew buildActive | |
| - name: "Prepare artifacts" | |
| run: | | |
| mkdir -p artifacts | |
| find . -path "./*/versions/*/build/libs/*.jar" ! -name "*-common*.jar" -exec cp {} artifacts/ \; | |
| - name: "Upload artifacts" | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ steps.gradle-properties.outputs.MOD_ID }}-artifacts-${{ steps.gradle-properties.outputs.MOD_VERSION }} | |
| if-no-files-found: error | |
| path: artifacts/*.jar | |
| run-client: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.generate-build-matrix.outputs.matrix) }} | |
| name: Run ${{ matrix.mod_loader }} ${{ matrix.version }} ${{ matrix.script }} client | |
| timeout-minutes: 10 | |
| steps: | |
| - name: "Checkout repository" | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: "Set up JDK" | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 21 | |
| distribution: temurin | |
| - name: "Parse gradle properties" | |
| id: gradle-properties | |
| run: ./.github/scripts/parse-gradle-properties.sh ${{ matrix.version }} | |
| - name: "Download artifacts" | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ steps.gradle-properties.outputs.MOD_ID }}-artifacts-${{ steps.gradle-properties.outputs.MOD_VERSION }} | |
| path: artifacts | |
| - name: "Copy mod jar to run/mods" | |
| run: mkdir -p run/mods && cp artifacts/${{ steps.gradle-properties.outputs.MOD_ID }}-${{ matrix.mod_loader }}-${{ steps.gradle-properties.outputs.MOD_VERSION }}+mc${{ matrix.version }}.jar run/mods | |
| - name: "Download YACL" | |
| run: | | |
| MOD_URL=$(./.github/scripts/get-modrinth-dependency-url.sh "yacl" "${{ steps.gradle-properties.outputs.DEPS_YACL }}-${{ matrix.mod_loader }}" "${{ matrix.mod_loader }}") | |
| wget -P run/mods "$MOD_URL" | |
| - name: "Download ModMenu" | |
| if: ${{ matrix.mod_loader == 'fabric' }} | |
| run: | | |
| MOD_URL=$(./.github/scripts/get-modrinth-dependency-url.sh "modmenu" "${{ steps.gradle-properties.outputs.DEPS_MOD_MENU }}" "${{ matrix.mod_loader }}") | |
| wget -P run/mods "$MOD_URL" | |
| - name: "Download Repurposed Structures" | |
| if: ${{ steps.gradle-properties.outputs.DEPS_REPURPOSED_STRUCTURES != '' && matrix.version != '1.21.4' }} | |
| run: | | |
| MOD_URL=$(./.github/scripts/get-modrinth-dependency-url.sh "repurposed-structures-${{ matrix.mod_loader_modrinth }}" "${{ steps.gradle-properties.outputs.DEPS_REPURPOSED_STRUCTURES }}-${{ matrix.mod_loader }}" "${{ matrix.mod_loader }}") | |
| wget -P run/mods "$MOD_URL" | |
| - name: "Download MidnightLib" | |
| if: ${{ steps.gradle-properties.outputs.DEPS_MIDNIGHT_LIB != '' }} | |
| run: | | |
| MOD_URL=$(./.github/scripts/get-modrinth-dependency-url.sh "midnightlib" "${{ steps.gradle-properties.outputs.DEPS_MIDNIGHT_LIB }}-${{ matrix.mod_loader }}" "${{ matrix.mod_loader }}") | |
| wget -P run/mods "$MOD_URL" | |
| - name: Run ${{ matrix.version }} ${{ matrix.mod_loader }} client | |
| uses: 3arthqu4ke/mc-runtime-test@3.1.0 | |
| with: | |
| mc: ${{ matrix.version }} | |
| modloader: ${{ matrix.mod_loader }} | |
| regex: .*${{ matrix.mod_loader }}.* | |
| mc-runtime-test: ${{ matrix.mod_loader_alias }} | |
| java: ${{ steps.gradle-properties.outputs.JAVA_VERSION }} | |
| fabric-api: ${{ steps.gradle-properties.outputs.DEPS_FABRIC_API }} | |
| xvfb: false | |
| headlessmc-command: -lwjgl --retries 3 --jvm -Djava.awt.headless=true | |
| cache-mc: true | |
| run-server: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.generate-build-matrix.outputs.matrix) }} | |
| name: Run ${{ matrix.mod_loader }} ${{ matrix.version }} ${{ matrix.script }} server | |
| timeout-minutes: 10 | |
| steps: | |
| - name: "Checkout repository" | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: "Set up JDK" | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 21 | |
| distribution: temurin | |
| - name: "Parse gradle properties" | |
| id: gradle-properties | |
| run: ./.github/scripts/parse-gradle-properties.sh ${{ matrix.version }} | |
| - name: "Download artifacts" | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ steps.gradle-properties.outputs.MOD_ID }}-artifacts-${{ steps.gradle-properties.outputs.MOD_VERSION }} | |
| path: artifacts | |
| - name: "Copy mod jar to run/mods" | |
| run: mkdir -p run/mods && cp artifacts/${{ steps.gradle-properties.outputs.MOD_ID }}-${{ matrix.mod_loader }}-${{ steps.gradle-properties.outputs.MOD_VERSION }}+mc${{ matrix.version }}.jar run/mods | |
| - name: "Download YACL" | |
| run: | | |
| MOD_URL=$(./.github/scripts/get-modrinth-dependency-url.sh "yacl" "${{ steps.gradle-properties.outputs.DEPS_YACL }}-${{ matrix.mod_loader }}" "${{ matrix.mod_loader }}") | |
| wget -P run/mods "$MOD_URL" | |
| - name: "Download ModMenu" | |
| if: ${{ matrix.mod_loader == 'fabric' }} | |
| run: | | |
| MOD_URL=$(./.github/scripts/get-modrinth-dependency-url.sh "modmenu" "${{ steps.gradle-properties.outputs.DEPS_MOD_MENU }}" "${{ matrix.mod_loader }}") | |
| wget -P run/mods "$MOD_URL" | |
| - name: "Download Repurposed Structures" | |
| if: ${{ steps.gradle-properties.outputs.DEPS_REPURPOSED_STRUCTURES != '' && matrix.version != '1.21.4' }} | |
| run: | | |
| MOD_URL=$(./.github/scripts/get-modrinth-dependency-url.sh "repurposed-structures-${{ matrix.mod_loader_modrinth }}" "${{ steps.gradle-properties.outputs.DEPS_REPURPOSED_STRUCTURES }}-${{ matrix.mod_loader }}" "${{ matrix.mod_loader }}") | |
| wget -P run/mods "$MOD_URL" | |
| - name: Run ${{ matrix.version }} ${{ matrix.mod_loader }} server | |
| uses: headlesshq/mc-server-test@1.0.0 | |
| with: | |
| mc: ${{ matrix.version }} | |
| modloader: ${{ matrix.mod_loader }} | |
| java: ${{ steps.gradle-properties.outputs.JAVA_VERSION }} | |
| fabric-api: ${{ steps.gradle-properties.outputs.DEPS_FABRIC_API }} | |
| headlessmc-command: -lwjgl --retries 3 --jvm -Djava.awt.headless=true | |
| cache-mc: true |