build #54
Workflow file for this run
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: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| create: # for Git tag creations | |
| jobs: | |
| compile-cubiomes: | |
| name: Compile Cubiomes to shared library | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: 'true' | |
| - name: Compile shared library (ubuntu-latest) | |
| if: matrix.os == 'ubuntu-latest' | |
| working-directory: src/main/c/cubiomes | |
| run: | | |
| cmake -S . -B build -DCMAKE_BUILD_TYPE=Release | |
| cmake --build build --config Release | |
| cp build/libcubiomes.so ../../resources/libcubiomes.so | |
| - name: Compile shared library (macos-latest) | |
| if: matrix.os == 'macos-latest' | |
| working-directory: src/main/c/cubiomes | |
| run: | | |
| cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" | |
| cmake --build build --config Release | |
| cp build/libcubiomes.dylib ../../resources/libcubiomes.dylib | |
| - name: Set up MSYS2 (windows-latest) | |
| if: matrix.os == 'windows-latest' | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| update: true | |
| install: > | |
| base-devel | |
| mingw-w64-x86_64-toolchain | |
| mingw-w64-x86_64-cmake | |
| mingw-w64-x86_64-ninja | |
| - name: Compile shared library (windows-latest) | |
| if: matrix.os == 'windows-latest' | |
| working-directory: src/main/c/cubiomes | |
| shell: msys2 {0} | |
| run: | | |
| cmake -S . -B build -DCMAKE_BUILD_TYPE=Release | |
| cmake --build build --config Release | |
| cp build/cubiomes.dll ../../resources/cubiomes.dll | |
| - name: Compute SHA256 hash (ubuntu-latest) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: sha256sum src/main/resources/libcubiomes.so | |
| - name: Compute SHA256 hash (macos-latest) | |
| if: matrix.os == 'macos-latest' | |
| run: shasum -a 256 src/main/resources/libcubiomes.dylib | |
| - name: Compute SHA256 hash (windows-latest) | |
| if: matrix.os == 'windows-latest' | |
| run: Get-FileHash -Algorithm SHA256 src/main/resources/cubiomes.dll | |
| - name: Capture shared library (ubuntu-latest) | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: libcubiomes.so | |
| path: src/main/resources/libcubiomes.so | |
| - name: Capture shared library (macos-latest) | |
| if: matrix.os == 'macos-latest' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: libcubiomes.dylib | |
| path: src/main/resources/libcubiomes.dylib | |
| - name: Capture shared library (windows-latest) | |
| if: matrix.os == 'windows-latest' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: cubiomes.dll | |
| path: src/main/resources/cubiomes.dll | |
| build: | |
| name: Build SeedMapper | |
| needs: compile-cubiomes | |
| runs-on: ubuntu-latest | |
| env: | |
| LLVM_HOME: /usr/lib/llvm-13 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: 'true' | |
| - name: Capture shared library | |
| uses: actions/download-artifact@v8 | |
| with: | |
| merge-multiple: true | |
| path: src/main/resources/ | |
| - name: Validate gradle wrapper | |
| uses: gradle/actions/wrapper-validation@v5 | |
| - name: Setup JDK 25 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: 25 | |
| distribution: 'temurin' | |
| - name: Make Gradle wrapper executable | |
| run: | | |
| chmod +x ./gradlew | |
| chmod +x ./jextract/gradlew | |
| - name: Install LLVM 13 | |
| run: | | |
| wget --no-verbose https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz | |
| tar -xf clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz | |
| sudo mv clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-20.04 $LLVM_HOME | |
| - name: Compile jextract | |
| working-directory: jextract | |
| run: ./gradlew --stacktrace -Pjdk_home=$JAVA_HOME -Pllvm_home=$LLVM_HOME clean verify | |
| - name: Build | |
| run: ./gradlew build | |
| - name: Capture build artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: SeedMapper | |
| path: build/libs/ | |
| # if a Git tag was created, verify it is for a stable version to make a release | |
| validate-tag: | |
| name: Validate tag | |
| needs: build | |
| if: github.ref_type == 'tag' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| valid: ${{ steps.check_tag.outputs.valid }} | |
| steps: | |
| - name: Check tag format | |
| id: check_tag | |
| run: | | |
| TAG="${GITHUB_REF_NAME}" | |
| if [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "valid=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "valid=false" >> $GITHUB_OUTPUT | |
| fi | |
| release: | |
| name: Release SeedMapper | |
| needs: validate-tag | |
| if: needs.validate-tag.outputs.valid == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Capture JAR | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: SeedMapper | |
| path: build/libs/ | |
| - name: Setup JDK 25 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: 25 | |
| distribution: 'temurin' | |
| - name: Make Gradle wrapper executable | |
| run: chmod +x ./gradlew | |
| - name: Release artifact | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} | |
| run: ./gradlew publishMods --stacktrace |