diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index ebe35fa..1ce6a22 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -34,10 +34,11 @@ jobs: with: fetch-depth: 0 - # If this run was triggered by a pull request event, then checkout - # the head of the pull request instead of the merge commit. - - run: git checkout HEAD^2 - if: ${{ github.event_name == 'pull_request' }} + - name: Cache Tools + uses: actions/cache@v2 + with: + path: tools + key: ${{ runner.os }}-tools-${{ hashFiles('recipe.cake') }} # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL @@ -49,8 +50,13 @@ jobs: # Prefix the list here with "+" to use these queries and those in the config file. # queries: ./path/to/local/query, your-org/your-repo/queries@main - - run: ./build.ps1 --target=DotNetCore-Build - shell: pwsh + - name: Build project + uses: cake-build/cake-action@v1 + with: + script-path: recipe.cake + target: DotNetCore-Build + cake-version: 0.38.5 + cake-bootstrap: true - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v1 \ No newline at end of file diff --git a/.github/workflows/publishDocs.yml b/.github/workflows/publishDocs.yml index 36331b6..77b4f9a 100644 --- a/.github/workflows/publishDocs.yml +++ b/.github/workflows/publishDocs.yml @@ -16,10 +16,10 @@ jobs: steps: - name: checkout uses: actions/checkout@v2 - with: - fetch-depth: 0 # GitVersion is somewhat irritated when fetch-depth is "1".... - ref: ${{ github.event.ref }} - + + - name: Fetch all tags and branches + run: git fetch --prune --unshallow + - name: Cache Tools uses: actions/cache@v2 with: @@ -32,5 +32,5 @@ jobs: script-path: recipe.cake target: Force-Publish-Documentation verbosity: Diagnostic - cake-version: 0.38.4 + cake-version: 0.38.5 cake-bootstrap: true diff --git a/src/Guidelines/Guidelines.csproj b/src/Guidelines/Guidelines.csproj index 200c7ef..66fd862 100644 --- a/src/Guidelines/Guidelines.csproj +++ b/src/Guidelines/Guidelines.csproj @@ -23,7 +23,7 @@ cake, build, automation, guideline, addin https://github.com/cake-contrib/CakeContrib.Guidelines.git git - images/icon.png + images/cake-contrib-community-medium.png https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/cake-contrib-medium.png 2.8 true @@ -36,4 +36,4 @@ - \ No newline at end of file + diff --git a/src/Guidelines/build/Icon.targets b/src/Guidelines/build/Icon.targets index 5085a49..6416060 100644 --- a/src/Guidelines/build/Icon.targets +++ b/src/Guidelines/build/Icon.targets @@ -10,12 +10,22 @@ + BeforeTargets="CoreBuild;SetNuspecProperties;GenerateNuspec;_GetPackageFiles" + DependsOnTargets="EnsureProjectTypeIsSet"> + + $(MSBuildThisFileDirectory)/../images/cake-contrib-community-medium.png + $(MSBuildThisFileDirectory)/../images/cake-contrib-addin-medium.png + $(MSBuildThisFileDirectory)/../images/cake-contrib-module-medium.png + $(MSBuildThisFileDirectory)/../images/cake-contrib-recipe-medium.png + @@ -38,11 +48,20 @@ ItemName="None" /> + + https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/community/cake-contrib-community-medium.png + https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/addin/cake-contrib-addin-medium.png + https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/module/cake-contrib-module-medium.png + https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/recipe/cake-contrib-recipe-medium.png + diff --git a/src/Guidelines/images/cake-contrib-addin-medium.png b/src/Guidelines/images/cake-contrib-addin-medium.png new file mode 100644 index 0000000..84c2a82 Binary files /dev/null and b/src/Guidelines/images/cake-contrib-addin-medium.png differ diff --git a/src/Guidelines/images/cake-contrib-community-medium.png b/src/Guidelines/images/cake-contrib-community-medium.png new file mode 100644 index 0000000..32494fa Binary files /dev/null and b/src/Guidelines/images/cake-contrib-community-medium.png differ diff --git a/src/Guidelines/images/cake-contrib-module-medium.png b/src/Guidelines/images/cake-contrib-module-medium.png new file mode 100644 index 0000000..4db5deb Binary files /dev/null and b/src/Guidelines/images/cake-contrib-module-medium.png differ diff --git a/src/Guidelines/images/cake-contrib-recipe-medium.png b/src/Guidelines/images/cake-contrib-recipe-medium.png new file mode 100644 index 0000000..c3f7ce7 Binary files /dev/null and b/src/Guidelines/images/cake-contrib-recipe-medium.png differ diff --git a/src/Guidelines/images/icon.png b/src/Guidelines/images/icon.png deleted file mode 100644 index 9881edc..0000000 Binary files a/src/Guidelines/images/icon.png and /dev/null differ diff --git a/src/Tasks.IntegrationTests/E2eTests.cs b/src/Tasks.IntegrationTests/E2eTests.cs index b5bc44a..b4dcd5f 100644 --- a/src/Tasks.IntegrationTests/E2eTests.cs +++ b/src/Tasks.IntegrationTests/E2eTests.cs @@ -347,11 +347,8 @@ public void ProjectType_Manually_Set_Is_Not_Overridden() public void ProjectType_When_Assembly_Is_Module_Is_Module() { // given + fixture.WithAssemblyName("Cake.Buildsystems.Module"); fixture.WithCustomContent(@" - - Cake.Buildsystems.Module - - - Cake.7zip - - x.IndexOf("icon.png", StringComparison.OrdinalIgnoreCase) > -1); output = output.Substring(output.IndexOf("!FOR-TEST!:", StringComparison.OrdinalIgnoreCase)+11); output.Should().Contain("Pack:True"); - output.Should().Contain("Link:icon.png"); + output.Should().Contain("Link:cake-contrib-addin-medium.png"); output.Should().Contain("PackagePath:"); } - [Fact] - public void Packaging_Should_Add_The_IconUrl_To_Properties() + [Theory] + [InlineData("Cake.7zip", "/../images/cake-contrib-addin-medium.png")] + [InlineData("Cake.Recipe", "/../images/cake-contrib-recipe-medium.png")] + [InlineData("Cake.Buildsystems.Module", "/../images/cake-contrib-module-medium.png")] + [InlineData("Polly", "/../images/cake-contrib-community-medium.png")] + public void Packaging_Different_Types_Should_Add_The_Correct_Icon(string assemblyName, string expectedFileName) + { + // given + fixture.WithoutPackageIcon(); + fixture.WithoutPackageIconUrl(); + fixture.WithAssemblyName(assemblyName); + fixture.WithCustomContent(@" + + true + + + + + +"); + + // when + var result = fixture.Run(); + + // then + result.IsErrorExitCode.Should().BeFalse(); + var output = result.WarningLines + .Where(x => x.IndexOf("!FOR-TEST!:", StringComparison.OrdinalIgnoreCase) > -1) + .First(x => x.IndexOf("icon.png", StringComparison.OrdinalIgnoreCase) > -1); + output = output.Substring(output.IndexOf("!FOR-TEST!:", StringComparison.OrdinalIgnoreCase)+11); + output.Should().Contain(expectedFileName); + } + + [Theory] + [InlineData("Cake.7zip", "cake-contrib/graphics/png/addin/cake-contrib-addin-medium.png")] + [InlineData("Cake.Recipe", "cake-contrib/graphics/png/recipe/cake-contrib-recipe-medium.png")] + [InlineData("Cake.Buildsystems.Module", "cake-contrib/graphics/png/module/cake-contrib-module-medium.png")] + [InlineData("Polly", "cake-contrib/graphics/png/community/cake-contrib-community-medium.png")] + public void Packaging_Different_Types_Should_Add_The_Correct_IconUrl_To_Properties(string assemblyName, string expectedUrl) { // given fixture.WithoutPackageIcon(); fixture.WithoutPackageIconUrl(); + fixture.WithAssemblyName(assemblyName); fixture.WithCustomContent(@" true @@ -512,7 +546,7 @@ public void Packaging_Should_Add_The_IconUrl_To_Properties() var output = result.WarningLines .Single(x => x.IndexOf("!FOR-TEST!:", StringComparison.OrdinalIgnoreCase) > -1); output = output.Substring(output.IndexOf("!FOR-TEST!:", StringComparison.OrdinalIgnoreCase)+11); - output.Should().Contain("cake-contrib/graphics/png/cake-contrib-medium.png"); + output.Should().Contain(expectedUrl); } [Fact] diff --git a/src/Tasks.IntegrationTests/Fixtures/E2eTestFixture.cs b/src/Tasks.IntegrationTests/Fixtures/E2eTestFixture.cs index 42db07a..8878288 100644 --- a/src/Tasks.IntegrationTests/Fixtures/E2eTestFixture.cs +++ b/src/Tasks.IntegrationTests/Fixtures/E2eTestFixture.cs @@ -341,5 +341,10 @@ public void WithoutDefaultCakeReference() { hasDefaultCakeReference = false; } + + public void WithAssemblyName(string name) + { + assemblyName = name; + } } } diff --git a/src/Tasks.IntegrationTests/Tasks.IntegrationTests.csproj b/src/Tasks.IntegrationTests/Tasks.IntegrationTests.csproj index 2821275..ea9daa6 100644 --- a/src/Tasks.IntegrationTests/Tasks.IntegrationTests.csproj +++ b/src/Tasks.IntegrationTests/Tasks.IntegrationTests.csproj @@ -23,13 +23,13 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Tasks.Tests/EnsureCakeContribIconTests.cs b/src/Tasks.Tests/EnsureCakeContribIconTests.cs index 627b2e2..9bef6b4 100644 --- a/src/Tasks.Tests/EnsureCakeContribIconTests.cs +++ b/src/Tasks.Tests/EnsureCakeContribIconTests.cs @@ -58,7 +58,7 @@ public void Should_Not_Output_NewNoneRef_If_None_Is_Specified() { // given var fixture = new EnsureCakeContribIconFixture(); - fixture.WithIconFileReference("temp\\logo.png", ""); + fixture.WithIconFileReference("temp\\icon.png", ""); // when fixture.Execute(); diff --git a/src/Tasks.Tests/Fixtures/EnsureCakeContribIconFixture.cs b/src/Tasks.Tests/Fixtures/EnsureCakeContribIconFixture.cs index 2fecffb..18686cf 100644 --- a/src/Tasks.Tests/Fixtures/EnsureCakeContribIconFixture.cs +++ b/src/Tasks.Tests/Fixtures/EnsureCakeContribIconFixture.cs @@ -18,7 +18,7 @@ public EnsureCakeContribIconFixture() { fileFacadeMock = new Mock(); noneReferences = new List(); - cakeContribDefaultIcon = "C:\\users\\someUser\\.dotnet\\whatever\\CakeContrib-Guidelines\\data\\logo.png"; + cakeContribDefaultIcon = "C:\\users\\someUser\\.dotnet\\whatever\\CakeContrib-Guidelines\\data\\icon.png"; } public string PackageIconOutput { get; private set; } diff --git a/src/Tasks.Tests/Tasks.Tests.csproj b/src/Tasks.Tests/Tasks.Tests.csproj index bcdafbc..95f5d64 100644 --- a/src/Tasks.Tests/Tasks.Tests.csproj +++ b/src/Tasks.Tests/Tasks.Tests.csproj @@ -23,13 +23,13 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Tasks/EnsureCakeContribIcon.cs b/src/Tasks/EnsureCakeContribIcon.cs index 2371f3c..18ac91c 100644 --- a/src/Tasks/EnsureCakeContribIcon.cs +++ b/src/Tasks/EnsureCakeContribIcon.cs @@ -97,7 +97,7 @@ public override bool Execute() return false; } - PackageIconOutput = Path.GetFileName(CakeContribIconPath.NormalizePathSeparators()); + PackageIconOutput = "icon" + Path.GetExtension(CakeContribIconPath.NormalizePathSeparators()); Log.CcgTrace($"PackageIcon was not set. Setting it to {PackageIconOutput}."); } diff --git a/src/Tasks/Tasks.csproj b/src/Tasks/Tasks.csproj index 431c4d7..e87094c 100644 --- a/src/Tasks/Tasks.csproj +++ b/src/Tasks/Tasks.csproj @@ -14,7 +14,7 @@ - +