Merge branch 'mc-1.21.x' into mc-1.21.y #3113
This file contains 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, pull_request] | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: π₯ Clone repository | |
uses: actions/checkout@v4 | |
- name: π₯ Set up Java | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: 'temurin' | |
- name: π₯ Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
cache-read-only: ${{ !startsWith(github.ref, 'refs/heads/mc-') }} | |
- name: Disable Gradle daemon | |
run: | | |
mkdir -p ~/.gradle | |
echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties | |
- name: βοΈ Build | |
run: ./gradlew assemble || ./gradlew assemble | |
- name: Cache pre-commit | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: π‘ Lint | |
run: | | |
pipx install pre-commit | |
pre-commit run --show-diff-on-failure --color=always | |
- name: π§ͺ Run tests | |
run: ./gradlew test validateMixinNames checkChangelog | |
- name: π₯ Download assets for game tests | |
run: ./gradlew downloadAssets || ./gradlew downloadAssets | |
- name: π§ͺ Run integration tests | |
run: ./gradlew runGametest | |
- name: π§ͺ Parse test reports | |
run: ./tools/parse-reports.py | |
if: ${{ failure() }} | |
- name: π¦ Prepare Jars | |
run: | | |
# Find the main jar and append the git hash onto it. | |
mkdir -p jars | |
find projects/forge/build/libs projects/fabric/build/libs -type f -regex '.*[0-9.]+\(-SNAPSHOT\)?\.jar$' -exec bash -c 'cp {} "jars/$(basename {} .jar)-$(git rev-parse HEAD).jar"' \; | |
- name: π€ Upload Jar | |
uses: actions/upload-artifact@v4 | |
with: | |
name: CC-Tweaked | |
path: ./jars | |
build-core: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: Windows | |
uses: windows-latest | |
- name: macOS | |
uses: macos-latest | |
name: Test on ${{ matrix.name }} | |
runs-on: ${{ matrix.uses }} | |
steps: | |
- name: π₯ Clone repository | |
uses: actions/checkout@v4 | |
- name: π₯ Set up Java | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: 'temurin' | |
- name: π₯ Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
cache-read-only: ${{ !startsWith(github.ref, 'refs/heads/mc-') }} | |
- name: βοΈ Build | |
run: | | |
./gradlew --configure-on-demand :core:assemble | |
- name: π§ͺ Run tests | |
run: | | |
./gradlew --configure-on-demand :core:test | |
- name: π§ͺ Parse test reports | |
run: python3 ./tools/parse-reports.py | |
if: ${{ failure() }} |