Skip to content
This repository has been archived by the owner on May 31, 2023. It is now read-only.

Commit

Permalink
Fix CI failures (#34)
Browse files Browse the repository at this point in the history
* #28 - Add dotnet clean to CI pipeline.

* #28 - Remake build process in CI pipeline.

* #28 - Return back UseCache property.

* #28 - Add --log-level to CI pipeline.

* #28 - Update project files

* #28 - Change build script.
  • Loading branch information
fabasoad authored Jul 11, 2020
1 parent fd70407 commit b10c11f
Show file tree
Hide file tree
Showing 19 changed files with 130 additions and 40 deletions.
29 changes: 6 additions & 23 deletions .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,33 +45,16 @@ jobs:
uses: actions/[email protected]
with:
dotnet-version: 5.0.100-preview.6.20318.15
- name: .NET Core Info
run: dotnet --info
- name: Build
run: ./build.ps1 -os ${{ matrix.os }}
shell: pwsh
- name: Extract version
id: version
run: |
$Version = $([xml](Get-Content ghacu.nuspec)).package.metadata.version
Write-Output "Current version is $Version"
Write-Output "Current ghacu version is $Version"
Write-Output "::set-output name=value::$Version"
shell: pwsh
- name: Run GHACU (Windows)
if: ${{ matrix.os == 'windows-latest' }}
working-directory: ${{ github.workspace }}/bin/ghacu-${{ steps.version.outputs.value }}-win-x64
run: ./ghacu.exe --no-cache --repository "${{ github.workspace }}" --token ${{ secrets.GITHUB_TOKEN }}
- name: Run GHACU (Linux)
if: ${{ matrix.os == 'ubuntu-latest' }}
working-directory: ${{ github.workspace }}/bin/ghacu-${{ steps.version.outputs.value }}-linux-x64
run: |
chmod +x ./ghacu
./ghacu --no-cache --repository "${{ github.workspace }}" --token ${{ secrets.GITHUB_TOKEN }}
shell: pwsh
- name: Run GHACU (MacOS)
if: ${{ matrix.os == 'macos-latest' }}
working-directory: ${{ github.workspace }}/bin/ghacu-${{ steps.version.outputs.value }}-osx-x64
- name: Build
run: |
chmod +x ./ghacu
./ghacu --no-cache --repository "${{ github.workspace }}" --token ${{ secrets.GITHUB_TOKEN }}
shell: pwsh
dotnet clean
dotnet build -c Release -p:Version=${{ steps.version.outputs.value }}
- name: Run ghacu
run: dotnet ./src/Ghacu.Runner/bin/Release/netcoreapp5.0/ghacu.dll --no-cache --repository "${{ github.workspace }}" --token ${{ secrets.GITHUB_TOKEN }} --log-level Information
20 changes: 20 additions & 0 deletions .run/ghacu.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="ghacu" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="$PROJECT_DIR$/src/Ghacu.Runner/bin/Debug/netcoreapp5.0/ghacu.dll" />
<option name="PROGRAM_PARAMETERS" value="-r $PROJECT_DIR$/ --log-level Information" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/Ghacu.Runner/bin/Debug/netcoreapp5.0" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="PROJECT_PATH" value="$PROJECT_DIR$/src/Ghacu.Runner/Ghacu.Runner.csproj" />
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
<option name="PROJECT_KIND" value="DotNetCore" />
<option name="PROJECT_TFM" value=".NETCoreApp,Version=v5.0" />
<method v="2">
<option name="Build" />
</method>
</configuration>
</component>
4 changes: 2 additions & 2 deletions src/Ghacu.Api/Entities/Uses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ public sealed class Uses

public Uses(string fullName)
{
Type = fullName.StartsWith("docker://") ? UsesType.DOCKER : UsesType.GITHUB;
Type = fullName.StartsWith("docker://") ? UsesType.Docker : UsesType.GitHub;
string[] fullNameParts = Type switch
{
UsesType.DOCKER => fullName.Substring(9).Split(':'),
UsesType.Docker => fullName.Substring(9).Split(':'),
_ => fullName.Split('@')
};
FullName = fullNameParts[0];
Expand Down
4 changes: 2 additions & 2 deletions src/Ghacu.Api/Entities/UsesType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace Ghacu.Api.Entities
{
public enum UsesType
{
DOCKER,
GITHUB
Docker,
GitHub
}
}
4 changes: 3 additions & 1 deletion src/Ghacu.Api/Entities/WorkflowFile.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System;

namespace Ghacu.Api.Entities
{
public sealed class WorkflowFile
Expand All @@ -7,7 +9,7 @@ public WorkflowFile(string path)
FilePath = path;
}

public string Name => FilePath.Substring(FilePath.IndexOf(".github"));
public string Name => FilePath.Substring(FilePath.IndexOf(".github", StringComparison.Ordinal));
public string FilePath { get; }
}
}
4 changes: 2 additions & 2 deletions src/Ghacu.Api/Entities/WorkflowInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public void Upgrade()
.SelectMany(job => job.Steps)
.Where(step => !step.IsUpToDate))
{
string delimiter = step.Uses.Type == UsesType.DOCKER ? ":" : "@";
string prefix = step.Uses.Type == UsesType.DOCKER ? "docker://" : string.Empty;
string delimiter = step.Uses.Type == UsesType.Docker ? ":" : "@";
string prefix = step.Uses.Type == UsesType.Docker ? "docker://" : string.Empty;
content = Regex.Replace(
content,
$"(.*)({step.UsesFullName}[ \t]*)(\n.*)",
Expand Down
12 changes: 11 additions & 1 deletion src/Ghacu.Api/Ghacu.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@

<PropertyGroup>
<TargetFramework>netcoreapp5.0</TargetFramework>
<RootNamespace>Api</RootNamespace>
<Title>GHACU</Title>
<Copyright>Yevhen Fabizhevskyi</Copyright>
<PackageProjectUrl>https://github.com/fabasoad/ghacu/</PackageProjectUrl>
<PackageLicenseUrl>https://raw.githubusercontent.com/fabasoad/ghacu/main/LICENSE</PackageLicenseUrl>
<PackageIconUrl>https://raw.githubusercontent.com/fabasoad/ghacu/main/logo.png</PackageIconUrl>
<RepositoryUrl>https://github.com/fabasoad/ghacu/</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageVersion>2.0.0</PackageVersion>
<Authors>fabasoad</Authors>
<OutputType>Library</OutputType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="semver" Version="2.0.6" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.164" />
<PackageReference Include="YamlDotNet" Version="8.1.2" />
<PackageReference Update="StyleCop.Analyzers" Version="1.2.0-beta.164" />
</ItemGroup>

</Project>
12 changes: 12 additions & 0 deletions src/Ghacu.Cache/Ghacu.Cache.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

<PropertyGroup>
<TargetFramework>netcoreapp5.0</TargetFramework>
<NeutralLanguage>en-UA</NeutralLanguage>
<Title>GHACU</Title>
<Copyright>Yevhen Fabizhevskyi</Copyright>
<PackageProjectUrl>https://github.com/fabasoad/ghacu/</PackageProjectUrl>
<PackageLicenseUrl>https://raw.githubusercontent.com/fabasoad/ghacu/main/LICENSE</PackageLicenseUrl>
<PackageIconUrl>https://raw.githubusercontent.com/fabasoad/ghacu/main/logo.png</PackageIconUrl>
<RepositoryUrl>https://github.com/fabasoad/ghacu/</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageVersion>2.0.0</PackageVersion>
<Authors>fabasoad</Authors>
<OutputType>Library</OutputType>
</PropertyGroup>

<ItemGroup>
Expand All @@ -10,6 +21,7 @@
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0-preview.6.20305.6" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0-preview.6.20305.6" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.164" />
<PackageReference Update="StyleCop.Analyzers" Version="1.2.0-beta.164" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Ghacu.Cache/MemoryCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

[assembly: InternalsVisibleTo("Telerik.JustMock")]
[assembly: InternalsVisibleTo("Ghacu.Cache.Tests")]

namespace Ghacu.Cache
{
public class MemoryCache : ILatestVersionProvider
Expand Down
12 changes: 11 additions & 1 deletion src/Ghacu.GitHub/Ghacu.GitHub.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,25 @@

<PropertyGroup>
<TargetFramework>netcoreapp5.0</TargetFramework>
<Title>GHACU</Title>
<Copyright>Yevhen Fabizhevskyi</Copyright>
<PackageProjectUrl>https://github.com/fabasoad/ghacu/</PackageProjectUrl>
<PackageLicenseUrl>https://raw.githubusercontent.com/fabasoad/ghacu/main/LICENSE</PackageLicenseUrl>
<PackageIconUrl>https://raw.githubusercontent.com/fabasoad/ghacu/main/logo.png</PackageIconUrl>
<RepositoryUrl>https://github.com/fabasoad/ghacu/</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageVersion>2.0.0</PackageVersion>
<Authors>fabasoad</Authors>
<OutputType>Library</OutputType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.0-preview.6.20305.6" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0-preview.6.20305.6" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0-preview.6.20305.6" />
<PackageReference Include="Octokit" Version="0.48.0" />
<PackageReference Include="StructureMap.Microsoft.DependencyInjection" Version="2.0.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.164" />
<PackageReference Update="StyleCop.Analyzers" Version="1.2.0-beta.164" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 3 additions & 1 deletion src/Ghacu.GitHub/GitHubService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ public class GitHubService : IGitHubService
public GitHubService(
ILoggerFactory loggerFactory,
Func<LatestVersionProviderType, ILatestVersionProvider> latestVersionProviderFactory,
IGlobalConfig globalConfig,
ISemaphoreSlimProxy semaphore)
{
_logger = loggerFactory.CreateLogger<GitHubService>();
_provider = latestVersionProviderFactory(LatestVersionProviderType.MemoryCache);
_provider = latestVersionProviderFactory(
globalConfig.UseCache ? LatestVersionProviderType.MemoryCache : LatestVersionProviderType.GitHub);
_semaphore = semaphore;
}

Expand Down
7 changes: 7 additions & 0 deletions src/Ghacu.Runner/Ghacu.Runner.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
<NeutralLanguage>en-UA</NeutralLanguage>
<LangVersion>preview</LangVersion>
<PackageVersion>2.0.0</PackageVersion>
<Title>GHACU</Title>
<Copyright>Yevhen Fabizhevskyi</Copyright>
<PackageProjectUrl>https://github.com/fabasoad/ghacu/</PackageProjectUrl>
<PackageLicenseUrl>https://raw.githubusercontent.com/fabasoad/ghacu/main/LICENSE</PackageLicenseUrl>
<PackageIconUrl>https://raw.githubusercontent.com/fabasoad/ghacu/main/logo.png</PackageIconUrl>
<RepositoryUrl>https://github.com/fabasoad/ghacu/</RepositoryUrl>
<RepositoryType>git</RepositoryType>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Ghacu.Runner/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using StructureMap;

[assembly: InternalsVisibleTo("Ghacu.Runner.Tests")]

namespace Ghacu.Runner
{
public class Program
Expand Down
13 changes: 11 additions & 2 deletions src/Ghacu.Workflow/Ghacu.Workflow.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,25 @@

<PropertyGroup>
<TargetFramework>netcoreapp5.0</TargetFramework>
<RootNamespace>Workflow</RootNamespace>
<Title>GHACU</Title>
<Copyright>Yevhen Fabizhevskyi</Copyright>
<PackageProjectUrl>https://github.com/fabasoad/ghacu/</PackageProjectUrl>
<PackageLicenseUrl>https://raw.githubusercontent.com/fabasoad/ghacu/main/LICENSE</PackageLicenseUrl>
<PackageIconUrl>https://raw.githubusercontent.com/fabasoad/ghacu/main/logo.png</PackageIconUrl>
<RepositoryUrl>https://github.com/fabasoad/ghacu/</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageVersion>2.0.0</PackageVersion>
<Authors>fabasoad</Authors>
<OutputType>Library</OutputType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.0-preview.6.20305.6" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0-preview.6.20305.6" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0-preview.6.20305.6" />
<PackageReference Include="StructureMap.Microsoft.DependencyInjection" Version="2.0.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.164" />
<PackageReference Include="YamlDotNet" Version="8.1.2" />
<PackageReference Update="StyleCop.Analyzers" Version="1.2.0-beta.164" />
</ItemGroup>

<ItemGroup>
Expand Down
11 changes: 11 additions & 0 deletions tests/Ghacu.Cache.Tests/Ghacu.Cache.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

<PropertyGroup>
<TargetFramework>netcoreapp5.0</TargetFramework>
<Title>GHACU</Title>
<Copyright>Yevhen Fabizhevskyi</Copyright>
<PackageProjectUrl>https://github.com/fabasoad/ghacu/</PackageProjectUrl>
<PackageLicenseUrl>https://raw.githubusercontent.com/fabasoad/ghacu/main/LICENSE</PackageLicenseUrl>
<PackageIconUrl>https://raw.githubusercontent.com/fabasoad/ghacu/main/logo.png</PackageIconUrl>
<RepositoryUrl>https://github.com/fabasoad/ghacu/</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageVersion>2.0.0</PackageVersion>
<Authors>fabasoad</Authors>
<OutputType>Library</OutputType>
</PropertyGroup>

<ItemGroup>
Expand All @@ -12,6 +22,7 @@
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.164" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.2" />
<PackageReference Update="StyleCop.Analyzers" Version="1.2.0-beta.164" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 5 additions & 0 deletions tests/Ghacu.Runner.Tests/Cli/OptionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public void GitHubToken_ConfiguredCorrectly()
Assert.NotNull(attrs);
Assert.Single(attrs);
var option = attrs[0] as OptionAttribute;
Assert.NotNull(option);
Assert.Equal("t", option.ShortName);
Assert.Equal("token", option.LongName);
Assert.False(option.Required);
Expand All @@ -27,6 +28,7 @@ public void LogLevel_ConfiguredCorrectly()
Assert.NotNull(attrs);
Assert.Single(attrs);
var option = attrs[0] as OptionAttribute;
Assert.NotNull(option);
Assert.Equal("l", option.ShortName);
Assert.Equal("log-level", option.LongName);
Assert.False(option.Required);
Expand All @@ -43,6 +45,7 @@ public void NoCache_ConfiguredCorrectly()
Assert.NotNull(attrs);
Assert.Single(attrs);
var option = attrs[0] as OptionAttribute;
Assert.NotNull(option);
Assert.Equal("n", option.ShortName);
Assert.Equal("no-cache", option.LongName);
Assert.False(option.Required);
Expand Down Expand Up @@ -82,6 +85,7 @@ public void Repository_ConfiguredCorrectly()
Assert.NotNull(attrs);
Assert.Single(attrs);
var option = attrs[0] as OptionAttribute;
Assert.NotNull(option);
Assert.Equal("r", option.ShortName);
Assert.Equal("repository", option.LongName);
Assert.False(option.Required);
Expand All @@ -95,6 +99,7 @@ public void Upgrade_ConfiguredCorrectly()
Assert.NotNull(attrs);
Assert.Single(attrs);
var option = attrs[0] as OptionAttribute;
Assert.NotNull(option);
Assert.Equal("u", option.ShortName);
Assert.Equal("upgrade", option.LongName);
Assert.False(option.Required);
Expand Down
11 changes: 11 additions & 0 deletions tests/Ghacu.Runner.Tests/Ghacu.Runner.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

<PropertyGroup>
<TargetFramework>netcoreapp5.0</TargetFramework>
<Title>GHACU</Title>
<Copyright>Yevhen Fabizhevskyi</Copyright>
<PackageProjectUrl>https://github.com/fabasoad/ghacu/</PackageProjectUrl>
<PackageLicenseUrl>https://raw.githubusercontent.com/fabasoad/ghacu/main/LICENSE</PackageLicenseUrl>
<PackageIconUrl>https://raw.githubusercontent.com/fabasoad/ghacu/main/logo.png</PackageIconUrl>
<RepositoryUrl>https://github.com/fabasoad/ghacu/</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageVersion>2.0.0</PackageVersion>
<Authors>fabasoad</Authors>
<OutputType>Library</OutputType>
</PropertyGroup>

<ItemGroup>
Expand All @@ -11,6 +21,7 @@
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.164" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.2" />
<PackageReference Update="StyleCop.Analyzers" Version="1.2.0-beta.164" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class WorkflowValidationExceptionTest
[Fact]
public void Create_ReturnsValidMessage()
{
var message = "Test Message";
const string message = "Test Message";
Assert.Equal(message, new WorkflowValidationException(message).Message);
}
}
Expand Down
14 changes: 10 additions & 4 deletions tests/Ghacu.Workflow.Tests/Ghacu.Workflow.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
<IsPackable>false</IsPackable>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;osx-x64</RuntimeIdentifiers>
<TargetFramework>netcoreapp5.0</TargetFramework>
<PackageVersion>2.0.0</PackageVersion>
<Authors>fabasoad</Authors>
<Title>GHACU</Title>
<Copyright>Yevhen Fabizhevskyi</Copyright>
<PackageProjectUrl>https://github.com/fabasoad/ghacu/</PackageProjectUrl>
<PackageLicenseUrl>https://raw.githubusercontent.com/fabasoad/ghacu/main/LICENSE</PackageLicenseUrl>
<PackageIconUrl>https://raw.githubusercontent.com/fabasoad/ghacu/main/logo.png</PackageIconUrl>
<RepositoryUrl>https://github.com/fabasoad/ghacu/</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<OutputType>Library</OutputType>
</PropertyGroup>

<ItemGroup>
Expand All @@ -24,8 +34,4 @@
<ProjectReference Include="..\..\src\Ghacu.Workflow\Ghacu.Workflow.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="coverage" />
</ItemGroup>

</Project>

0 comments on commit b10c11f

Please sign in to comment.