ci: fix build task graph requiring "Refresh active projects" which br… #173
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: Gradle CI (new) | |
on: | |
push: | |
paths-ignore: | |
- 'README.md' | |
- 'LICENSE' | |
- '.gitignore' | |
- '.editorconfig' | |
- 'changelog.md' | |
- 'docs' | |
pull_request: | |
jobs: | |
generate-build-matrix: | |
runs-on: ubuntu-latest | |
name: Generate build matrix | |
outputs: | |
matrix: ${{ steps.generate-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get potential versions | |
id: generate-matrix | |
run: | | |
MATRIX=$(jq -c '{include: (.branches[""] | map({target: ., experimental: (test("exp"))}))}' ./versions/versions.json) | |
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT | |
build: | |
needs: generate-build-matrix | |
runs-on: ubuntu-latest | |
name: Build with gradle | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.generate-build-matrix.outputs.matrix) }} | |
continue-on-error: ${{ matrix.experimental == 'true' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: temurin | |
- name: Setup gradle | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
cache-read-only: false | |
- name: Overwrite current version | |
run: printf "${{ matrix.target }}" | cut -d':' -f1 > ./versions/current | |
- name: Refresh stonecutter comments | |
run: ./gradlew "Refresh active project" --stacktrace | |
- name: Build ${{ matrix.target }} | |
run: ./gradlew buildAndCollectActive --stacktrace | |
env: | |
CI_SINGLE_BUILD: ${{ matrix.target }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: build/finalJars/*.jar | |
name: ${{ matrix.target }} | |
# run: | |
# needs: build | |
# runs-on: ubuntu-latest | |
# name: Run Minecraft | |
# | |
# strategy: | |
# matrix: | |
# target: ${{ fromJson(needs.retrieve-targets.outputs.targets) }} |