Giter Site home page Giter Site logo

cake-contrib / cake.hockeyapp Goto Github PK

View Code? Open in Web Editor NEW
4.0 7.0 13.0 7.07 MB

This Addin for the Cake allows you to upload your package to HockeyApp.

Home Page: http://cakebuild.net/dsl/hockeyapp

License: MIT License

C# 68.98% PowerShell 25.77% Shell 5.25%

cake.hockeyapp's Introduction

Cake.HockeyApp - An Addin for Cake

Cake.HockeyApp

AppVeyor master branch nuget pre release

Cake.HockeyApp allows you to upload an app package to HockeyApp with just two lines of code. In order to use the exposed commands you have to add the following line at top of your build.cake file:

#addin Cake.HockeyApp

Then you can upload your package to HockeyApp:

UploadToHockeyApp("./output/myApp.apk");

That's all!

Don't forget to set your api token from HockeyApp as environment variable: HOCKEYAPP_API_TOKEN on your local machine or CI system.


More Examples

Upload an apk / ipa to HockeyApp

Task("Upload-To-HockeyApp")
    .IsDependentOn("Build-APK")
    .Does(() => UploadToHockeyApp("./output/myApp.apk"));

Upload an apk / ipa to HockeyApp with result.

Task("Upload-To-HockeyApp")
    .IsDependentOn("Build-APK")
    .Does(() =>
{
    var result = UploadToHockeyApp("./output/myApp.apk"));
    // Use result.PublicUrl to inform others where they can download the newly uploaded package.
}

Upload a Windows package.

Unfortunately, HockeyApp currently does only support metadata discovering for Android, iOS and macOS packages. Therefore you have to specify a version AND app id your self. This means that you have to create the app once before uploading. Create new App. Creating a new version is automatically done by this addin.

Task("Upload-To-HockeyApp")
    .IsDependentOn("Build-AppX")
    .Does(() =>
{
    UploadToHockeyApp( "./output/myWindowsApp.appx", new HockeyAppUploadSettings
    {
        AppId = appIdFromHockeyApp,
        Version = "1.0.160901.1",
        ShortVersion = "1.0-beta2",
        Notes = "Uploaded via continuous integration."
    });
}

The available parameters for the upload settings are descripted here: http://support.hockeyapp.net/kb/api/api-versions#upload-version

REMEMBER For all request you make you either have to set your API token from HockeyApp as environment variable: HOCKEYAPP_API_TOKEN or pass it into the call via


Build

To build this package we are using Cake.

On Windows PowerShell run:

./build

On OSX/Linux run:

./build.sh

cake.hockeyapp's People

Contributors

alexblount avatar gep13 avatar jericho avatar jonlipsky avatar kibiz0r avatar matissehack avatar msjogren avatar reicheltp avatar rlittlesii avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cake.hockeyapp's Issues

Recommended changes resulting from automated audit

We performed an automated audit of your Cake addin and found that it does not follow all the best practices.

We encourage you to make the following modifications:

  • You are currently referencing Cake.Core 0.28.0. Please upgrade to 0.33.0
  • The nuget package for your addin should use the cake-contrib icon. Specifically, your addin's .csproj should have a line like this: <PackageIconUrl>https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/cake-contrib-medium.png</PackageIconUrl>.

Apologies if this is already being worked on, or if there are existing open issues, this issue was created based on what is currently published for this package on NuGet.

This issue was created by a tool: Cake.AddinDiscoverer version 3.12.1

UploadToHockeyApp fails to upload artifacts

Addin Version: 0.5.0
Cake Version: 0.21.1
.NET 4.5

hockey.cake

#addin "nuget:https://api.nuget.org/v3/index.json?package=Cake.HockeyApp&version=0.5.0"

Task("Upload-To-Hockey")
    .IsDependentOn("Zip-Bundle")
    .Does(() =>
    {
        var zip = File("./artifacts/uwp/sample.UWP.zip");

        var token = EnvironmentVariable("HOCKEY_API_TOKEN");
        var appId = EnvironmentVariable("HOCKEY_APP_APP_ID");

        UploadToHockeyApp(zip, new HockeyAppUploadSettings
        {
            ApiToken = token,
            AppId = appId,
            Version = BuildVersion.AssemblySemVer
        });
    });

results in the following error

This instance has already started one or more requests. Properties can only be modified before sending the first request.

An error occurred when executing task 'Upload-To-Hockey'.

Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: Upload to Hockey App failed.
   at Cake.HockeyApp.HockeyAppAliases.UploadToHockeyApp(ICakeContext context, FilePath file, FilePath symbolsFile, HockeyAppUploadSettings settings)
   at Cake.HockeyApp.HockeyAppAliases.UploadToHockeyApp(ICakeContext context, FilePath file, HockeyAppUploadSettings settings)
   at Submission#0.UploadToHockeyApp(FilePath file, HockeyAppUploadSettings settings) in :line 2334
   at Submission#0.<.ctor>b__32() in C:/Source/sample/build/hockey.cake:line 13
   at Cake.Core.ActionTask.Execute(ICakeContext context)
   at Cake.Core.DefaultExecutionStrategy.Execute(CakeTask task, ICakeContext context)
   at Cake.Core.CakeEngine.ExecuteTask(ICakeContext context, IExecutionStrategy strategy, Stopwatch stopWatch, CakeTask task, CakeReport report)
   at Cake.Core.CakeEngine.RunTarget(ICakeContext context, IExecutionStrategy strategy, String target)
   at Cake.Scripting.BuildScriptHost.RunTarget(String target)
   at Submission#0..ctor(Session session, CakeReport& submissionResult) in C:/Source/sample/build.cake:line 44
   at Submission#0.<Factory>(Session session)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Cake.Scripting.Roslyn.Stable.DebugRoslynScriptSession.Execute(Script script)
   at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath, IDictionary`2 arguments)
   at Cake.Commands.DebugCommand.Execute(CakeOptions options)
   at Cake.CakeApplication.Run(CakeOptions options)
   at Cake.Program.Main()

Recommended changes resulting from automated audit

We performed an automated audit of your Cake addin and found that it does not follow all the best practices.

We encourage you to make the following modifications:

  • You are currently referencing Cake.Core 0.28.0. Please upgrade to 0.33.0
  • The nuget package for your addin should use the cake-contrib icon. Specifically, your addin's .csproj should have a line like this: <PackageIconUrl>https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/cake-contrib-medium.png</PackageIconUrl>.

Apologies if this is already being worked on, or if there are existing open issues, this issue was created based on what is currently published for this package on NuGet.

This issue was created by a tool: Cake.AddinDiscoverer version 3.12.1

Missing reference to System.Net.Http ?

I'm using the most recent version of Cake, 0.22.2, and as when the build script is precompiling, I'm met with the following error message:

Could not load C:\dev\MyProject_build\tools\Addins\cake.hockeyapp\Cake.HockeyApp\lib\net46\Cake.HockeyApp.dll (missing System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)
Compiling build script...
Cake.exe : Error: Error occurred when compiling build script: C:/dev/MyProject/_build/build.cake(175,13): error CS0103: The name 'UploadToHockeyApp' does not exist in the current context

I have both .NET 4.6.1/4.7 and .NET Core 2 installed on my system

Doesn't work on Mac

Error is this:

Could not find any assemblies compatible with .NETFramework,Version=v4.5.
Error: Failed to install addin 'Cake.HockeyApp'.

Duplicate Hockeyapp entries using `master`, or 422 error on `develop`

Hi,

It's likely that this is just me using it incorrectly, but I'm struggling to get it to work. Thought I'd check here in case these are known issues. I can always try and dig a little deeper otherwise :)

I've tried with both the latest version on nuget (master branch), and have also compiled and tried the latest version from the develop branch - but am having different issues with both ...

The version on nuget does work, however it seems to create two separate entries in Hockeyapp. Looking at what my computer is sending using Fiddler, it seems to be doing a POST to create the app, then doing a further PUT with the application in it. I notice that the later version doesn't seem to do a PUT.

When I try using the latest version, it fails saying (422) Unprocessable Entity. Using Fiddler again, the error in the POST response body says ...

{"errors":{"bundle_version":["can't be blank"]}}

I am specifying both the Version and the ShortVersion.

Below is my cake task ...

Task("HockeyAppDeploy")
    .IsDependentOn("Build")
    .Does(() => {
        UploadToHockeyApp(signedApkPath, new HockeyAppUploadSettings 
        {
            AppId = hockeyAppAppId,
            ApiToken = hockeyAppApiToken,
            Version = newVersionCode.ToString(),
            ShortVersion = newVersionNumber,
            Notes = "Uploaded from Cake",
            Notify = NotifyOption.AllTesters,
            Mandatory = MandatoryOption.Mandatory,
            Status = DownloadStatus.Allowed,
            Private = false,
            ReleaseType = ReleaseType.Beta
        });
    });

Below is the request captured from Fidder ...

POST https://rink.hockeyapp.net/api/2/apps/*******************/app_versions/new HTTP/1.1
Content-Type: multipart/form-data; boundary=----CakeUpload32423423423423*****
X-HockeyAppToken: ***********************
Host: rink.hockeyapp.net
Content-Length: 377
Expect: 100-continue
Connection: Keep-Alive

------CakeUpload54beab43PcfafP4732Pb06aPf12e********
Content-Type: text/plain; charset=utf-8
Content-Disposition: form-data; name=bundle_version

1090
------CakeUpload54beab4*****************************
Content-Type: text/plain; charset=utf-8
Content-Disposition: form-data; name=bundle_short_version

1.0.9.0
------CakeUpload54be**********************--

I notice that it doesn't seem to be sending most of the properties I set in the the Cake task (although the one from nuget does).

Are these known issues at the moment?

Thanks for your help, and as I say - I can always dig deeper if they're not known issues.

Thanks,
Dan

UploadToHockeyApp not working

I just moved from Cake.HockeyApp version 0.2.3 to 0.3.1 and Cake 0.17 to 0.20 (tested with 0.18 and 0.20)

  • tools/packages.config:
<?xml version="1.0" encoding="utf-8"?>
<packages>
   <package id="Cake" version="0.20.0" />
</packages>
  • My current script (mobile.cake):
#tool "GitVersion.CommandLine"
#addin "Cake.Xamarin"
#addin "Cake.FileHelpers"
#addin "Cake.AndroidAppManifest"
#addin "Cake.Plist"
#addin "Cake.HockeyApp"
#addin "Cake.Git"
#addin "Cake.Incubator"
#addin "MagicChunks"
using System.Text.RegularExpressions;

// artifacts/android/release/.....apk
var workingDirectoryFullPath = Context.Environment.WorkingDirectory.FullPath;
var artifactsDir = "artifacts";

Task("UploadAndroidToHockeyApp")
    .Does(() =>
    {
        var path = $"{workingDirectoryFullPath}/{artifactsDir}/android/release/{androidPackage}";
        Information(path);
        var apkFilePath = File(path);
        UploadToHockeyApp(apkFilePath, new HockeyAppUploadSettings 
        {
            AppId = "appid",            
            ApiToken = "apptoken",
            // ReleaseType = ReleaseType.Beta,
            // Status = DownloadStatus.Allowed,
            // NoteType = NoteType.Markdown,
            // Notes = "Uploaded via cake"
        });    
    });

RunTarget("UploadAndroidToHockeyApp");
  • Execution
./build.sh --script mobile.cake --verbosity diagnostic
  • Output
========================================
UploadAndroidToHockeyApp
========================================
Executing task: UploadAndroidToHockeyApp
/Users/jrodriguez/Projects/NET/Xamarin/check/artifacts/android/release/com.winhotelsolution.check.apk
Initialized HockeyApp Api at https://rink.hockeyapp.net
Uploading file to HockeyApp. This can take several minutes....
Creating Version  () for f83f9b5fa7a44b7582ce699d797badfb.
One or more errors occurred.
String reference not set to an instance of a String.
Parameter name: s
An error occurred when executing task 'UploadAndroidToHockeyApp'.

----------------------------------------
Teardown
----------------------------------------
Executing custom teardown action...
Finished running tasks.
Error: System.Exception: Upload to Hockey App failed.
  at Cake.HockeyApp.HockeyAppAliases.UploadToHockeyApp (Cake.Core.ICakeContext context, Cake.Core.IO.FilePath file, Cake.Core.IO.FilePath symbolsFile, Cake.HockeyApp.HockeyAppUploadSettings settings) [0x00071] in <542037da95674b128648de6657465dcb>:0
  at Cake.HockeyApp.HockeyAppAliases.UploadToHockeyApp (Cake.Core.ICakeContext context, Cake.Core.IO.FilePath file, Cake.HockeyApp.HockeyAppUploadSettings settings) [0x00000] in <542037da95674b128648de6657465dcb>:0
  at CakeBuildScriptImpl.UploadToHockeyApp (Cake.Core.IO.FilePath file, Cake.HockeyApp.HockeyAppUploadSettings settings) [0x00006] in <d2a84f6b5ad842d09c7fe35594658d07>:0
  at CakeBuildScriptImpl+<Execute>c__AnonStorey1.<>m__1B () [0x0005e] in <d2a84f6b5ad842d09c7fe35594658d07>:0
  at Cake.Core.CakeTaskBuilderExtensions+<>c__DisplayClass5_0.<Does>b__0 (Cake.Core.ICakeContext context) [0x00000] in <5b31f5a87daa44669c1990c3ebac72fd>:0
  at Cake.Core.ActionTask.Execute (Cake.Core.ICakeContext context) [0x00015] in <5b31f5a87daa44669c1990c3ebac72fd>:0
  at Cake.Core.DefaultExecutionStrategy.Execute (Cake.Core.CakeTask task, Cake.Core.ICakeContext context) [0x00066] in <5b31f5a87daa44669c1990c3ebac72fd>:0
  at Cake.Core.CakeEngine.ExecuteTask (Cake.Core.ICakeContext context, Cake.Core.IExecutionStrategy strategy, System.Diagnostics.Stopwatch stopWatch, Cake.Core.CakeTask task, Cake.Core.CakeReport report) [0x0007b] in <5b31f5a87daa44669c1990c3ebac72fd>:0
  at Cake.Core.CakeEngine.RunTarget (Cake.Core.ICakeContext context, Cake.Core.IExecutionStrategy strategy, System.String target) [0x000ff] in <5b31f5a87daa44669c1990c3ebac72fd>:0
  at Cake.Scripting.BuildScriptHost.RunTarget (System.String target) [0x00018] in <048c7da9ad3749dbb879705d4614451b>:0
  at Cake.Scripting.Mono.CodeGen.CakeBuildScriptImplBase.RunTarget (System.String target) [0x00006] in <048c7da9ad3749dbb879705d4614451b>:0
  at CakeBuildScriptImpl.Execute () [0x00950] in <d2a84f6b5ad842d09c7fe35594658d07>:0
  at <InteractiveExpressionClass>.Host (System.Object& $retval) [0x0000a] in <f35166603b584575bf7c5c17ff8eee2f>:0
  at Mono.CSharp.Evaluator.Evaluate (System.String input, System.Object& result, System.Boolean& result_set) [0x0003e] in <e5610ebfe8c34526a8158db3c89186d4>:0
  at Mono.CSharp.Evaluator.Run (System.String statement) [0x00000] in <e5610ebfe8c34526a8158db3c89186d4>:0
  at Cake.Scripting.Mono.MonoScriptSession.Execute (Cake.Core.Scripting.Script script) [0x0004b] in <048c7da9ad3749dbb879705d4614451b>:0
  at Cake.Core.Scripting.ScriptRunner.Run (Cake.Core.Scripting.IScriptHost host, Cake.Core.IO.FilePath scriptPath, System.Collections.Generic.IDictionary`2[TKey,TValue] arguments) [0x002b2] in <5b31f5a87daa44669c1990c3ebac72fd>:0
  at Cake.Commands.BuildCommand.Execute (Cake.CakeOptions options) [0x00026] in <048c7da9ad3749dbb879705d4614451b>:0
  at Cake.CakeApplication.Run (Cake.CakeOptions options) [0x00015] in <048c7da9ad3749dbb879705d4614451b>:0
  at Cake.Program.Main () [0x000bb] in <048c7da9ad3749dbb879705d4614451b>:0

