-
Notifications
You must be signed in to change notification settings - Fork 2
259 lines (240 loc) · 10.2 KB
/
main.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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
on:
workflow_dispatch:
jobs:
GetTag:
runs-on: ubuntu-20.04
outputs:
output1: ${{ steps.tag.outputs.thetag }}
output2: ${{ steps.tag.outputs.theid }}
output3: ${{ steps.tag.outputs.gitian }}
steps:
- name: Grab tag from runid (comfy)
id: tag
run: |
get_workflow_runs(){ page=$1 repo=$2 workflow=$3
FOUND_BIN=0
PREPARE=0
DEBUG=https://api.github.com/repos/monero-project/${repo}/actions/runs?page=$page
echo $DEBUG
runs=$(curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/monero-project/${repo}/actions/runs?page=$page)
for row in $(echo "${runs}" | jq -r '.workflow_runs[] | @base64'); do
_jq() {
echo ${row} | base64 --decode | jq -r ${1}
}
if [[ $(_jq '.path') = ".github/workflows/$workflow" ]]; then
TAG=$(_jq '.head_branch')
#echo $TAG
is_v=${TAG:0:1}
is_p=${TAG:0:9}
IFS='.' read -ra SPLIT <<< "$TAG"
if [[ $is_p == "prepare-v" ]] || [[ $is_v == "v" ]] && [[ ${#SPLIT[@]} -eq 4 ]]; then
RUNID=$(_jq '.id')
FOUND_BIN=1
if [[ $is_p = "prepare-v" ]]; then
echo "BUILD prepare in use"
TAG="${TAG/prepare-v/v}"
PREPARE=1
fi
break
fi
fi
done
if [[ $FOUND_BIN -eq 0 ]]; then
((page+=1))
get_workflow_runs $page $repo $workflow
else
FOUND_BIN=0
fi
}
get_workflow_runs 1 monero-gui build.yml
echo $TAG
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
if [[ $PREPARE = 1 ]]; then
echo "Caution: this is a build-prepare not official release" >> $GITHUB_STEP_SUMMARY
fi
echo "theid=$RUNID" >> "$GITHUB_OUTPUT"
echo "thetag=$TAG" >> "$GITHUB_OUTPUT"
echo "tag: ${TAG}" >> $GITHUB_STEP_SUMMARY
echo "runid: ${RUNID}" >> $GITHUB_STEP_SUMMARY
get_workflow_runs 1 monero gitian.yml
echo "gitian=$RUNID" >> "$GITHUB_OUTPUT"
echo "gitianid: ${RUNID}" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
MakeExeWINE:
runs-on: ubuntu-20.04
needs: GetTag
steps:
- uses: actions/checkout@v3
- name: Set up dependencies
run: |
sudo apt-add-repository -y ppa:ondrej/php
sudo apt-get install ppa-purge
sudo ppa-purge -y ppa:ondrej/php
sudo dpkg --add-architecture i386
sudo apt-get update -qq
sudo apt-get install -yqq wine-stable
- name: "Everything"
run: |
sudo apt-get install -y jq curl
RUN_ID=${{ needs.GetTag.outputs.output2 }}
GH_KEY="${{ secrets.GITHUB_TOKEN }}"
TAG=${{needs.GetTag.outputs.output1}}
GITIAN_ID=${{needs.GetTag.outputs.output3}}
# Download docker-windows-static
download_artifact(){ run_id=$1 repo=$2 get_name=$3 save_as=$4 gh_key=$5
echo https://api.github.com/repos/monero-project/${repo}/actions/runs/${run_id}/artifacts
workflow_run=$(curl \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/monero-project/${repo}/actions/runs/${run_id}/artifacts)
num=0
for artifact_name in $(echo ${workflow_run} | jq -r '.artifacts[].name'); do
if [[ "${artifact_name}" == "${get_name}" ]]; then
URL=$(echo ${workflow_run} | jq -r ".artifacts[${num}].archive_download_url")
TAG=$(echo ${workflow_run} | jq -r ".artifacts[${num}].workflow_run.head_branch")
break
fi
((num+=1))
done
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${gh_key}" \
-L -o "${save_as}" \
"${URL}"
echo $URL
}
declare -A innoFiles
innoFiles["Default.isl"]="179da3422d7bbb65bb2052f9c0b370ab66ddd6f24693d90accbd7d7d73d4f1a4"
innoFiles["ISCC.exe"]="0d02e30a6ad432a50eb86f1ecf330147046e671de340bcb43a170fecbd19bf51"
innoFiles["ISCmplr.dll"]="5ea9bb338795bffa33da5581e5fe1c976a561f6dc32105635dcd518fbb5a33b4"
innoFiles["islzma.dll"]="0b2e19e473a47e10578b05a2f3b43ad96603f3ee1e397c06a280c3b7458a76e2"
innoFiles["ISPPBuiltins.iss"]="a7c5a10f4aac60862082985cfdf8bc5e703fa7fb9cfff4e1deb1d9452862057f"
innoFiles["Setup.e32"]="088622096c373250d04e46de5cda072a921a89900c57988bbe52f1e308e48043"
innoFiles["SetupLdr.e32"]="86154d725c21660f220e957eb6dcaf73ca609eef486dcdce6d5d7c286abd03d5"
innoFiles["ISPP.dll"]="1be06b60090221d7a7d236d374ab4ff7e6a56013107f806be4bea2b79dad3703"
innoFiles["opengl32sw.dll"]="963641a718f9cae2705d5299eae9b7444e84e72ab3bef96a691510dd05fa1da4"
echo "Verify InnoSetup files"
cd utils
for f in *; do
hash=$(sha256sum $f | awk '{print $1}')
if [[ "${innoFiles[$f]}" != "${hash}" ]]; then
echo "Hash mismatch $f"
exit
else
echo "Verified $f"
fi
done
cd ..
#download artifact also sets the TAG variable
download_artifact $RUN_ID monero-gui "docker-windows-static" "docker-windows-static" "${GH_KEY}"
#download gitian cli files
download_artifact $GITIAN_ID monero "Windows" "Windows" "${GH_KEY}"
#Extract static files to frombuild
unzip "docker-windows-static" -d frombuild
#Extract gitian files here
unzip "Windows"
unzip "monero-x86_64-w64-mingw32-${TAG}.zip" -d clifiles
# Download CLI/PDF file(s)
wget -q "https://github.com/monero-ecosystem/monero-GUI-guide/releases/download/v1.9/monero-gui-wallet-guide.pdf"
# Create lowgfx bat file with heredoc (windows powershell uses \r\n)
cr=$'\r'
tee "start-low-graphics-mode.bat" <<EOF
@echo off$cr
$cr
set QMLSCENE_DEVICE=softwarecontext$cr
$cr
start /b monero-wallet-gui.exe$cr
EOF
mkdir -p "dummy/monero-gui-${TAG}/extras"
HEAD="clifiles/monero-x86_64-w64-mingw32-${TAG}"
OUT="dummy/monero-gui-${TAG}"
echo "HEAD is ${HEAD}"
license="${HEAD}/LICENSE"
monerod="${HEAD}/monerod.exe"
mv $license "${OUT}/"
mv $monerod "${OUT}/"
readme="${HEAD}/README.md"; rm "${readme}"
anon="${HEAD}/ANONYMITY_NETWORKS.md"; rm "${anon}"
dest="dummy/monero-gui-${TAG}"
cp monero-gui-wallet-guide.pdf "${dest}/"
cp frombuild/monero-wallet-gui.exe "${dest}/"
cp utils/opengl32sw.dll "${dest}/"
cp start-low-graphics-mode.bat "${dest}/"
ls ${HEAD}
for f in "${HEAD}/*"; do
echo "$f"
cp $f "dummy/monero-gui-${TAG}/extras"
done
dest="dummy/monero-gui-${TAG}"
mkdir inno; cd inno
git init
git remote add -f origin https://github.com/monero-project/monero-gui
git sparse-checkout init
git sparse-checkout set "installers/windows"
git pull origin master
mkdir -p installers/windows/bin
cd ..
for f in "${dest}/*"; do
cp -r $f "inno/installers/windows/bin"
done
strip_v="${TAG:1}"
inno_file='inno/installers/windows/Monero.iss'
# mistake in v0.18.1.1. to reproduce hash use line 13
# -e '13 cTouchDate=none \nTouchTime=none' \
lines="$(cat $inno_file)"
SAVEIFS=$IFS
IFS=$'\n'
lines=($lines)
IFS=$SAVEIFS
num=1
setup="[Setup]"
define="#define GuiVersion GetFileVersion(\"bin\monero-wallet-gui.exe\")"
readme="Source: {#file AddBackslash(SourcePath) + \"ReadMe.htm\"}; DestDir: \"{app}\"; DestName: \"ReadMe.htm\"; Flags: ignoreversion"
for line in "${lines[@]}"; do
if [[ "$line" = "$setup"* ]] ; then
echo "we found setup $num"
setup=$num
elif [[ "$line" = "$define"* ]] ; then
echo "we found define $num"
define=$num
elif [[ "$line" = "$readme"* ]] ; then
echo "we found readme $num"
readme=$num
sed -i "${readme} cSource: \"ReadMe.htm\"; DestDir: \"{app}\"; Flags: ignoreversion" ${inno_file}
fi
((num+=1))
done
sed -i \
-e "${define} c#define GuiVersion \"${strip_v}\"" \
-e "${setup} c\[Setup\] \nTouchDate=none \nTouchTime=none" ${inno_file}
for f in "utils/*"; do
cp $f "inno/installers/windows"
done
HOMEDIR="$(pwd)"
stamp=$(stat -c '%y' frombuild/monero-wallet-gui.exe)
corrected_stamp=$(date -d"${stamp} +0 hours" +"%Y%m%d%H%M.%S")
for f in "inno/installers/windows/*" "inno/installers/windows/**/*" "inno/installers/windows/**/**/*"; do
echo $f
touch -t "${corrected_stamp}" $f
done
wine inno/installers/windows/ISCC.exe inno/installers/windows/Monero.iss
mkdir bin
mv inno/installers/windows/Output/mysetup.exe "bin/monero-gui-install-win-x64-${TAG}.exe"
- name: Print hashes
run: |
hash_exe=$(sha256sum bin/monero-gui-install-win-x64-${{needs.GetTag.outputs.output1}}.exe | awk '{print $1}')
echo "Hash of gitian built cli zip:" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo $(sha256sum monero-x86_64-w64-mingw32-${{needs.GetTag.outputs.output1}}.zip) >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "Monero GUI installer hash:" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "${hash_exe} monero-gui-install-win-x64-${{needs.GetTag.outputs.output1}}.exe" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: monero-gui-install-win-x64-${{needs.GetTag.outputs.output1}}
path: bin/monero-gui-install-win-x64-${{needs.GetTag.outputs.output1}}.exe