Skip to content

Commit

Permalink
Appveyor: Try to fix .NET restore
Browse files Browse the repository at this point in the history
  • Loading branch information
MikhailGorobets committed Dec 7, 2023
1 parent 357495b commit 68bef57
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
34 changes: 34 additions & 0 deletions BuildTools/Scripts/appveyor/install-dotnet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import requests
import subprocess
import sys

DOTNET_INSTALL_SCRIPT_URL = "https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1"

DOTNET_INSTALL_SCRIPT_PATH = "dotnet-install.ps1"

DOTNET_INSTALL_SCRIPT_ARGS = [
"-Channel", "6.0.1xx",
"-Quality", "preview"
]

def execute(command):
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

while True:
nextline = process.stdout.readline()
if not nextline and process.poll() is not None:
break
print(line.decode(), end='')


def main():
response = requests.get(DOTNET_INSTALL_SCRIPT_URL)
with open(DOTNET_INSTALL_SCRIPT_PATH, 'wb') as script_file:
script_file.write(response.content)

command = ["powershell.exe", "-ExecutionPolicy", "Bypass", "-File", DOTNET_INSTALL_SCRIPT_PATH] + DOTNET_INSTALL_SCRIPT_ARGS
execute(command)


if __name__ == "__main__":
main()
6 changes: 5 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ install:

before_build:
- cd c:\projects\DiligentSamples\BuildTools\FormatValidation
- cd c:\projects\DiligentSamples\BuildTools\Scripts\appveyor
- python -m pip install requests
- python install-dotnet.py
- cd c:\projects
- validate_format_win.bat
- cd c:\projects
- echo cmake_minimum_required(VERSION 3.6) > CMakeLists.txt
Expand All @@ -42,7 +46,7 @@ before_build:
- echo add_subdirectory(DiligentSamples) >> CMakeLists.txt
- echo %PLATFORM%
- cmake -S . -B ./build -G "Visual Studio 16 2019" -A %PLATFORM%
- nuget restore c:\projects\build\DiligentSamples_Test.sln
- dotnet restore c:\projects\build\DiligentSamples_Test.sln

build:
project: c:\projects\build\DiligentSamples_Test.sln
Expand Down

0 comments on commit 68bef57

Please sign in to comment.