Skip to content
Open
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
156 changes: 156 additions & 0 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
name: .NET Core

# use https://marketplace.visualstudio.com/items?itemName=me-dutour-mathieu.vscode-github-actions to validate yml in vscode
env:
NUGET_PACKAGES_DIRECTORY: '.nupkg'
RESHARPER_CLI_NAME: 'JetBrains.ReSharper.CommandLineTools.Unix'
RESHARPER_CLI_VERSION: "2019.2.3"
DOCKER_DRIVER: overlay
CONTAINER_IMAGE: codeclimate/codeclimate
CONTAINER_TAG: '0.85.2'
rIds: ${{ secrets.rIds }}
dotnetVersion: 5.0.404

on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.dotnetVersion}}
- name: Build with dotnet
run: |
export DOTNET_CLI_TELEMETRY_OPTOUT=1
cd DotNet.Bundle
dotnet build
dotnet pack
cd ..
dotnet build


# dotnet build -c Release
# dotnet pack -c Release
- name: Tests
run: |
dotnet test --logger "junit" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput='./TestResults/'
- name: Coverage Report
run: |
dotnet --version
dotnet tool install dotnet-reportgenerator-globaltool --tool-path tools
./tools/reportgenerator "-reports:**/TestResults/coverage.opencover.xml;" "-targetdir:Reports" -reportTypes:TextSummary;
./tools/reportgenerator "-reports:**/TestResults/coverage.opencover.xml;" "-targetdir:Reports" -reportTypes:Html;
./tools/reportgenerator "-reports:**/TestResults/coverage.opencover.xml;" "-targetdir:Reports" -reportTypes:Badges;
cat ./Reports/Summary.txt
- uses: actions/upload-artifact@v1
with:
name: CodeCoverage
path: Reports
- name: Resharper Code Quality
run: |
# apt update && apt install -y curl zip unzip
curl -LO "https://download.jetbrains.com/resharper/ReSharperUltimate.$RESHARPER_CLI_VERSION/$RESHARPER_CLI_NAME.$RESHARPER_CLI_VERSION.zip"
unzip -q $RESHARPER_CLI_NAME.$RESHARPER_CLI_VERSION.zip -d "resharper"
mkdir -p CodeQuality
files=(*.sln)
# sh ./resharper/dupfinder.sh "${files[0]}" --output=CodeQuality/dupfinderReport.html --format=Html
# sh ./resharper/inspectcode.sh "${files[0]}" --output=CodeQuality/inspectcodeReport.html --format=Html
- uses: actions/upload-artifact@v1
with:
name: CodeQuality
path: CodeQuality
# - name: upload release
# uses: actions/upload-artifact@v2
# if: ${{ env.rIds }} != ''
# with:
# name: Release_unix
# path: Release/post

build-win:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.dotnetVersion}}
- name: Build with dotnet
run: |
set DOTNET_CLI_TELEMETRY_OPTOUT=1
cd DotNet.Bundle
dotnet build
dotnet pack
cd ..
dotnet build


# dotnet build -c Release
# dotnet pack -c Release
- name: Tests
run: |
dotnet test --logger "junit" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput='.\TestResults\'
# - name: prerelease
# if: ${{ env.rIds }} != ''
# run: |
# echo "build, obfuscate, and release"
# dotnet tool install Obfuscar.GlobalTool --tool-path tools --version 2.2.28
# .\scripts\extractRelease.cmd
# set rIds=$env:rIds
# .\scripts\pipeline.cmd
# .\scripts\finalRelease.cmd
# - name: upload release
# uses: actions/upload-artifact@v2
# if: ${{ env.rIds }} != ''
# with:
# name: Release_win
# path: Release\post

code_docs:
runs-on: windows-latest
name: code documentation
steps:
- uses: actions/checkout@v1
- name: docfx
run: |
curl -LO "https://github.com/dotnet/docfx/releases/download/v2.48/docfx.zip"
powershell.exe -NoP -NonI -Command "Expand-Archive '.\docfx.zip' '.\docfx\'"
./docfx/docfx.exe
- uses: actions/upload-artifact@v1
with:
name: CodeDocs
path: _site

security:
runs-on: ubuntu-latest
name: Snyk Security Scan
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.dotnetVersion}}
- name: Build with dotnet
run: |
export DOTNET_CLI_TELEMETRY_OPTOUT=1
cd DotNet.Bundle
dotnet build
dotnet pack
cd ..
dotnet build
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/dotnet@master
with:
args: --file=MyProject.sln
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@ msbuild.wrn

# Intellij Idea
.idea/


