Skip to content

Commit

Permalink
Feature/7 ci pipeline (#20)
Browse files Browse the repository at this point in the history
* #7 moved all MS build scripts out of the way. all projects are building

* added ci pipeline draft definition

* fixed proxy prj not building

* added test step

* dotnet build & dotnet test are running

* dotnet build and dotnet test are working

* dotnet test no longer crashes

* added test results publish

* added Azure Functions and Dapr SDKs

* added dapr init to pipeline

* fix for Configuration doesn't allow containers to access services on the host

* create network manualy

* os matrix

* xplat test runner fix

* Setup Docker on macOS

* win install tweaks

* back to powershell

* win uses powershell

* try to get win build running

* script tweak

* path fix

* switchwed to dapr install action

* leave dapr aside for now

* back to ubuntu

* removed matrix

* missing condition

* just the failing

* see docker host ip

* fix for ubuntu??

* check if linux in pipeline

* only tests that run in pipeline
  • Loading branch information
razvangoga authored Feb 29, 2024
1 parent 89967b7 commit a966c16
Show file tree
Hide file tree
Showing 148 changed files with 203 additions and 132 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Users referenced in this file will automatically be requested as reviewers for PRs that modify the given paths.
# See https://help.github.com/articles/about-code-owners/

* @philliphoff @ravipal
* @razvangoga
65 changes: 52 additions & 13 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,61 @@ name: CI
on:
workflow_dispatch:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]

jobs:
build:

ci:
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- uses: actions/checkout@v3

- name: Find Docker Host IP
uses: addnab/docker-run-action@v1
with:
image: alpine:latest
run: apk update > /dev/null && apk add iproute2 > /dev/null && ip -4 route show default | cut -d' ' -f3

# test prerequisites
# dotnet 6,7,8
- name: Install .NET 6
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Install .NET 7
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Install .NET 8
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
# azure function sdk
- name: Install Azure Functions SDK
run: npm install -g azure-functions-core-tools@4
# dapr
- name: Dapr tool installer
uses: dapr/setup-dapr@v1
- name: Init Dapr
run: dapr init

- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore

