-
-
Notifications
You must be signed in to change notification settings - Fork 36
141 lines (127 loc) · 3.96 KB
/
example.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
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