From 7387dfe5daedfae1ebe6df3f164579eb434f605f Mon Sep 17 00:00:00 2001 From: ChristopherHX Date: Sun, 15 Oct 2023 18:03:42 +0200 Subject: [PATCH] fix tests on linux and run them in ci --- .github/workflows/build.yml | 7 ++++++- src/Sdk.Tests/AzurePipelines/TestData/TestGenerator.cs | 2 +- src/Sdk.Tests/AzurePipelines/Util/LocalFileProvider.cs | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 78218eef3d6..dcd6bce12ed 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -81,11 +81,16 @@ jobs: path: | _package - - name: Unit Tests + - name: Unit Tests (actions/runner) if: matrix.runtime != 'linux-arm64' && matrix.runtime != 'linux-arm' && matrix.runtime != 'osx-arm64' run: | ${{ matrix.devScript }} test working-directory: src + + - name: Unit Tests (Sdk.Tests) + if: matrix.runtime != 'linux-arm64' && matrix.runtime != 'linux-arm' && matrix.runtime != 'osx-arm64' + run: | + dotnet test src/Sdk.Tests/Sdk.Tests.csproj - name: Setup if: 'false' # Disabled due to 403 of statuses api with this token and rate limit diff --git a/src/Sdk.Tests/AzurePipelines/TestData/TestGenerator.cs b/src/Sdk.Tests/AzurePipelines/TestData/TestGenerator.cs index 830d15ad646..095a3f55b59 100644 --- a/src/Sdk.Tests/AzurePipelines/TestData/TestGenerator.cs +++ b/src/Sdk.Tests/AzurePipelines/TestData/TestGenerator.cs @@ -18,7 +18,7 @@ public static IEnumerable ResolveWorkflows(string basePath, string bool asPipeline = false; // prioritize filtering pipeline*.yml files - var pipelines = files.Where(i => i.Contains("\\pipeline")); + var pipelines = files.Where(i => i.Contains($"{Path.DirectorySeparatorChar}pipeline")); if (pipelines.Any()) { asPipeline = true; diff --git a/src/Sdk.Tests/AzurePipelines/Util/LocalFileProvider.cs b/src/Sdk.Tests/AzurePipelines/Util/LocalFileProvider.cs index b16ff522e65..1ce7a55eca2 100644 --- a/src/Sdk.Tests/AzurePipelines/Util/LocalFileProvider.cs +++ b/src/Sdk.Tests/AzurePipelines/Util/LocalFileProvider.cs @@ -18,9 +18,9 @@ public async Task ReadFile(string repositoryAndRef, string path) #region Helper methods for local repositories public void AddRepo(string repositoryAndRef, string folderPath) { - if (!folderPath.EndsWith(@"\")) + if (!folderPath.EndsWith(Path.DirectorySeparatorChar)) { - folderPath = $"{folderPath}\\"; + folderPath = $"{folderPath}{Path.DirectorySeparatorChar}"; } string repoName = repositoryAndRef.Split("@")[0]; repos[repoName] = folderPath;