diff --git a/.github/scripts/get_win_deps.ps1 b/.github/scripts/get_win_deps.ps1 new file mode 100644 index 00000000..b947ad5c --- /dev/null +++ b/.github/scripts/get_win_deps.ps1 @@ -0,0 +1,23 @@ +function getlibrary ([string] $URI, [string] $filename, [string] $hash, [string] $destdir) { + $wc = New-Object Net.WebClient + [string] $downloadhash = $null + try { + $wc.DownloadFile($URI, $filename) + $downloadhash = $(Get-FileHash $filename -Algorithm SHA256).Hash + } catch { + Write-Host "${filename}: failed to download" + exit 1 + } + if ($hash -ne $downloadhash) { + Write-Host "${filename}: SHA256 mismatch ($downloadhash)" + exit 1 + } + Expand-Archive -DestinationPath $destdir $filename +} + +getlibrary 'https://www.zlib.net/zlib1213.zip' 'zlib.zip' 'd233fca7cf68db4c16dc5287af61f3cd01ab62495224c66639ca3da537701e42' . +getlibrary 'https://download.sourceforge.net/libpng/lpng1637.zip' 'libpng.zip' '3b4b1cbd0bae6822f749d39b1ccadd6297f05e2b85a83dd2ce6ecd7d09eabdf2' . +getlibrary 'https://github.com/lexxmark/winflexbison/releases/download/v2.5.24/win_flex_bison-2.5.24.zip' 'winflexbison.zip' '39c6086ce211d5415500acc5ed2d8939861ca1696aee48909c7f6daf5122b505' install_dir + +Move-Item zlib-1.2.13 zlib +Move-Item lpng1637 libpng diff --git a/.github/workflows/create-release-artifacts.yaml b/.github/workflows/create-release-artifacts.yaml index 99f3c523..8d8ff0e2 100644 --- a/.github/workflows/create-release-artifacts.yaml +++ b/.github/workflows/create-release-artifacts.yaml @@ -25,31 +25,8 @@ jobs: VERSION="${{ github.ref_name }}" echo "version=${VERSION#v}" >> $GITHUB_ENV - uses: actions/checkout@v2 - - name: Get zlib, libpng and bison - run: | # TODO: use an array; remember to update the versions being downloaded, *and* the paths being extracted! (`Move-Item`) - $wc = New-Object System.Net.WebClient - $wc.DownloadFile('https://www.zlib.net/zlib1213.zip', 'zlib.zip') - $hash = (Get-FileHash "zlib.zip" -Algorithm SHA256).Hash - if ($hash -ne 'd233fca7cf68db4c16dc5287af61f3cd01ab62495224c66639ca3da537701e42') { - Write-Host "zlib SHA256 mismatch! ($hash)" - exit 1 - } - $wc.DownloadFile('https://download.sourceforge.net/libpng/lpng1637.zip', 'libpng.zip') - $hash = (Get-FileHash "libpng.zip" -Algorithm SHA256).Hash - if ($hash -ne '3b4b1cbd0bae6822f749d39b1ccadd6297f05e2b85a83dd2ce6ecd7d09eabdf2') { - Write-Host "libpng SHA256 mismatch! ($hash)" - exit 1 - } - $wc.DownloadFile('https://github.com/lexxmark/winflexbison/releases/download/v2.5.24/win_flex_bison-2.5.24.zip', 'winflexbison.zip') - $hash = (Get-FileHash "winflexbison.zip" -Algorithm SHA256).Hash - if ($hash -ne '39c6086ce211d5415500acc5ed2d8939861ca1696aee48909c7f6daf5122b505') { - Write-Host "bison SHA256 mismatch! ($hash)" - } - Expand-Archive -DestinationPath . "zlib.zip" - Expand-Archive -DestinationPath . "libpng.zip" - Expand-Archive -DestinationPath install_dir "winflexbison.zip" - Move-Item zlib-1.2.13 zlib - Move-Item lpng1637 libpng + - name: Install deps + run: .github/scripts/get_win_deps.ps1 - uses: actions/cache@v3 id: cache with: diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 68bf997d..2b40cd5f 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -76,31 +76,8 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - - name: Get zlib, libpng and bison - run: | # TODO: use an array; remember to update the versions being downloaded, *and* the paths being extracted! (`Move-Item`) - $wc = New-Object System.Net.WebClient - $wc.DownloadFile('https://www.zlib.net/zlib1213.zip', 'zlib.zip') - $hash = (Get-FileHash "zlib.zip" -Algorithm SHA256).Hash - if ($hash -ne 'd233fca7cf68db4c16dc5287af61f3cd01ab62495224c66639ca3da537701e42') { - Write-Host "zlib SHA256 mismatch! ($hash)" - exit 1 - } - $wc.DownloadFile('https://download.sourceforge.net/libpng/lpng1637.zip', 'libpng.zip') - $hash = (Get-FileHash "libpng.zip" -Algorithm SHA256).Hash - if ($hash -ne '3b4b1cbd0bae6822f749d39b1ccadd6297f05e2b85a83dd2ce6ecd7d09eabdf2') { - Write-Host "libpng SHA256 mismatch! ($hash)" - exit 1 - } - $wc.DownloadFile('https://github.com/lexxmark/winflexbison/releases/download/v2.5.24/win_flex_bison-2.5.24.zip', 'winflexbison.zip') - $hash = (Get-FileHash "winflexbison.zip" -Algorithm SHA256).Hash - if ($hash -ne '39c6086ce211d5415500acc5ed2d8939861ca1696aee48909c7f6daf5122b505') { - Write-Host "bison SHA256 mismatch! ($hash)" - } - Expand-Archive -DestinationPath . "zlib.zip" - Expand-Archive -DestinationPath . "libpng.zip" - Expand-Archive -DestinationPath install_dir "winflexbison.zip" - Move-Item zlib-1.2.13 zlib - Move-Item lpng1637 libpng + - name: Install deps + run: .github/scripts/get_win_deps.ps1 - uses: actions/cache@v3 id: cache with: