Skip to content

Commit

Permalink
GH-72: Workaround for nasm.us unavailability
Browse files Browse the repository at this point in the history
  • Loading branch information
SetZero committed Jul 18, 2023
1 parent deb692b commit 4ce4c70
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,40 @@ jobs:
env:
VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg_installed

- name: workaround for nasm.us's potato pc (windows only)
if: matrix.platform == 'windows-latest'
shell: pwsh
run: |
# Define URLs
$urlToCheck = "https://nasm.us/"
$fileToDownload = "http://mirrors.kodi.tv/build-deps/win32/nasm-2.12.02-win32.zip"
# Define download location
$downloadFolder = "D:\a\FancyMumbleV2\FancyMumbleV2\vcpkg\downloads"
# Check if website is available
try {
$response = Invoke-WebRequest -Uri $urlToCheck -Method Head -ErrorAction Stop
if ($response.StatusCode -ne 200) {
throw
}
Write-Host "$urlToCheck is available."
}
catch {
Write-Host "$urlToCheck is not available. Downloading file..."
# Create download folder if it doesn't exist
if (!(Test-Path -Path $downloadFolder)) {
New-Item -ItemType Directory -Path $downloadFolder
}
# Download file
$filePath = Join-Path -Path $downloadFolder -ChildPath (Split-Path -Path $fileToDownload -Leaf)
Invoke-WebRequest -Uri $fileToDownload -OutFile $filePath
Write-Host "File downloaded to $filePath."
}
- name: Install dependencies (windows only)
if: matrix.platform == 'windows-latest'
run: |
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,40 @@ jobs:
env:
VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg_installed

- name: workaround for nasm.us's potato pc (windows only)
if: matrix.platform == 'windows-latest'
shell: pwsh
run: |
# Define URLs
$urlToCheck = "https://nasm.us/"
$fileToDownload = "https://github.com/microsoft/vcpkg/files/12073957/nasm-2.16.01-win64.zip"
# Define download location
$downloadFolder = Join-Path -Path $env:VCPKG_ROOT -ChildPath "downloads"
# Check if website is available
try {
$response = Invoke-WebRequest -Uri $urlToCheck -Method Head -ErrorAction Stop
if ($response.StatusCode -ne 200) {
throw
}
Write-Host "$urlToCheck is available."
}
catch {
Write-Host "$urlToCheck is not available. Downloading file..."
# Create download folder if it doesn't exist
if (!(Test-Path -Path $downloadFolder)) {
New-Item -ItemType Directory -Path $downloadFolder
}
# Download file
$filePath = Join-Path -Path $downloadFolder -ChildPath (Split-Path -Path $fileToDownload -Leaf)
Invoke-WebRequest -Uri $fileToDownload -OutFile $filePath
Write-Host "File downloaded to $filePath."
}
- name: Install dependencies (windows only)
if: matrix.platform == 'windows-latest'
run: |
Expand Down

0 comments on commit 4ce4c70

Please sign in to comment.