Skip to content

Commit fbf7199

Browse files
authored
Use separate workflows for regular build and entropy builds (#1405)
* Experiment with separate workflows * Fix * Fix * Fix * Fix * Fix * Add compare to verify * Add space * Update * Test compare workflow * Test * Cancel naming * Cancel * Remove space * Fixes * fix typo
1 parent f879cac commit fbf7199

2 files changed

Lines changed: 199 additions & 135 deletions

File tree

.github/workflows/build.yml

Lines changed: 9 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ name: Build
22

33
on: [push, pull_request]
44

5-
concurrency:
6-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
7-
cancel-in-progress: true
8-
95
jobs:
106
fetch-deps:
117
name: Download original binaries
@@ -104,104 +100,9 @@ jobs:
104100
build/LEGO1.DLL
105101
build/LEGO1.PDB
106102
107-
build-with-entropy:
108-
name: 'MSVC 4.20 with entropy'
109-
needs: [fetch-deps]
110-
runs-on: windows-latest
111-
strategy:
112-
matrix:
113-
instance: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
114-
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
115-
20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
116-
117-
steps:
118-
- uses: actions/checkout@v4
119-
120-
- uses: actions/setup-python@v5
121-
with:
122-
python-version: '3.12'
123-
124-
- uses: actions/checkout@v4
125-
with:
126-
repository: itsmattkc/msvc420
127-
path: msvc420
128-
129-
- name: Setup cmake
130-
uses: jwlawson/actions-setup-cmake@v2
131-
with:
132-
# Use minimum supported version
133-
cmake-version: '3.15.x'
134-
135-
- name: Patch MSVC 4.2
136-
run: |
137-
tools/patch_c2.py msvc420/bin/C2.EXE
138-
139-
- name: Generate Entropy
140-
shell: bash
141-
run: |
142-
# Get the first 8 characters of the SHA (enough for a decent seed)
143-
SHA_PREFIX=$(echo "${{ github.sha }}" | cut -c 1-8)
144-
ENTROPY_SEED=$((16#$SHA_PREFIX + ${{ matrix.instance }}))
145-
146-
echo "Using seed: $ENTROPY_SEED"
147-
python3 tools/entropy.py $ENTROPY_SEED > entropy.h
148-
149-
- name: Build
150-
shell: cmd
151-
run: |
152-
call .\msvc420\bin\VCVARS32.BAT x86
153-
cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DISLE_INCLUDE_ENTROPY=ON -G "NMake Makefiles"
154-
cmake --build build
155-
156-
- name: Restore cached original binaries
157-
id: cache-original-binaries
158-
uses: actions/cache/restore@v4
159-
with:
160-
enableCrossOsArchive: true
161-
path: legobin
162-
key: legobin
163-
164-
- name: Install python packages
165-
shell: bash
166-
run: |
167-
pip install -r tools/requirements.txt
168-
169-
- name: Detect binaries
170-
run: |
171-
reccmp-project detect --what original --search-path legobin
172-
reccmp-project detect --what recompiled --search-path build
173-
174-
- name: Summarize Accuracy
175-
shell: bash
176-
run: |
177-
reccmp-reccmp --target CONFIG --json CONFIGPROGRESS.json
178-
reccmp-reccmp --target ISLE --json ISLEPROGRESS.json
179-
reccmp-reccmp --target LEGO1 --json LEGO1PROGRESS.json
180-
181-
- name: Upload Artifact
182-
uses: actions/upload-artifact@main
183-
with:
184-
name: Win32-Entropy-${{ matrix.instance }}
185-
path: |
186-
CONFIGPROGRESS.json
187-
ISLEPROGRESS.json
188-
LEGO1PROGRESS.json
189-
190-
merge-entropy-artifacts:
191-
name: 'Merge entropy artifacts'
192-
runs-on: ubuntu-latest
193-
needs: build-with-entropy
194-
steps:
195-
- name: Merge Artifacts
196-
uses: actions/upload-artifact/merge@v4
197-
with:
198-
name: Win32-Entropy
199-
pattern: Win32-Entropy-*
200-
separate-directories: true
201-
202-
compare:
203-
name: Compare with master
204-
needs: [build, merge-entropy-artifacts, fetch-deps]
103+
verify:
104+
name: Verify decomp
105+
needs: [build, fetch-deps]
205106
runs-on: windows-latest
206107
steps:
207108
- uses: actions/checkout@main
@@ -212,13 +113,8 @@ jobs:
212113

213114
- uses: actions/download-artifact@main
214115
with:
215-
name: Win32
216-
path: build
217-
218-
- uses: actions/download-artifact@main
219-
with:
220-
name: Win32-Entropy
221-
path: build-entropy
116+
name: Win32
117+
path: build
222118

223119
- name: Restore cached original binaries
224120
id: cache-original-binaries
@@ -260,28 +156,6 @@ jobs:
260156
reccmp-reccmp --target ISLE --diff ISLEPROGRESS-old.json || echo "Current master not found"
261157
reccmp-reccmp --target LEGO1 --diff LEGO1PROGRESS-old.json || echo "Current master not found"
262158
263-
- name: Aggregate Accuracy
264-
shell: bash
265-
run: |
266-
reccmp-aggregate --samples $(find build-entropy -type f -name "CONFIGPROGRESS.json") --output CONFIGPROGRESS-agg.json --html CONFIGPROGRESS-agg.html
267-
reccmp-aggregate --samples $(find build-entropy -type f -name "ISLEPROGRESS.json") --output ISLEPROGRESS-agg.json --html ISLEPROGRESS-agg.html
268-
reccmp-aggregate --samples $(find build-entropy -type f -name "LEGO1PROGRESS.json") --output LEGO1PROGRESS-agg.json --html LEGO1PROGRESS-agg.html
269-
270-
- name: Compare Aggregate Accuracy With Current Master
271-
shell: bash
272-
env:
273-
RELEASE_URL: https://github.com/isledecomp/isle/releases/download/continuous
274-
run: |
275-
# Download the current master state
276-
curl -fLSs -o CONFIGPROGRESS-agg-old.json $RELEASE_URL/CONFIGPROGRESS-agg.json || echo "" >CONFIGPROGRESS-agg-old.json
277-
curl -fLSs -o ISLEPROGRESS-agg-old.json $RELEASE_URL/ISLEPROGRESS-agg.json || echo "" >ISLEPROGRESS-agg-old.json
278-
curl -fLSs -o LEGO1PROGRESS-agg-old.json $RELEASE_URL/LEGO1PROGRESS-agg.json || echo "" >LEGO1PROGRESS-agg-old.json
279-
280-
# Compare with current master
281-
reccmp-aggregate --diff CONFIGPROGRESS-agg-old.json CONFIGPROGRESS-agg.json || echo "Current master not found"
282-
reccmp-aggregate --diff ISLEPROGRESS-agg-old.json ISLEPROGRESS-agg.json || echo "Current master not found"
283-
reccmp-aggregate --diff LEGO1PROGRESS-agg-old.json LEGO1PROGRESS-agg.json || echo "Current master not found"
284-
285159
- name: Test Exports
286160
shell: bash
287161
run: |
@@ -297,9 +171,9 @@ jobs:
297171
- name: Check Variables
298172
shell: bash
299173
run: |
300-
reccmp-datacmp --target CONFIG
301-
reccmp-datacmp --target ISLE
302-
reccmp-datacmp --target LEGO1
174+
reccmp-datacmp --target CONFIG
175+
reccmp-datacmp --target ISLE
176+
reccmp-datacmp --target LEGO1
303177
304178
- name: Upload Artifact
305179
uses: actions/upload-artifact@main
@@ -312,7 +186,7 @@ jobs:
312186
313187
upload:
314188
name: Upload artifacts
315-
needs: [build, compare]
189+
needs: [verify]
316190
runs-on: ubuntu-latest
317191
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'isledecomp/isle' }}
318192
steps:

.github/workflows/compare.yml

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
name: Compare
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
fetch-deps:
15+
name: Download original binaries
16+
uses: ./.github/workflows/legobin.yml
17+
18+
build:
19+
name: 'MSVC 4.20'
20+
needs: [fetch-deps]
21+
runs-on: windows-latest
22+
strategy:
23+
matrix:
24+
high: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
25+
low: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- uses: actions/setup-python@v5
31+
with:
32+
python-version: '3.12'
33+
34+
- uses: actions/checkout@v4
35+
with:
36+
repository: itsmattkc/msvc420
37+
path: msvc420
38+
39+
- name: Setup cmake
40+
uses: jwlawson/actions-setup-cmake@v2
41+
with:
42+
# Use minimum supported version
43+
cmake-version: '3.15.x'
44+
45+
- name: Patch MSVC 4.2
46+
run: |
47+
tools/patch_c2.py msvc420/bin/C2.EXE
48+
49+
- name: Generate Entropy
50+
shell: bash
51+
run: |
52+
# Calculate instance number based on matrix inputs
53+
INSTANCE=$((${{ matrix.high }} << 4 | ${{ matrix.low }}))
54+
55+
# Get the first 8 characters of the SHA (enough for a decent seed)
56+
SHA_PREFIX=$(echo "${{ github.sha }}" | cut -c 1-8)
57+
ENTROPY_SEED=$((16#$SHA_PREFIX + $INSTANCE))
58+
59+
echo "Using seed: $ENTROPY_SEED (instance $INSTANCE)"
60+
python3 tools/entropy.py $ENTROPY_SEED > entropy.h
61+
62+
- name: Build
63+
shell: cmd
64+
run: |
65+
call .\msvc420\bin\VCVARS32.BAT x86
66+
cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DISLE_INCLUDE_ENTROPY=ON -G "NMake Makefiles"
67+
cmake --build build
68+
69+
- name: Restore cached original binaries
70+
id: cache-original-binaries
71+
uses: actions/cache/restore@v4
72+
with:
73+
enableCrossOsArchive: true
74+
path: legobin
75+
key: legobin
76+
77+
- name: Install python packages
78+
shell: bash
79+
run: |
80+
pip install -r tools/requirements.txt
81+
82+
- name: Detect binaries
83+
run: |
84+
reccmp-project detect --what original --search-path legobin
85+
reccmp-project detect --what recompiled --search-path build
86+
87+
- name: Summarize Accuracy
88+
shell: bash
89+
run: |
90+
reccmp-reccmp --target CONFIG --json CONFIGPROGRESS.json
91+
reccmp-reccmp --target ISLE --json ISLEPROGRESS.json
92+
reccmp-reccmp --target LEGO1 --json LEGO1PROGRESS.json
93+
94+
- name: Upload Artifact
95+
uses: actions/upload-artifact@main
96+
with:
97+
name: Win32-Entropy-${{ matrix.high }}-${{ matrix.low }}
98+
path: |
99+
CONFIGPROGRESS.json
100+
ISLEPROGRESS.json
101+
LEGO1PROGRESS.json
102+
103+
merge-artifacts:
104+
name: 'Merge entropy artifacts'
105+
runs-on: ubuntu-latest
106+
needs: build
107+
steps:
108+
- name: Merge Artifacts
109+
uses: actions/upload-artifact/merge@v4
110+
with:
111+
name: Win32-Entropy
112+
pattern: Win32-Entropy-*
113+
separate-directories: true
114+
115+
compare:
116+
name: Compare with master
117+
needs: [merge-artifacts]
118+
runs-on: windows-latest
119+
steps:
120+
- uses: actions/checkout@main
121+
122+
- uses: actions/setup-python@v5
123+
with:
124+
python-version: '3.12'
125+
126+
- uses: actions/download-artifact@main
127+
with:
128+
name: Win32-Entropy
129+
path: build-entropy
130+
131+
- name: Install python packages
132+
shell: bash
133+
run: |
134+
pip install -r tools/requirements.txt
135+
136+
- name: Aggregate Accuracy
137+
shell: bash
138+
run: |
139+
reccmp-aggregate --samples $(find build-entropy -type f -name "CONFIGPROGRESS.json") --output CONFIGPROGRESS-agg.json --html CONFIGPROGRESS-agg.html
140+
reccmp-aggregate --samples $(find build-entropy -type f -name "ISLEPROGRESS.json") --output ISLEPROGRESS-agg.json --html ISLEPROGRESS-agg.html
141+
reccmp-aggregate --samples $(find build-entropy -type f -name "LEGO1PROGRESS.json") --output LEGO1PROGRESS-agg.json --html LEGO1PROGRESS-agg.html
142+
143+
- name: Compare Aggregate Accuracy With Current Master
144+
shell: bash
145+
env:
146+
RELEASE_URL: https://github.com/isledecomp/isle/releases/download/continuous-accuracy
147+
run: |
148+
# Download the current master state
149+
curl -fLSs -o CONFIGPROGRESS-agg-old.json $RELEASE_URL/CONFIGPROGRESS-agg.json || echo "" >CONFIGPROGRESS-agg-old.json
150+
curl -fLSs -o ISLEPROGRESS-agg-old.json $RELEASE_URL/ISLEPROGRESS-agg.json || echo "" >ISLEPROGRESS-agg-old.json
151+
curl -fLSs -o LEGO1PROGRESS-agg-old.json $RELEASE_URL/LEGO1PROGRESS-agg.json || echo "" >LEGO1PROGRESS-agg-old.json
152+
153+
# Compare with current master
154+
reccmp-aggregate --diff CONFIGPROGRESS-agg-old.json CONFIGPROGRESS-agg.json || echo "Current master not found"
155+
reccmp-aggregate --diff ISLEPROGRESS-agg-old.json ISLEPROGRESS-agg.json || echo "Current master not found"
156+
reccmp-aggregate --diff LEGO1PROGRESS-agg-old.json LEGO1PROGRESS-agg.json || echo "Current master not found"
157+
158+
- name: Upload Artifact
159+
uses: actions/upload-artifact@main
160+
with:
161+
name: Accuracy Report
162+
path: |
163+
CONFIGPROGRESS*
164+
ISLEPROGRESS*
165+
LEGO1PROGRESS*
166+
167+
upload:
168+
name: Upload artifacts
169+
needs: [compare]
170+
runs-on: ubuntu-latest
171+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'isledecomp/isle' }}
172+
steps:
173+
- uses: actions/checkout@v4
174+
with:
175+
repository: probonopd/uploadtool
176+
177+
- uses: actions/download-artifact@main
178+
with:
179+
name: Accuracy Report
180+
181+
- name: Upload Continuous Release
182+
env:
183+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
184+
UPLOAD_KEY: ${{ secrets.UPLOAD_KEY }}
185+
run: |
186+
export UPLOADTOOL_SUFFIX=accuracy
187+
./upload.sh \
188+
CONFIGPROGRESS* \
189+
ISLEPROGRESS* \
190+
LEGO1PROGRESS*

0 commit comments

Comments
 (0)