forked from Wurst-Imperium/Wurst7
-
Notifications
You must be signed in to change notification settings - Fork 2
134 lines (118 loc) · 3.75 KB
/
gradle.yml
File metadata and controls
134 lines (118 loc) · 3.75 KB
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
name: Java CI with Gradle
on:
push:
branches-ignore:
- "dependabot/**"
tags-ignore:
- "**"
paths:
- "**.java"
- "**.json"
- "**.yml"
- "gradle**"
- "*.gradle"
- "*.accesswidener"
pull_request:
paths:
- "**.java"
- "**.json"
- "**.yml"
- "gradle**"
- "*.gradle"
- "*.accesswidener"
workflow_dispatch:
inputs:
distinct_id:
required: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Echo distinct ID ${{ inputs.distinct_id }}
run: echo ${{ inputs.distinct_id }}
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Java 21
uses: actions/setup-java@v5
with:
java-version: "21"
distribution: "microsoft"
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
with:
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/help/legal-terms-of-use"
build-scan-terms-of-use-agree: "yes"
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
cache-read-only: ${{ github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/heads/1.') }}
- name: Resolve dependencies
run: |
max_attempts=3
attempt=1
until ./gradlew dependencies --stacktrace; do
if [ $attempt -ge $max_attempts ]; then
echo "Failed to resolve dependencies after $max_attempts attempts"
exit 1
fi
echo "Attempt $attempt failed, retrying in 30 seconds..."
attempt=$((attempt + 1))
sleep 30
done
- name: Build
run: ./gradlew build --stacktrace --warning-mode=fail
- name: Upload to VirusTotal for analysis
id: virustotal
env:
VIRUSTOTAL_API_KEY: ${{ secrets.VIRUSTOTAL_API_KEY }}
if: ${{ env.VIRUSTOTAL_API_KEY }}
uses: crazy-max/ghaction-virustotal@v4
with:
vt_api_key: ${{ env.VIRUSTOTAL_API_KEY }}
files: |
./build/libs/*.jar
# An error in this step means that the upload failed, not that a false
# positive was detected.
continue-on-error: true
- name: Add VirusTotal links to build summary
if: ${{ steps.virustotal.outputs.analysis }}
run: |
echo "<details open>" >> $GITHUB_STEP_SUMMARY
echo "<summary>🛡️ VirusTotal Scans</summary>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
IFS=',' read -ra ANALYSIS <<< "${{ steps.virustotal.outputs.analysis }}"
for i in "${ANALYSIS[@]}"; do
filepath=${i%%=*}
url=${i#*=}
filename=$(basename "$filepath")
echo "- [$filename]($url)" >> $GITHUB_STEP_SUMMARY
done
echo "</details>" >> $GITHUB_STEP_SUMMARY
- name: Run client gametests
env:
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }}
run: ./gradlew runClientGameTest --stacktrace --warning-mode=fail
- name: Run client gametests with mods
env:
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }}
run: ./gradlew runClientGameTestWithMods --stacktrace --warning-mode=fail
- name: Upload screenshots
uses: actions/upload-artifact@v6
if: ${{ success() || failure() }}
with:
name: screenshots
path: build/run/*/screenshots
compression-level: 0
- name: Upload logs
uses: actions/upload-artifact@v6
if: ${{ success() || failure() }}
with:
name: logs
path: build/run/*/logs/latest.log
- name: Upload crash reports
uses: actions/upload-artifact@v6
if: ${{ failure() }}
with:
name: crash-reports
path: build/run/*/crash-reports