Run with example repository #1111
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: 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@v3 | |
- name: Set up JDK 1.8 | |
uses: actions/setup-java@v3 | |
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 "::set-output name=version::$(./gradlew properties -q | grep "^version:" | awk '{print $2}')" | |
- uses: actions/upload-artifact@v3 | |
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.1" | |
- "7.0" | |
- "7.6" | |
- "8.0" | |
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@v3 | |
with: | |
ref: ${{ env.EXAMPLE_BRANCH }} | |
repository: anatawa12/ForgeGradle-example | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '8' | |
- uses: actions/download-artifact@v2 | |
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@v2 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 5 | |
command: ./gradlew --init-script=useLocal.init.gradle ${{ matrix.setting }} --stacktrace | |
- name: Run Build Task | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 5 | |
command: ./gradlew --init-script=useLocal.init.gradle build --stacktrace | |
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 |