Files
rivencraft/.github/workflows/build.yml
T
2026-11-14 12:17:49 -05:00

65 lines
2.0 KiB
YAML

name: Build and smoke
on: [push, pull_request]
permissions:
contents: read
jobs:
changes:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.targets.outputs.matrix }}
any: ${{ steps.targets.outputs.any }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check release workflow safeguards
run: python3 scripts/test_release_workflow.py -v
- id: targets
env:
BASE: ${{ github.event.pull_request.base.sha || github.event.before }}
run: |
base="$BASE"
if [ -z "$base" ] || ! git cat-file -e "$base^{commit}" 2>/dev/null; then
base=$(git rev-parse HEAD^)
fi
matrix=$(python3 scripts/changed_targets.py --base "$base")
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
if [ "$matrix" = '{"include":[]}' ]; then
echo "any=false" >> "$GITHUB_OUTPUT"
else
echo "any=true" >> "$GITHUB_OUTPUT"
fi
build:
needs: changes
if: needs.changes.outputs.any == 'true'
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
max-parallel: 1
matrix: ${{ fromJSON(needs.changes.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: temurin
- uses: gradle/actions/setup-gradle@v4
- name: Build Minecraft target
run: ./gradlew ${{ matrix.gradle_args }} --console=plain
- name: Disposable dedicated-server smoke
run: python3 scripts/smoke_server.py --target ${{ matrix.target }}
- name: Keep smoke logs
if: always()
uses: actions/upload-artifact@v4
with:
name: smoke-${{ matrix.target }}
path: build/verification/${{ matrix.target }}/*.log
if-no-files-found: ignore