Skip to content

Commit 7e97fea

Browse files
committed
try to use simba to hash files
Simba hashing is bugged, but by using it both here and wasplib it should work
1 parent 35a4444 commit 7e97fea

File tree

2 files changed

+46
-16
lines changed

2 files changed

+46
-16
lines changed

.github/workflows/hash-files.yml

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,37 @@ on:
77

88
jobs:
99
hash-files:
10-
runs-on: ubuntu-latest
11-
10+
runs-on: windows-latest
1211
steps:
12+
- name: Fetch Simba 2 download URL
13+
id: simba-url
14+
run: |
15+
$url = "https://raw.githubusercontent.com/Villavu/Simba-Build-Archive/refs/heads/main/latest.win64"
16+
$response = Invoke-WebRequest -Uri $url -UseBasicParsing
17+
$baseUrl = $response.Content.Trim() -replace 'Win64\.zip\?raw=true$', ''
18+
Write-Output "Base URL: $baseUrl"
19+
echo "::set-output name=baseUrl::$baseUrl"
20+
New-Item -Path ".\Includes" -ItemType Directory
21+
22+
- name: Download Simba 2.0 (64-bit)
23+
run: |
24+
$baseUrl = "${{ steps.simba-url.outputs.baseUrl }}"
25+
$downloadUrl = "$baseUrl" + "Win64.zip?raw=true"
26+
Write-Output "Download URL (64-bit): $downloadUrl"
27+
$outputFile = ".\download.zip"
28+
Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile
29+
Expand-Archive -Path $outputFile -DestinationPath . -Force
30+
Remove-Item -Path $outputFile -Force
31+
1332
- name: Checkout repository
1433
uses: actions/[email protected]
34+
with:
35+
path: ./wasp-data
1536

1637
- name: Hash all eligible files
1738
shell: bash
1839
run: |
19-
shopt -s globstar
20-
for file in **/*; do
21-
# Skip directories
22-
[ -d "$file" ] && continue
23-
24-
# Skip unwanted files and folders
25-
[[ "$file" == .git/* || "$file" == .github/* || "$file" == tools/* ]] && continue
26-
[[ "$file" == "LICENSE" || "$file" == "README.md" ]] && continue
27-
[[ "$file" == *.hash ]] && continue
28-
29-
# Compute hash and save next to the file
30-
HASH=$(md5sum "$file" | awk '{ print $1 }')
31-
echo "$HASH" > "$file.hash"
32-
done
40+
./Simba-Win64.exe --run ./tools/hash-files.simba
3341
3442
- name: Commit hash files
3543
run: |

tools/hash-files.simba

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const
2+
PATH: String = 'C:\Users\dinis\Git\wasp-data\'; //SimbaEnv.SimbaPath + 'wasp-data' + PATH_SEP
3+
SKIP: TStringArray = [PATH + 'LICENSE', PATH + 'README.md'];
4+
var
5+
files: TStringArray;
6+
i: Integer;
7+
hash: String;
8+
begin
9+
files := DirList(PATH, True);
10+
11+
for i := 0 to High(files) do
12+
begin
13+
if PathIsDirectory(files[i]) then Continue;
14+
if files[i].StartsWith(PATH + '.git') then Continue;
15+
if files[i].EndsWith('.hash') then Continue;
16+
if files[i].EndsWith('.simba') then Continue;
17+
if SKIP.Contains(files[i]) then Continue;
18+
19+
hash := HashFile(EHashAlgo.MD5, files[i]);
20+
FileWrite(filename + '.hash', hash);
21+
end;
22+
end.

0 commit comments

Comments
 (0)