Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(GH-514) ArgumentNullException when running on Ubuntu #515

Merged
merged 3 commits into from
Apr 20, 2024
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and tests
name: Integration tests

# Workflow Trigger
on:
Expand Down Expand Up @@ -36,6 +36,35 @@ jobs:
with:
name: NuGet Package
path: ./BuildArtifacts/Packages/NuGet/
# Integration Tests Cake.Issues.MsBuild Cake Scripting
IntegrationTestsMsBuildCakeScripting:
name: Integration Tests Cake.Issues.MsBuild Cake Scripting
needs: Build
strategy:
fail-fast: false
matrix:
os: [
windows-2019, windows-2022,
ubuntu-20.04, ubuntu-22.04,
macos-11, macos-14]
dotnet: [6.x, 7.x, 8.x]
runs-on: ${{ matrix.os }}
steps:
- name: Get the sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Download build artifact
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4
with:
name: NuGet Package
path: ./BuildArtifacts/Packages/NuGet
- name: Install .NET
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Run integration tests
run: ./build.sh --verbosity=diagnostic
working-directory: ./tests/Cake.Issues.MsBuild/script-runner/
shell: bash
# Integration Tests Cake.Issues.PullRequests.GitHubActions Cake Scripting
IntegrationTestsPullRequestsGitHubActionsCakeScripting:
name: Integration Tests Cake.Issues.PullRequests.GitHubActions Cake Scripting
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Unit tests

# Workflow Trigger
on:
# Trigger the workflow on a pull request to any branch
pull_request:
# Triggers the workflow in the event there is a push to master
push:
branches:
- master

jobs:
Test:
name: Run unit tests
strategy:
fail-fast: false
matrix:
os: [
windows-2019, windows-2022,
ubuntu-20.04, ubuntu-22.04,
# Cake.Recipe currently does not support macOS 14 (M1)
macos-11, macos-13]
runs-on: ${{ matrix.os }}
steps:
- name: Get the sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Fetch all tags and branches
run: git fetch --prune --unshallow
- name: Install .NET
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4
with:
# .NET 5 required for GitVersion
dotnet-version: |
5.x
6.x
7.x
8.x
- name: Test
run: ./build.sh --target=Test
shell: bash
29 changes: 29 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,35 @@ stages:
artifact: Integration Tests Cake.Issues.Markdownlint $(System.JobName)
displayName: 'Publish generated reports as build artifact'

- stage: IntegrationTestsMsBuildStage
displayName: Integration Tests Cake.Issues.MsBuild
dependsOn: BuildStage
jobs:
- job: TestMsBuildJob
displayName: Test
strategy:
matrix:
Windows_Server_2019:
imageName: 'windows-2019'
Windows_Server_2022:
imageName: 'windows-2022'
macOS_11:
imageName: 'macOS-11'
macOS_13:
imageName: 'macOS-13'
Ubuntu_20_04:
imageName: 'ubuntu-20.04'
Ubuntu_22_04:
imageName: 'ubuntu-22.04'
pool:
vmImage: $(imageName)
steps:
- template: .azuredevops/pipelines/templates/steps/install-net6.yml
- template: .azuredevops/pipelines/templates/steps/provide-nuget-packages.yml
- powershell: ./build.ps1 --verbosity=diagnostic
workingDirectory: ./tests/Cake.Issues.MsBuild/script-runner
displayName: 'Run integration tests'

- stage: IntegrationTestsReportingConsoleStage
displayName: Integration Tests Cake.Issues.Reporting.Console
dependsOn: BuildStage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using Cake.Core.Diagnostics;
using Microsoft.Build.Framework;
using Microsoft.Build.Logging.StructuredLogger;
Expand All @@ -23,6 +24,13 @@ public override IEnumerable<IIssue> ReadIssues(
repositorySettings.NotNull(nameof(repositorySettings));
issueProviderSettings.NotNull(nameof(issueProviderSettings));

// Ensure that strings for MsBuild.StructuredLogger are initialized.
// See https://github.com/KirillOsenkov/MSBuildStructuredLog/issues/736
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
Strings.Initialize();
}

var result = new List<IIssue>();

var binLogReader = new BinLogReader();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"cake.tool": {
"version": "4.0.0",
"commands": [
"dotnet-cake"
]
}
}
}
Loading
Loading