Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/continuous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1

- name: Setup .NET 2.2
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.2.*

- name: Setup .NET 3.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.0.*

- name: Setup .NET 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.*

- name: Run './build.cmd Test Pack'
run: ./build.cmd Test Pack
env:
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/continuousCore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- name: Setup .NET 2.2
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.2.*

- name: Setup .NET 3.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.0.*

- name: Setup .NET 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.*

- name: Run './build.cmd TestCoreOnly'
run: ./build.cmd TestCoreOnly
env:
Expand All @@ -37,6 +53,22 @@ jobs:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1

- name: Setup .NET 2.2
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.2.*

- name: Setup .NET 3.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.0.*

- name: Setup .NET 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.*

- name: Run './build.cmd TestCoreOnly'
run: ./build.cmd TestCoreOnly
env:
Expand Down
2 changes: 1 addition & 1 deletion Build/Common.Tests.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.6.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
Expand Down
28 changes: 16 additions & 12 deletions Build/Nuke/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,22 @@
[GitHubActions(
"continuous",
GitHubActionsImage.WindowsLatest,
AutoGenerate = false,
On = new[] { GitHubActionsTrigger.Push },
ImportGitHubTokenAs = nameof(GitHubToken),
InvokedTargets = new[] { nameof(Test), nameof(Pack) })]
[GitHubActions(
"continuousCore",
GitHubActionsImage.UbuntuLatest,
GitHubActionsImage.MacOsLatest,
AutoGenerate = false,
On = new[] { GitHubActionsTrigger.Push },
ImportGitHubTokenAs = nameof(GitHubToken),
InvokedTargets = new[] { nameof(TestCoreOnly) })]
[AppVeyor(
AppVeyorImage.VisualStudio2019,
SkipTags = true,
InvokedTargets = new[] { nameof(Test), nameof(Pack) })]
[AzurePipelines(
suffix: null,
AzurePipelinesImage.WindowsLatest,
AzurePipelinesImage.UbuntuLatest,
AzurePipelinesImage.MacOsLatest,
AutoGenerate = false,
InvokedTargets = new[] { nameof(Test), nameof(TestCoreOnly), nameof(Pack) },
NonEntryTargets = new[] { nameof(Restore) },
ExcludedTargets = new[] { nameof(Clean), nameof(PackCoreOnly)})]
Expand Down Expand Up @@ -92,13 +89,16 @@ partial class Build : Nuke.Common.NukeBuild

void ExecutesCompile(bool excludeNetFramework)
{
DotNet("--info");

Logger.Info(excludeNetFramework ? "Exclude net framework" : "Include net framework");
if (excludeNetFramework)
{
var frameworks =
var projectWithFrameworkAndPlatform =
from project in AllProjects
from framework in project.GetTargetFrameworks(true)
select new {project, framework};
from platform in project.GetPlatforms()
select new {project, framework, platform};


DotNetBuild(s => s
Expand All @@ -107,8 +107,9 @@ from framework in project.GetTargetFrameworks(true)
.SetAssemblyVersion(GitVersion.AssemblySemVer)
.SetFileVersion(GitVersion.AssemblySemFileVer)
.SetInformationalVersion(GitVersion.InformationalVersion)
.CombineWith(frameworks, (s, f) => s
.CombineWith(projectWithFrameworkAndPlatform, (s, f) => s
.SetFramework(f.framework)
.SetProperty("Platform", f.platform)
.SetProjectFile(f.project)));
}
else
Expand All @@ -124,7 +125,7 @@ from framework in project.GetTargetFrameworks(true)
}

Target Test => _ => _
.DependsOn(Compile)
.DependsOn(Compile)
.Produces(TestResultDirectory / "*.trx")
.Executes(() => ExecutesTest(false));

Expand All @@ -134,8 +135,9 @@ void ExecutesTest(bool excludeNetFramework)

var testConfigurations =
from project in TestProjects
from framework in project.GetTargetFrameworksForTest(excludeNetFramework)
select new {project, framework};
from framework in project.GetTargetFrameworks(excludeNetFramework)
from platform in project.GetPlatformsForTests()
select new {project, framework, platform};

DotNetTest(_ =>
{
Expand All @@ -148,6 +150,8 @@ from framework in project.GetTargetFrameworksForTest(excludeNetFramework)
.CombineWith(testConfigurations, (_, v) => _
.SetProjectFile(v.project)
.SetFramework(v.framework)
.DisableNoBuild()
.SetProperty("Platform", v.platform)
.SetLogger($"trx;LogFileName={v.project.Name}-{v.framework}.trx"));
});

Expand Down
32 changes: 24 additions & 8 deletions Build/Nuke/ProjectExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using Nuke.Common.ProjectModel;

public static class ProjectExtensions
Expand All @@ -12,14 +14,28 @@ public static IReadOnlyCollection<string> GetTargetFrameworks(this Project proje
return frameworks.Where(x => x.Contains("standard") || x.Contains("core")).ToList();
}

public static IReadOnlyCollection<string> GetTargetFrameworksForTest(this Project project, bool excludeNetFramework)
public static IReadOnlyCollection<string> GetPlatforms(this Project project)
{
var frameworks = project
.GetTargetFrameworks()
//because github actions and azure pipeline does not handle it.
.Where(x=> !(x.Contains("netcoreapp1") || x.Contains("netcoreapp2.2")));
if (!excludeNetFramework)
return frameworks.ToList();
return frameworks.Where(x => x.Contains("standard") || x.Contains("core")).ToList();
var msbuildProject = project.GetMSBuildProject();
var targetFrameworkProperty = msbuildProject.GetProperty("Platform");
if (targetFrameworkProperty != null)
return new[] { targetFrameworkProperty.EvaluatedValue };

var targetFrameworksProperty = msbuildProject.GetProperty("Platforms");
if (targetFrameworksProperty != null)
return targetFrameworksProperty.EvaluatedValue.Split(';');

return new string[0];
}

public static IReadOnlyCollection<string> GetPlatformsForTests(this Project project)
{

var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
var platforms = project.GetPlatforms();
if (isWindows)
return platforms;
return platforms.Where(x=> x != "x86").ToList();
}

}
10 changes: 10 additions & 0 deletions Build/x64.runsettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<RunSettings>
<!-- Configurations that affect the Test Framework -->
<RunConfiguration>

