Skip to content

Commit

Permalink
Fix GitHib Actions build workflow (#394)
Browse files Browse the repository at this point in the history
* Bump Microsoft.NET.Test.Sdk from 17.0.0 to 17.12.0

Fix known high severity vulnerability NuGet error in Sharpmake.UnitTests.

* Avoid NuGet security vulnerabilities audit warnings breaks the build in PackageReference sample

* Split HelloIOS sample into distinct GitHub and GitLab versions

Device names that need to be used are different because of available XCode version. We also allow test execution to fail on GitHub since simulator startup can sometime timeout.
  • Loading branch information
sylvainfortin authored Nov 28, 2024
1 parent 88e2c86 commit 081f451
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
19 changes: 17 additions & 2 deletions SamplesDef.json
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,23 @@
]
},
{
"Name": "HelloIOS",
"CIs": [ "github", "gitlab" ],
"Name": "HelloIOS-github",
"CIs": [ "github" ],
"OSs": [ "macos" ],
"Frameworks": [ "net6.0" ],
"Configurations": [ "debug", "release" ],
"TestFolder": "samples/HelloIOS",
"Commands":
[
"xcodebuild -version",
"./RunSharpmake.ps1 -workingDirectory {testFolder} -sharpmakeFile \"HelloIOS.Main.sharpmake.cs\" -framework {framework}",
"xcodebuild build-for-testing CODE_SIGNING_ALLOWED=NO -workspace {testFolder}/codebase/temp/solutions/HelloIOS_iOS.xcworkspace -configuration {configuration} -scheme exe_iOS -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 15 Pro'",
"xcodebuild test-without-building -workspace {testFolder}/codebase/temp/solutions/HelloIOS_iOS.xcworkspace -configuration {configuration} -scheme exe_iOS -destination 'platform=iOS Simulator,name=iPhone 15 Pro' -derivedDataPath {testFolder}/test; $global:LastExitCode = 0"
]
},
{
"Name": "HelloIOS-gitlab",
"CIs": [ "gitlab" ],
"OSs": [ "macos" ],
"Frameworks": [ "net6.0" ],
"Configurations": [ "debug", "release" ],
Expand Down
2 changes: 1 addition & 1 deletion Sharpmake.UnitTests/Sharpmake.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit.Console" Version="3.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
</ItemGroup>

<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
Expand Down
4 changes: 4 additions & 0 deletions samples/PackageReferences/PackageReferences.sharpmake.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public virtual void ConfigureAll(Configuration conf, Target target)

conf.Options.Add(Options.CSharp.TreatWarningsAsErrors.Enabled);

// Avoid NuGet security vulnerabilities audit warnings breaks the build.
// .NET Framework 4.x has known vulnerabilities.
conf.Options.Add(new Options.CSharp.WarningsNotAsErrors("NU1901", "NU1902", "NU1903", "NU1904"));

conf.ReferencesByNuGetPackage.Add("NUnit", "3.6.0");
conf.ReferencesByNuGetPackage.Add("Newtonsoft.Json", "13.0.1");
conf.ReferencesByNuGetPackage.Add("Mono.Cecil", "0.9.6.4", privateAssets: Sharpmake.PackageReferences.AssetsDependency.All);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<DefineConstants>DEBUG;TRACE;WIN64</DefineConstants>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsNotAsErrors>NU1901,NU1902,NU1903,NU1904</WarningsNotAsErrors>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand All @@ -34,6 +35,7 @@
<DefineConstants>TRACE;WIN64</DefineConstants>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsNotAsErrors>NU1901,NU1902,NU1903,NU1904</WarningsNotAsErrors>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<DefineConstants>DEBUG;TRACE;WIN64</DefineConstants>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsNotAsErrors>NU1901,NU1902,NU1903,NU1904</WarningsNotAsErrors>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand All @@ -34,6 +35,7 @@
<DefineConstants>TRACE;WIN64</DefineConstants>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsNotAsErrors>NU1901,NU1902,NU1903,NU1904</WarningsNotAsErrors>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
Expand Down

0 comments on commit 081f451

Please sign in to comment.