TestResults/
docs/
docfx*/
16 changes: 8 additions & 8 deletions DotNet.Bundle/AppBundler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ namespace Dotnet.Bundle
{
public class AppBundler
{
private readonly BundleAppTask _task;
private readonly IBundleAppTask _task;
private readonly StructureBuilder _builder;

public AppBundler(BundleAppTask task, StructureBuilder builder)
public AppBundler(IBundleAppTask task, StructureBuilder builder)
{
_task = task;
_builder = builder;
Expand All @@ -33,8 +33,8 @@ private void CopyFiles(DirectoryInfo source, DirectoryInfo target, DirectoryInfo
{
var path = Path.Combine(target.FullName, fileInfo.Name);

_task.Log.LogMessage($"Copying file from: {fileInfo.FullName}");
_task.Log.LogMessage($"Copying to destination: {path}");
_task.LogMessage($"Copying file from: {fileInfo.FullName}");
_task.LogMessage($"Copying to destination: {path}");

fileInfo.CopyTo(path, true);
}
Expand All @@ -54,21 +54,21 @@ private void CopyIcon(DirectoryInfo source, DirectoryInfo destination)
var iconName = _task.CFBundleIconFile;
if (string.IsNullOrWhiteSpace(iconName))
{
_task.Log.LogMessage($"No icon is specified for bundle");
_task.LogMessage($"No icon is specified for bundle");
return;
}

var sourcePath = Path.Combine(source.FullName, iconName);
_task.Log.LogMessage($"Icon file source for bundle is: {sourcePath}");
_task.LogMessage($"Icon file source for bundle is: {sourcePath}");

var targetPath = Path.Combine(destination.FullName, Path.GetFileName(iconName));
_task.Log.LogMessage($"Icon file destination for bundle is: {targetPath}");
_task.LogMessage($"Icon file destination for bundle is: {targetPath}");

var sourceFile = new FileInfo(sourcePath);

if (sourceFile.Exists)
{
_task.Log.LogMessage($"Copying icon file to destination: {targetPath}");
_task.LogMessage($"Copying icon file to destination: {targetPath}");
sourceFile.CopyTo(targetPath);
}
}
Expand Down
60 changes: 51 additions & 9 deletions DotNet.Bundle/BundleAppTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,51 @@

namespace Dotnet.Bundle
{
public class BundleAppTask : Task
public interface IBundleAppTask
{
string OutDir { get; set; }

string PublishDir { get; set; }

string CFBundleName { get; set; }

string CFBundleDisplayName { get; set; }

string CFBundleIdentifier { get; set; }

string CFBundleVersion { get; set; }

string CFBundlePackageType { get; set; }

string CFBundleSignature { get; set; }

string CFBundleExecutable { get; set; }

string CFBundleIconFile { get; set; }

string CFBundleShortVersionString { get; set; }

string NSPrincipalClass { get; set; }

bool NSHighResolutionCapable { get; set; }

bool NSRequiresAquaSystemAppearance { get; set; }

bool? NSRequiresAquaSystemAppearanceNullable { get; set; }

ITaskItem[] CFBundleURLTypes { get; set; }

bool Execute();
void LogMessage(string message);
}
public class BundleAppTask : Task, IBundleAppTask
{
[Required]
public string OutDir { get; set; }

[Required]
public string PublishDir { get; set; }

[Required]
public string CFBundleName { get; set; }

Expand All @@ -36,31 +73,36 @@ public class BundleAppTask : Task
public string CFBundleIconFile { get; set; }

[Required]
public string CFBundleShortVersionString { get; set; }
public string CFBundleShortVersionString { get; set; }

[Required]
public string NSPrincipalClass { get; set; }

[Required]
public bool NSHighResolutionCapable { get; set; }

public bool NSRequiresAquaSystemAppearance {
public bool NSRequiresAquaSystemAppearance
{
get => NSRequiresAquaSystemAppearanceNullable.Value;
set => NSRequiresAquaSystemAppearanceNullable = value;
}

internal bool? NSRequiresAquaSystemAppearanceNullable { get; private set; }
public bool? NSRequiresAquaSystemAppearanceNullable { get; set; }

public ITaskItem[] CFBundleURLTypes { get; set; }
public void LogMessage(string message)
{
Log.LogMessage(message);
}

public override bool Execute()
{
var builder = new StructureBuilder(this);
builder.Build();

var bundler = new AppBundler(this, builder);
bundler.Bundle();

var plistWriter = new PlistWriter(this, builder);
plistWriter.Write();

Expand Down
Loading