Upload Dsym to Hockey App not working

Line 104 in the hockey app client is checking the wrong file for extension validity

fix
if (symbolFile != null)
{
var isSupportedSymbols = symbolFile.FullPath.EndsWith(".dsym.zip")
|| symbolFile.FullPath.EndsWith("mapping.txt");

            if (!isSupportedSymbols)
            {
                throw new ArgumentException(
                    "Symbols file needs to be of the following type: *.dsym.zip for iOS / OS X, or mapping.txt file for Android.",
                    nameof(symbolFile));
            }
        }

Example apk file

@reicheltp in the Unit Tests for this project, there is an apk file that is referenced. I don't have that file, and I think it would make sense for it to reside in this repository so that the tests can be executed. Would you be able to provide this file?

For now, I have commented out the test where this is used.

Cake.HockeyApp does not work anymore with actual Cake (0.19.1)

Unfortunateley the plugin does not work anymore with Cake version 0.19.1. I become the following error:

Error: The assembly 'Cake.HockeyApp, Version=0.2.3.0, Culture=neutral, PublicKeyToken=null' 
is referencing an older version of Cake.Core (0.7.0). 
This assembly need to reference at least Cake.Core version 0.16.0. 
Another option is to downgrade Cake to an earlier version.

How can i fix this problem?

