Skip to content

Run with example repository #1543

Run with example repository

Run with example repository #1543

Workflow file for this run

name: Run with example repository
on:
push:
branches:
- FG_1.2
- FG_1.2-*
pull_request:
branches:
- FG_1.2
- FG_1.2-*
workflow_dispatch: {}
schedule:
- cron: '0 0 * * *'
concurrency:
group: ${{ github.event_name }}-${{ github.ref }}-example
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 1.8
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '8'
- name: Build with Gradle
run: ./gradlew --init-script=./scripts/disableSign.init.gradle publishToMavenLocal
- name: copy useLocal.init.gradle
run: cp ./scripts/useLocal.init.gradle ~/.m2/repository/
- name: get version name
id: get-version
run: echo "version=$(./gradlew properties -q | grep "^version:" | awk '{print $2}')" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v4
with:
name: maven-repository
path: ~/.m2/repository
outputs:
version: ${{ steps.get-version.outputs.version }}
example:
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
gradle:
# run test for all supported major versions
- "4.10.3"
- "5.0"
- "5.6.4"
- "6.0"
- "6.9.4"
- "7.0"
- "7.6.2"
- "8.0"
- "8.10.1"
setting:
- none # just build
- setupDecompWorkspace
- setupDevWorkspace
- setupCiWorkspace
useWrapper:
- true
- false
steps:
- name: choose branch
env:
GRADLE: ${{ matrix.gradle }}
run: |
case $GRADLE in
4.*) echo "EXAMPLE_BRANCH=test-heads/4" >> $GITHUB_ENV ;;
8.*) echo "EXAMPLE_BRANCH=test-heads/8" >> $GITHUB_ENV ;;
*) echo "EXAMPLE_BRANCH=master" >> $GITHUB_ENV ;;
esac
- uses: actions/checkout@v4
with:
ref: ${{ env.EXAMPLE_BRANCH }}
repository: anatawa12/ForgeGradle-example
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '8'
- uses: actions/download-artifact@v4
with:
name: maven-repository
path: ~/.m2/repository
- name: copy useLocal.init.gradle
run: cp ~/.m2/repository/useLocal.init.gradle .
- name: Setup Gradle Wrapper
run: |
touch empty
./gradlew --build-file=empty wrapper --gradle-version=${{ matrix.gradle }}
./gradlew --build-file=empty wrapper
rm empty
- name: Patch requested ForgeGradle version
env:
VERSION: ${{ needs.build.outputs.version }}
run: |
sed -i "s/com\.anatawa12\.forge:ForgeGradle:1\.2-[.+0-9a-zA-Z-]*/com.anatawa12.forge:ForgeGradle:$VERSION/" build.gradle
- name: setup for wrapper artifact
if: ${{ matrix.useWrapper == 'true' }}
run: |
echo "com.anatawa12.forge.gradle.wrapper-artifact=true" >> gradle.properties
- name: Run Setup Task
if: ${{ matrix.setting != 'none' }}
uses: nick-invision/retry@v3
with:
timeout_minutes: 5
max_attempts: 5
command: ./gradlew --init-script=useLocal.init.gradle ${{ matrix.setting }} --stacktrace --warning-mode all
- name: Run Build Task
uses: nick-invision/retry@v3
with:
timeout_minutes: 5
max_attempts: 5
command: ./gradlew --init-script=useLocal.init.gradle build --stacktrace --warning-mode all
conclude:
runs-on: ubuntu-latest
if: ${{ always() }}
needs: [build, example]
steps:
- name: Conclude Tests
env: { NEEDS: "${{ toJSON(needs) }}" }
run: |
echo "$NEEDS" | jq -c '. | to_entries[] | [.key, .value.result]'
echo "$NEEDS" | jq -e '. | all(.result == "success")' > /dev/null