<!-- x86 or x64 -->
<!-- You can also change it from the Test menu; choose "Processor Architecture for AnyCPU Projects" -->
<TargetPlatform>x64</TargetPlatform>

</RunConfiguration>
</RunSettings>
10 changes: 10 additions & 0 deletions Build/x86.runsettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<RunSettings>
<!-- Configurations that affect the Test Framework -->
<RunConfiguration>

<!-- x86 or x64 -->
<!-- You can also change it from the Test menu; choose "Processor Architecture for AnyCPU Projects" -->
<TargetPlatform>x86</TargetPlatform>

</RunConfiguration>
</RunSettings>
5 changes: 5 additions & 0 deletions StructLinq.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StructLinq", "src\StructLinq\StructLinq.csproj", "{458ED1F2-37EC-4569-9958-728CEFA43D8C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Build", "_Build", "{2987C571-432E-4640-8D24-A3F8C9341276}"
ProjectSection(SolutionItems) = preProject
azure-pipelines.yml = azure-pipelines.yml
.github\workflows\continuous.yml = .github\workflows\continuous.yml
.github\workflows\continuousCore.yml = .github\workflows\continuousCore.yml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StructLinq.Tests", "src\StructLinq.Tests\StructLinq.Tests.csproj", "{355C025E-3001-40F0-A456-05C13AF94466}"
EndProject
Expand Down
28 changes: 0 additions & 28 deletions appveyor.yml

This file was deleted.

60 changes: 11 additions & 49 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,19 @@ stages:
pool:
vmImage: 'windows-latest'
jobs:
- job: Setup
displayName: 'Setup'
dependsOn: [ ]
steps:
- task: UseDotNet@2
displayName: 'Setup .NET Core 2.2'
inputs:
packageType: runtime
version: 2.2.x

- job: Compile
displayName: '⚙️ Compile'
dependsOn: [ ]
dependsOn: [ Setup ]
steps:
- task: CmdLine@2
inputs:
Expand All @@ -50,51 +60,3 @@ stages:
inputs:
artifactName: packages
pathtoPublish: '.result/packages'
- stage: ubuntu_latest
displayName: 'ubuntu-latest'
dependsOn: [ ]
pool:
vmImage: 'ubuntu-latest'
jobs:
- job: CompileCoreOnly
displayName: '⚙️ CompileCoreOnly'
dependsOn: [ ]
steps:
- task: CmdLine@2
inputs:
script: './build.cmd Restore CompileCoreOnly --skip'
- job: TestCoreOnly
displayName: '🚦 TestCoreOnly'
dependsOn: [ CompileCoreOnly ]
steps:
- task: CmdLine@2
inputs:
script: './build.cmd TestCoreOnly --skip'
- task: PublishBuildArtifacts@1
inputs:
artifactName: test-results
pathtoPublish: '.result/test-results'
- stage: macOS_latest
displayName: 'macOS-latest'
dependsOn: [ ]
pool:
vmImage: 'macOS-latest'
jobs:
- job: CompileCoreOnly
displayName: '⚙️ CompileCoreOnly'
dependsOn: [ ]
steps:
- task: CmdLine@2
inputs:
script: './build.cmd Restore CompileCoreOnly --skip'
- job: TestCoreOnly
displayName: '🚦 TestCoreOnly'
dependsOn: [ CompileCoreOnly ]
steps:
- task: CmdLine@2
inputs:
script: './build.cmd TestCoreOnly --skip'
- task: PublishBuildArtifacts@1
inputs:
artifactName: test-results
pathtoPublish: '.result/test-results'
26 changes: 24 additions & 2 deletions src/StructLinq.BCL.Tests/ListLayoutTests.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using FluentAssertions;
using StructLinq.BCL.List;
using Xunit;

namespace StructLinq.BCL.Tests
{
public unsafe class ListLayoutTests
public class ListLayoutTests
{
[Theory]
[InlineData(0)]
Expand Down Expand Up @@ -35,7 +36,28 @@ public void ShouldMatchArrayOfString(int size)
layout.Items[i].Should().Be((i - 1).ToString());
}
}
}

#if IS_X86
public class BitnessTests
{
[Fact]
public void Checkx86Bitness()
{
Assert.Equal(4, IntPtr.Size);
}
}
#endif

#if IS_X64
public class BitnessTests
{
[Fact]
public void Checkx64Bitness()
{
Assert.Equal(8, IntPtr.Size);
}
}
#endif

}
Loading