Thanks for your help
Andreas

Update Cake 0.28.0

We performed an automated audit of your Cake addin and found that it does not follow all the best practices.

We encourage you to make the following modifications:

  • You are currently referencing Cake.Core 0.26.0. Please upgrade to 0.28.0
  • Your addin should target netstandard2.0. Please note that there is no need to multi-target, netstandard2.0 is sufficient.

Apologies if this is already being worked on, or if there are existing open issues, this issue was created based on what is currently published for this package on NuGet.org and in the project on github.

Incorrect AppVeyor cache settings

There no longer seems to be a packages folder for NuGet dependencies, therefore the cache entry in the AppVeyor yaml file is no longer required.

Recommended changes resulting from automated audit

We performed an automated audit of your Cake addin and found that it does not follow all the best practices.

We encourage you to make the following modifications:

  • You are currently referencing Cake.Core 0.28.0. Please upgrade to 0.33.0
  • The nuget package for your addin should use the cake-contrib icon. Specifically, your addin's .csproj should have a line like this: <PackageIconUrl>https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/cake-contrib-medium.png</PackageIconUrl>.

Apologies if this is already being worked on, or if there are existing open issues, this issue was created based on what is currently published for this package on NuGet.

This issue was created by a tool: Cake.AddinDiscoverer version 3.12.1

Add integration tests for android apk

Adding a set of integration tests to verify Cake.HockeyApp.

  • Add cake scripts to tests\integration

  • Add Android apk as a resource

  • Add to build pipeline

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.