-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
229 lines (227 loc) · 9.36 KB
/
action.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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
name: Diff DBM test output
description: Runs DBM tests on two commits and pushes the resulting output into a repository to get a diff
branding:
icon: book
color: blue
inputs:
dbm-offline-repo:
default: DeadlyBossMods/DBM-Offline
dbm-offline-ref:
default: ""
dbm-main-repo:
default: DeadlyBossMods/DeadlyBossMods
dbm-main-ref:
default: ""
dbm-main-base-ref:
default: ""
dbm-mod-repo-vanilla:
default: "DeadlyBossMods/DBM-Vanilla"
dbm-mod-ref-vanilla:
default: ""
dbm-mod-base-ref-vanilla:
default: ""
dbm-mod-repo-dungeons:
default: "DeadlyBossMods/DBM-Dungeons"
dbm-mod-ref-dungeons:
default: ""
dbm-mod-base-ref-dungeons:
default: ""
test-dbm-core-mods:
default: false
test-dbm-vanilla-mods:
default: false
test-dbm-dungeon-mods:
default: false
upload-repo:
default: "DeadlyBossMods/DBM-Test-Results"
required: true
upload-repo-branch:
required: true
upload-token:
required: true
comment-token:
required: false
diff-mode:
default: "true"
runs:
using: composite
steps:
- name: Setup and DBM-Offline dependencies
shell: bash
run: |
mkdir -p dbm-offline-diff
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get install -y lua5.1 luarocks subversion
sudo luarocks --lua-version 5.1 install bitlib
sudo luarocks --lua-version 5.1 install luafilesystem
- name: Checkout DBM-Offline
uses: actions/checkout@v4
with:
repository: ${{ inputs.dbm-offline-repo }}
ref: ${{ inputs.dbm-offline-ref }}
path: ./dbm-offline-diff/DBM-Offline
- name: Checkout DBM main repo (New)
uses: actions/checkout@v4
with:
repository: ${{ inputs.dbm-main-repo }}
ref: ${{ inputs.dbm-main-ref }}
path: ./dbm-offline-diff/DeadlyBossMods-new
- name: Checkout DBM main repo (Base)
if: ${{ inputs.diff-mode == 'true' }}
uses: actions/checkout@v4
with:
repository: ${{ inputs.dbm-main-repo }}
ref: ${{ inputs.dbm-main-base-ref }}
path: ./dbm-offline-diff/DeadlyBossMods-base
- name: Download DBM dependencies
uses: BigWigsMods/packager@master
with:
args: -z -d -c -t ./dbm-offline-diff/DeadlyBossMods-new
- name: Install DBM dependencies
shell: bash
run: |
cp -r ./dbm-offline-diff/DeadlyBossMods-new/.release/DBM-Core/Libs ./dbm-offline-diff/DeadlyBossMods-new/DBM-Core/
# FIXME: this is slightly incorrect and won't work if a dependency was removed
cp -r ./dbm-offline-diff/DeadlyBossMods-new/.release/DBM-Core/Libs ./dbm-offline-diff/DeadlyBossMods-base/DBM-Core/ || true
- name: Checkout DBM-Vanilla (New)
uses: actions/checkout@v4
if: ${{ inputs.test-dbm-vanilla-mods }}
with:
repository: ${{ inputs.dbm-mod-repo-vanilla }}
ref: ${{ inputs.dbm-mod-ref-vanilla }}
path: ./dbm-offline-diff/DBM-Vanilla-new
- name: Checkout DBM-Vanilla (Base)
uses: actions/checkout@v4
if: ${{ inputs.test-dbm-vanilla-mods && inputs.diff-mode == 'true' }}
with:
repository: ${{ inputs.dbm-mod-repo-vanilla }}
ref: ${{ inputs.dbm-mod-base-ref-vanilla }}
path: ./dbm-offline-diff/DBM-Vanilla-base
- name: Checkout DBM-Dungeons (New)
uses: actions/checkout@v4
if: ${{ inputs.test-dbm-dungeon-mods }}
with:
repository: ${{ inputs.dbm-mod-repo-dungeons }}
ref: ${{ inputs.dbm-mod-ref-dungeons }}
path: ./dbm-offline-diff/DBM-Dungeons-new
- name: Checkout DBM-Dungeons (Base)
uses: actions/checkout@v4
if: ${{ inputs.test-dbm-dungeon-mods && inputs.diff-mode == 'true' }}
with:
repository: ${{ inputs.dbm-mod-repo-dungeons }}
ref: ${{ inputs.dbm-mod-base-ref-dungeons }}
path: ./dbm-offline-diff/DBM-Dungeons-base
- name: Run tests (New)
shell: bash
run: |
cd dbm-offline-diff/DBM-Offline
for flavor in Retail SoD; do
if [[ ${{ inputs.test-dbm-core-mods }} == true ]]; then
lua5.1 main.lua --flavor $flavor --dbm ../DeadlyBossMods-new --mods ../DeadlyBossMods-new
fi
if [[ ${{ inputs.test-dbm-vanilla-mods }} == true ]]; then
lua5.1 main.lua --flavor $flavor --dbm ../DeadlyBossMods-new --mods ../DBM-Vanilla-new
fi
if [[ ${{ inputs.test-dbm-dungeon-mods }} == true ]]; then
lua5.1 main.lua --flavor $flavor --dbm ../DeadlyBossMods-new --mods ../DBM-Dungeons-new
fi
done
mkdir -p ../results
mv reports ../results/new
- name: Run tests (Base)
if: ${{ inputs.diff-mode == 'true' }}
shell: bash
run: |
cd dbm-offline-diff/DBM-Offline
for flavor in Retail SoD; do
if [[ ${{ inputs.test-dbm-core-mods }} == true ]]; then
lua5.1 main.lua --flavor $flavor --dbm ../DeadlyBossMods-base --mods ../DeadlyBossMods-base
fi
if [[ ${{ inputs.test-dbm-vanilla-mods }} == true ]]; then
lua5.1 main.lua --flavor $flavor --dbm ../DeadlyBossMods-base --mods ../DBM-Vanilla-base
fi
if [[ ${{ inputs.test-dbm-dungeon-mods }} == true ]]; then
lua5.1 main.lua --flavor $flavor --dbm ../DeadlyBossMods-base --mods ../DBM-Dungeons-base
fi
done
mkdir -p ../results
mv reports ../results/base
- name: Upload diff
id: upload
if: ${{ inputs.diff-mode == 'true' }}
shell: bash
run: |
cd dbm-offline-diff/DBM-Offline
lua5.1 diff.lua ../results/base ../results/new > ../summary.txt
cd ..
mkdir upload-results
cd upload-results
git init .
git config --global user.email "[email protected]"
git config --global user.name "DBM CI"
git checkout -b ${{ inputs.upload-repo-branch }}
mv ../results/base reports
rm -f reports/.gitignore
git add reports/*
git commit --allow-empty -a -m "Base test results" \
-m "Core: https://github.com/${{ inputs.dbm-main-repo }}/commit/$(git -C ../DeadlyBossMods-base rev-parse HEAD)" \
-m "Vanilla: https://github.com/${{ inputs.dbm-mod-repo-vanilla }}/commit/$(git -C ../DBM-Vanilla-base rev-parse HEAD)" \
-m "Dungeons: https://github.com/${{ inputs.dbm-mod-repo-dungeons }}/commit/$(git -C ../DBM-Dungeons-base rev-parse HEAD)"
rm -rf reports/
mv ../results/new reports
rm -f reports/.gitignore
git add reports/*
git commit --allow-empty -a -m "Test results" \
-m "Core: https://github.com/${{ inputs.dbm-main-repo }}/commit/$(git -C ../DeadlyBossMods-new rev-parse HEAD)" \
-m "Vanilla: https://github.com/${{ inputs.dbm-mod-repo-vanilla }}/commit/$(git -C ../DBM-Vanilla-new rev-parse HEAD)" \
-m "Dungeons: https://github.com/${{ inputs.dbm-mod-repo-dungeons }}/commit/$(git -C ../DBM-Dungeons-new rev-parse HEAD)"
git push https://${gh_token}@github.com/${{ inputs.upload-repo }} ${{ inputs.upload-repo-branch }}
sed -i "s|{{fullDiffLink}}|https://github.com/${{ inputs.upload-repo }}/commit/$(git rev-parse HEAD)|" ../summary.txt
sed -i "s|{{fullResultsLink}}|https://github.com/${{ inputs.upload-repo }}/tree/$(git rev-parse HEAD^)/reports|" ../summary.txt
echo 'diff<<EOFDelim' >> $GITHUB_OUTPUT
cat ../summary.txt >> $GITHUB_OUTPUT
echo EOFDelim >> $GITHUB_OUTPUT
cat ../summary.txt >> $GITHUB_STEP_SUMMARY
env:
gh_token: ${{ inputs.upload-token }}
- name: Upload test results
if: ${{ inputs.diff-mode == 'false' }}
shell: bash
run: |
cd dbm-offline-diff/
git clone https://github.com/${{ inputs.upload-repo }} upload-results
cd upload-results
git checkout ${{ inputs.upload-repo-branch }}
git config --global user.email "[email protected]"
git config --global user.name "DBM CI"
# FIXME: should be using an exclude filter instead of that
rm -rf Dragonflight-* SoD-* TWW-* Era-* Classic-* Cata-* TBC-*
rm -f ../results/new/.gitignore
cp -r ../results/new/* .
git add *
git commit --allow-empty -a -m "Test results" \
-m "Core: https://github.com/${{ inputs.dbm-main-repo }}/commit/$(git -C ../DeadlyBossMods-new rev-parse HEAD)" \
-m "Vanilla: https://github.com/${{ inputs.dbm-mod-repo-vanilla }}/commit/$(git -C ../DBM-Vanilla-new rev-parse HEAD)" \
-m "Dungeons: https://github.com/${{ inputs.dbm-mod-repo-dungeons }}/commit/$(git -C ../DBM-Dungeons-new rev-parse HEAD)"
git push https://${gh_token}@github.com/${{ inputs.upload-repo }} ${{ inputs.upload-repo-branch }}
env:
gh_token: ${{ inputs.upload-token }}
- name: Cleanup
shell: bash
if: always()
run: |
# just making sure the auth token is definitely gone
rm -rf dbm-offline-diff/upload-results/.git
- name: Post comment
uses: actions/github-script@v5
if: ${{ github.event_name == 'pull_request' && inputs.diff-mode == 'true' }}
with:
github-token: ${{ inputs.comment-token }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `${{ steps.upload.outputs.diff }}`
})