- name: Test
run: dotnet test --filter FailsInGithubActions!=true --no-build --logger trx

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
job_summary: true
files: |
**/*.trx
File renamed without changes.
27 changes: 27 additions & 0 deletions .old-ms-ci/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup Condition="'$(CopyrightNetFoundation)' != ''">
<Copyright>$(CopyrightNetFoundation)</Copyright>
</PropertyGroup>

<PropertyGroup>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<StrongNameKeyId>Microsoft</StrongNameKeyId>
</PropertyGroup>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)LICENSE.txt" Pack="true" PackagePath="" />
</ItemGroup>

<PropertyGroup>
<!-- Lots of our dependencies are not strong-named -->
<NoWarn>$(NoWarn);8002</NoWarn>
<Nullable>enable</Nullable>
<LangVersion>8.0</LangVersion>
</PropertyGroup>

<Import Project="$(RepoRoot)test\Test.Infrastructure\Microsoft.AspNetCore.Testing.props" Condition=" '$(IsTestProject)' == 'true' " />


</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<Project>
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />

<Project>
<PropertyGroup Label="Resx settings">
<GenerateResxSource Condition="$(GenerateResxSource) == ''">true</GenerateResxSource>
<GenerateResxSourceEmitFormatMethods Condition="$(GenerateResxSourceEmitFormatMethods) == ''">true</GenerateResxSourceEmitFormatMethods>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions .old-ms-ci/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"sdk": {
"allowPrerelease": true
},
"tools": {
"dotnet": "8.0.100-preview.3.23178.7",
"runtimes": {
"dotnet": [
"6.0.0"
],
"aspnetcore": [
"6.0.0"
]
}
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.23265.1"
}
}
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions .old-ms-ci/src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.props))\Directory.Build.props" />

<PropertyGroup>
<IsPackable>true</IsPackable>
<DebugType>Embedded</DebugType>
</PropertyGroup>
</Project>
File renamed without changes.
8 changes: 8 additions & 0 deletions .old-ms-ci/tests/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.props))\Directory.Build.props" />

<PropertyGroup>
<IsPackable>false</IsPackable>
<IsShipping>false</IsShipping>
</PropertyGroup>
</Project>
21 changes: 1 addition & 20 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,29 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" />

<PropertyGroup Condition="'$(CopyrightNetFoundation)' != ''">
<Copyright>$(CopyrightNetFoundation)</Copyright>
</PropertyGroup>

<PropertyGroup>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<StrongNameKeyId>Microsoft</StrongNameKeyId>
</PropertyGroup>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)LICENSE.txt" Pack="true" PackagePath="" />
</ItemGroup>

<PropertyGroup>
<!-- Lots of our dependencies are not strong-named -->
<NoWarn>$(NoWarn);8002</NoWarn>
<GenerateRuntimeConfigDevFile>true</GenerateRuntimeConfigDevFile>
<Nullable>enable</Nullable>
<LangVersion>8.0</LangVersion>
</PropertyGroup>

<Import Project="$(RepoRoot)test\Test.Infrastructure\Microsoft.AspNetCore.Testing.props" Condition=" '$(IsTestProject)' == 'true' " />


</Project>
22 changes: 5 additions & 17 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
{
"sdk": {
"allowPrerelease": true
},
"tools": {
"dotnet": "8.0.100-preview.3.23178.7",
"runtimes": {
"dotnet": [
"6.0.0"
],
"aspnetcore": [
"6.0.0"
]
"sdk": {
"version": "8.0.200",
"rollForward": "latestPatch",
"allowPrerelease": false
}
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.23265.1"
}
}
}
4 changes: 2 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.props))\Directory.Build.props" />

<PropertyGroup>
<IsPackable>true</IsPackable>
<DebugType>Embedded</DebugType>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/Microsoft.Tye.Core/ContainerEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private static bool TryUseDocker(ref string? unusableReason, ref string? contain
// host.docker.internal is making it's way into linux docker but doesn't work yet
// instead we use the machine IP
var addresses = Dns.GetHostAddresses(Dns.GetHostName());
containerHost = addresses[0].ToString();
containerHost = addresses.Last().ToString();

// We need to bind to all interfaces on linux since the container -> host communication won't work
// if we use the IP address to reach out of the host. This works fine on osx and windows
Expand Down
6 changes: 3 additions & 3 deletions src/Microsoft.Tye.Core/CoreStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
Expand Down Expand Up @@ -181,6 +181,6 @@
<value>Path "{path}" was not found.</value>
</data>
<data name="ExpectedEnvironmentVariableValue" xml:space="preserve">
<value>Expected a value for environment variable "{key}".</value>
<value>Expected a value for environment variable "{key}". </value>
</data>
</root>
</root>
6 changes: 6 additions & 0 deletions src/Microsoft.Tye.Core/Microsoft.Tye.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
<PackageReference Include="System.Security.Principal.Windows" Version="5.0.0" />
<PackageReference Include="YamlDotNet" Version="11.2.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />

<!-- RG 2024-02-19 #7 - needed to generate resx codebehind without MS Arcade build -->
<PackageReference Include="Microsoft.CodeAnalysis.ResxSourceGenerator" Version="3.11.0-beta1.24072.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.Tye.Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("Microsoft.Tye.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleTo("Microsoft.Tye.UnitTests")]
2 changes: 1 addition & 1 deletion src/Microsoft.Tye.Hosting/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("Microsoft.Tye.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleTo("Microsoft.Tye.UnitTests")]
12 changes: 1 addition & 11 deletions src/Microsoft.Tye.Proxy/Microsoft.Tye.Proxy.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,11 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bedrock.Framework" Version="0.1.62-alpha.g8a965bbcba" />
<PackageReference Include="System.IO.Pipelines" Version="4.7.2" />
</ItemGroup>

<!-- Include *.deps.json and *.runtimeconfig.json in ContentWithTargetPath so they will be copied to the output folder of projects
that reference this one. -->
<Target Name="AddRuntimeDependenciesToContent" Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp'" BeforeTargets="GetCopyToOutputDirectoryItems">
<ItemGroup>
<ContentWithTargetPath Include="$(ProjectDepsFilePath)" CopyToOutputDirectory="PreserveNewest" TargetPath="$(ProjectDepsFileName)" />

<ContentWithTargetPath Include="$(ProjectRuntimeConfigFilePath)" CopyToOutputDirectory="PreserveNewest" TargetPath="$(ProjectRuntimeConfigFileName)" />
</ItemGroup>
</Target>
</Project>
8 changes: 7 additions & 1 deletion test/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<Project>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.props))\Directory.Build.props" />

<PropertyGroup>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>10.0</LangVersion>

<IsPackable>false</IsPackable>
<IsShipping>false</IsShipping>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
</Project>
58 changes: 25 additions & 33 deletions test/E2ETest/Microsoft.Tye.E2ETests.csproj
Original file line number Diff line number Diff line change
@@ -1,51 +1,43 @@

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>Microsoft.Tye.E2ETest</AssemblyName>
<IsTestProject>true</IsTestProject>
<!-- TODO: Investigate Ubuntu >16.04 test hangs and Mac test failures and re-enable E2E tests. -->
<IsUnitTestProject>false</IsUnitTestProject>
<TestRunnerName>XUnit</TestRunnerName>
</PropertyGroup>

<ItemGroup>
<!--
The Microsoft.Build.Locator package takes care of dynamically loading these assemblies
at runtime. We don't need/want to ship them, just to have them as references.
-->

<PackageReference Include="Microsoft.Build" Version="17.3.2" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.Build.Framework" Version="17.3.2" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.Build.Locator" Version="1.5.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0"/>
<PackageReference Include="xunit" Version="2.7.0"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.Tye.Hosting\Microsoft.Tye.Hosting.csproj" />
<ProjectReference Include="..\Test.Infrastructure\Test.Infrastructure.csproj" />
<ProjectReference Include="..\..\src\Microsoft.Tye.Core\Microsoft.Tye.Core.csproj" />
<ProjectReference Include="..\..\src\tye\tye.csproj" />

</ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.Tye.Hosting\Microsoft.Tye.Hosting.csproj"/>
<ProjectReference Include="..\Test.Infrastructure\Test.Infrastructure.csproj"/>
<ProjectReference Include="..\..\src\Microsoft.Tye.Core\Microsoft.Tye.Core.csproj"/>
<ProjectReference Include="..\..\src\tye\tye.csproj"/>

<ItemGroup>

<Content Include="testassets\**\*" CopyToOutputDirectory="PreserveNewest" />
<Compile Remove="testassets\**\*" />
<None Remove="testassets\generate\apps-with-ingress.1.18.yaml" />
<None Remove="testassets\projects\non-standard-dashboard-port\test-project\appsettings.Development.json" />
<None Remove="testassets\projects\non-standard-dashboard-port\test-project\appsettings.json" />
<None Remove="testassets\projects\non-standard-dashboard-port\test-project\Properties\launchSettings.json" />
<None Remove="testassets\projects\non-standard-dashboard-port\tye.yaml" />
<None Remove="testassets\projects\non-standard-dashboard-port-7.0\test-project\appsettings.Development.json" />
<None Remove="testassets\projects\non-standard-dashboard-port-7.0\test-project\appsettings.json" />
<None Remove="testassets\projects\non-standard-dashboard-port-7.0\tye.yaml" />
<Compile Include="..\..\src\shared\KubectlDetector.cs" Link="KubectlDetector.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<Content Include="testassets\**\*" CopyToOutputDirectory="PreserveNewest"/>
<Compile Remove="testassets\**\*"/>
<None Remove="testassets\generate\apps-with-ingress.1.18.yaml"/>
<None Remove="testassets\projects\non-standard-dashboard-port\test-project\appsettings.Development.json"/>
<None Remove="testassets\projects\non-standard-dashboard-port\test-project\appsettings.json"/>
<None Remove="testassets\projects\non-standard-dashboard-port\test-project\Properties\launchSettings.json"/>
<None Remove="testassets\projects\non-standard-dashboard-port\tye.yaml"/>
<None Remove="testassets\projects\non-standard-dashboard-port-7.0\test-project\appsettings.Development.json"/>
<None Remove="testassets\projects\non-standard-dashboard-port-7.0\test-project\appsettings.json"/>
<None Remove="testassets\projects\non-standard-dashboard-port-7.0\tye.yaml"/>
<Compile Include="..\..\src\shared\KubectlDetector.cs" Link="KubectlDetector.cs"/>
</ItemGroup>

</Project>
Loading

0 comments on commit a966c16

Please sign in to comment.