diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a54ae2085..92d40ffda 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,21 +9,17 @@ jobs: steps: - uses: actions/checkout@v1 - - name: Install .NET Core + - name: Build, test shell: pwsh run: | - Invoke-WebRequest -Uri https://dot.net/v1/dotnet-install.ps1 -UseBasicParsing -OutFile $env:temp\dotnet-install.ps1 - & $env:temp\dotnet-install.ps1 -Version 3.0.100 -InstallDir "${env:ProgramFiles(x86)}\dotnet" -Architecture x86 - - - name: Build, test - run: | - set PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\amd64;%PATH% - build.cmd + $env:PATH = 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\amd64;' + $env:PATH + .\build.ps1 - name: upload-artifact doesn't support wildcards + shell: pwsh run: | - mkdir nuget_files - copy "Iced\bin\Release\*.*nupkg" nuget_files + New-Item -ItemType Directory nuget_files > $null + Copy-Item Iced\bin\Release\*.*nupkg nuget_files - uses: actions/upload-artifact@v1 with: diff --git a/build.cmd b/build.cmd deleted file mode 100644 index 2062e355b..000000000 --- a/build.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@echo off -REM dotnet build isn't used because it can't build net35 tfms - -msbuild -v:m -restore -t:Build -p:Configuration=Release || goto :error - -"%ProgramFiles%\dotnet\dotnet.exe" test -c Release -p:Exclude=\"[Iced]Iced.Intel.InstructionMemorySizes,[Iced]Iced.Intel.EncoderInternal.OpCodeHandlers,[Iced]Iced.Intel.InstructionInfoInternal.InfoHandlers,[Iced]Iced.Intel.MnemonicUtils,[Iced]Iced.Intel.InstructionOpCounts\" -p:ExcludeByFile="%cd%\Iced\**\*.g.cs" -p:ExcludeByAttribute="ObsoleteAttribute" -p:CollectCoverage=true -p:CoverletOutputFormat=json --no-build Iced.UnitTests\Iced.UnitTests.csproj -- RunConfiguration.NoAutoReporters=true RunConfiguration.TargetPlatform=X64 || goto :error -"%ProgramFiles(x86)%\dotnet\dotnet.exe" test -c Release --no-build Iced.UnitTests\Iced.UnitTests.csproj -- RunConfiguration.NoAutoReporters=true RunConfiguration.TargetPlatform=X86 || goto :error - -set MoreDefineConstants=IcedNoIVT -msbuild -v:m -t:Clean -p:Configuration=Release || goto :error -msbuild -v:m -restore -t:Build -p:Configuration=Release Iced\Iced.csproj || goto :error -msbuild -v:m -t:Pack -p:Configuration=Release Iced\Iced.csproj || goto :error - -goto :EOF - -:error -exit /b %errorlevel% diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 000000000..a64366629 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,23 @@ +$ErrorActionPreference = 'Stop' + +# +# dotnet build isn't used because it can't build net35 tfms +# + +$env:MoreDefineConstants = '' + +msbuild -v:m -restore -t:Build -p:Configuration=Release +if ($LASTEXITCODE) { exit $LASTEXITCODE } + +dotnet test -c Release -f netcoreapp3.0 -p:Exclude='\"[Iced]Iced.Intel.InstructionMemorySizes,[Iced]Iced.Intel.EncoderInternal.OpCodeHandlers,[Iced]Iced.Intel.InstructionInfoInternal.InfoHandlers,[Iced]Iced.Intel.MnemonicUtils,[Iced]Iced.Intel.InstructionOpCounts\"' -p:ExcludeByFile="$PWD\Iced\**\*.g.cs" -p:ExcludeByAttribute='ObsoleteAttribute' -p:CollectCoverage=true -p:CoverletOutputFormat=json --no-build Iced.UnitTests\Iced.UnitTests.csproj -- RunConfiguration.NoAutoReporters=true RunConfiguration.TargetPlatform=X64 +if ($LASTEXITCODE) { exit $LASTEXITCODE } + +# Don't include the IVT in the final binary +$env:MoreDefineConstants = 'IcedNoIVT' +msbuild -v:m -t:Clean -p:Configuration=Release +if ($LASTEXITCODE) { exit $LASTEXITCODE } +msbuild -v:m -restore -t:Build -p:Configuration=Release Iced\Iced.csproj +if ($LASTEXITCODE) { exit $LASTEXITCODE } +msbuild -v:m -t:Pack -p:Configuration=Release Iced\Iced.csproj +if ($LASTEXITCODE) { exit $LASTEXITCODE } +$env:MoreDefineConstants = ''