cake-build / cake-action Goto Github PK
View Code? Open in Web Editor NEW:cake::octocat: Run Cake (C# Make) scripts in your GitHub Actions workflows.
Home Page: https://cakebuild.net
License: MIT License
:cake::octocat: Run Cake (C# Make) scripts in your GitHub Actions workflows.
Home Page: https://cakebuild.net
License: MIT License
Hi,
It seems GitVersion.CommandLine is always failing when running under latest Ubuntu but not on Windows. See below.
Workflow error:
run-detectors: unable to find an interpreter for /home/runner/work/xxx/xxx/tools/GitVersion.CommandLine.5.1.2/tools/GitVersion.exe
An error occurred when executing task '__UpdateAssemblyVersionInformation'.
Error:
One or more errors occurred. (GitVersion: Process returned an error (exit code 2).)
GitVersion: Process returned an error (exit code 2).
##[error]The process 'tools/dotnet-cake' failed with exit code 1
Workflow snippet:
- name: Run the Cake script
uses: cake-build/cake-action@v1
with:
script-path: build.cake
target: Build
verbosity: Verbose
cake-version: ${{ matrix.cake }}
cake-bootstrap: true
Cake script snippet:
#tool "nuget:?package=GitVersion.CommandLine&version=5.1.2"
GitVersion(new GitVersionSettings {
UpdateAssemblyInfo = true,
UpdateAssemblyInfoFilePath = "./src/Shared/SharedAssemblyInfo.cs",
OutputType = GitVersionOutput.BuildServer
});
Does the bootstrapper script takes the selected OS environment under consideration when running third-party Cake tools?
Fadil
I need to pass an argument containing a URI.
The line got truncated due to parseNameAndValue of src/action.ts (line 63) splitting the line on ':' (without limit) and then only using the first two entries in the result.
e.g.:
arguments: |
address: https://somewhere/something
It will be best practice to insert configration argument as input.
Example:
steps:
- name: Run the Cake script
uses: ecampidoglio/cake-action@master
with:
configuration: Release
Many now pin their Cake version using a .NET tool manifest, would be great if one could opt-in so the task could utilize the manifest too.
cbd362d#diff-6a7166c4d6d46136f0efc2a724763a85R37
+ if (version && !targetDirectory.containsToolWithVersion(packageId, version)) {
+ throw new Error(`Failed to uninstall previous version of ${packageId}. Exit code: ${uninstallExitCode}`);
+ await DotNet.uninstallLocalTool(packageId, targetDirectory);
Before it checked if cake was installed and then checked if version was specified and uninstalled.
Cake offers the option to do a dry run of the build script by passing the --dry-run
argument to the Cake executable.
It should be possible to do the same from a GitHub Actions workflow by setting the dry-run
input parameter to true
:
steps:
- name: Run the Cake script
uses: cake-build/cake-action@v1
with:
dry-run: true
Of course, the default value should be false
.
I see that #41 was just resolved with a v2 release. I have some bad news;
Node v16 is also deprecated and have been for the last 6 months :'(
Node.js 16 actions are deprecated.
Is there any chance to update to v20?
Running the action currently produces a warning:
Node.js 12 actions are deprecated. For more information
see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/.
Please update the following actions to use Node.js 16: cake-build/cake-action
This:
ecampidoglio/cake-action
should be replaced with:
cake-build/cake-action
As there might be breaking changes between Cake versions, so pinning a specific version is best practice, so an optional parameter to set Cake version would be desirable.
Hi,
I'm running into issues that the following script hangs sometimes when trying to run the cake script step. The action never finishes
name: push-master
run-name: ${{ github.actor }} is pushing to master
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
push-master:
runs-on: ubuntu-latest
steps:
- name: Get the source
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install .NET SDK 7.0.x
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- name: run cake script
uses: cake-build/cake-action@master
Any ideas what might be reason
As of cake-build/cake#2849, modules are automatically bootstrapped before running the script. While it's still possible to do it explicitly with the --bootstrap
option, it's no longer necessary. Instead, a new option has been introduced to opt out of the bootstrapping process called --skip-bootstrap
.
The Cake action should reflect these changes both in the code and in the documentation.
GitHub has changed the way to set environment variables in a workflow, due to a security vulnerability found in the old set-env
workflow command.
Right now, using the Cake Action in a workflow results in the following warning:
⚠ The
set-env
command is deprecated and will be disabled soon. Please upgrade to using Environment Files.
We should update the action to use the new Environment File syntax.
When troubleshooting a Cake script, it's often necessary to increase the verbosity level to something like Diagnostic
to see what's going on behind the scenes.
This technique is particular useful when the script works locally but fails in a CI environment, since it's impractical to debug a build server.
For these reasons, the Cake Action should allow to specify the verbosity level to pass to the Cake script as an input parameter.
Many GitHub script actions support inline scripts i.e. Azure CLI task
with:
inlineScript: |
az account show
az storage -h
When doing a Frosting bootstrapper workaround until #43 is solved I did something like
- name: Create Script Bootstrapper
run: |
echo 'DotNetRun("build/Build.csproj", "--target=GitHub-Actions");' > build.cake
- name: Run Cake script
uses: cake-build/cake-action@v2
with:
cake-version: 4.0.0
and it struck me that it would be really useful for some scenarios to instead of a small utility shell script able to have a Cake script inline, above could then be
- name: Run Inline Cake script
uses: cake-build/cake-action@v2
with:
cake-version: 4.0.0
inlineScript: |
DotNetRun("build/Build.csproj", "--target=GitHub-Actions");
In my mind, it could just work like a pre- & post-processor to the regular script handling, something like
I would like to have support to set workingDirectory where the script runs and searches for the toolsDirectory.
Cause I have some trouble when running cake scripts that are not in root of the git repository.
I also use some tools manifest, but this cant be read by the action as its working directory seems to be root of git repository.
Error looks like this:
Run cake-build/cake-action@v1
dotnet tool restore
Es wurde keine Manifestdatei gefunden.
My repository looks like this:
scripts
When i run script without version "tool-manifest" it works, but i would like to stick the cake-version in manifest.
Also it creates 2 tools directories. one in root (with dotnet-cake.exe)
and one in scripts directory (with scripts dependencies) where my cake scripts are located.
Hi,
I have a very simple github workflow that looks like:
name: push-master
run-name: ${{ github.actor }} is pushing to master
on:
push:
pull_request:
branches:
- master
jobs:
test-push-master:
runs-on: ubuntu-latest
steps:
- name: run cake script
uses: cake-build/cake-action@master
with:
verbosity: Diagnostic
When I try to run this I get the following error message:
build.cake, line #0: Could not find script '/home/runner/work/algo-charging/algo-charging/build.cake'.
I do have a build script in the root:
https://github.com/AlgoCharging/algo-charging/blob/master/build.cake
Any ideas what might be the problem?
ITNOA
Hi
I do not understand my error
Run cake-build/cake-action@v1
dotnet tool install --tool-path tools Cake.Tool
You can invoke the tool using the following command: dotnet-cake
Tool 'cake.tool' (version '3.1.0') was successfully installed.
tools/dotnet-cake Build/linux-build.cake --target=JustBuild --verbosity=Diagnostic --version=0.1.0
Error: Flags cannot be assigned a value.
Build/linux-build.cake --target=JustBuild --verbosity=Diagnostic
--version=0.1.0
^^^^^^^^^ Can't assign value
Can you help me?
My project is BSVN/IpTables.Api#2
We're currently having issues with this action w.r.t. termination after executing a task.
The logs suggest that cake finished execution (see log below) but the step only terminates after seemingly idling for a long time (last run was 45 minutes between the cake log that it finished and the termination of the action)
[execution log omitted]
Finished executing task: Run Unity Integration Tests
Completed in 00:05:15.8458010
Task Duration
--------------------------------------------------------------
Uninstall Previous Service and Testrunner 00:00:06.2233645
Build and Install Current Service 00:02:36.4687967
Run Unity Integration Tests 00:05:15.8458115
--------------------------------------------------------------
Total: 00:07:58.5379727
We've also had a look at the process monitor to see if there are child-processes that the action might be waiting for but couldn't see any other than the process that is running this action.
This screenshot was taken between the cake task writing the log above and it finishing the execution of the step.
We also tried to run it manually on the build server via the cake command line tool and there it also works flawlessly so we assume it has something to do with this plugin / node...
If you have any more pointers to what we can try please let me know.
We also couldn't reproduce the delay locally on two different machines.
Would be nice to be able to use the action with Frosting too, something like
steps:
- name: Run the Cake script
uses: cake-build/cake-action@vX
with:
arguments: |
name: value
target: Build
verbosity: Diagnostic
csproj: ./build/build.csproj
resulted in something like below being executed
dotnet run --project ./build/build.csproj -- --target="Build" --verbosity="Diagnostic" --name="value"
To extend cake internals modules can be used, to fetch these from nuget boostrapping needs to be executed, this is currently done by executing Cake a extra time before executing script.
I've got this working in a feature branch and would be happy to PR this, it's currently builds upon #2 so either that needs to be merged or I'll need to refactor before sending it in.
Running the action without specifying the --cake-version
input parameter implies installing the latest version of the Cake.Tool
package. This is achieved by running dotnet tool install
without the --version
parameter.
While this approach works fine in most cases, there's one scenario where it falls short: when the action runs on an agent where a different version of the Cake.Tool
package is already installed.
Here's an example workflow:
--cake-version
set to x.y.z
x.y.z
of the Cake.Tool
is installed in the tools directory--cake-version
input parameter implying that the latest version of Cake should be usedCake.Tool
is already present in the tools directory; however, without a specific version number to compare with, it determines that it shouldn't install any new version of the Cake.Tool
and runs with itWhen running the action without the --cake-version
input parameter, the action should go out and fetch the latest version of the Cake.Tool
from the Cake releases on GitHub and use that as the version number.
This way, there will always be a version number to compare with when determining whether any existing installation of the Cake.Tool
can be used.
In the case when fetching the latest version from GitHub fails for some reason (e.g. due to a network error), the action should simply fall back to the previous behavior of installing the Cake.Tool
without a version number.
Right now, if you use the Cake Action in multiple steps within the same build definition, like in this example:
steps:
- name: Compile
uses: ecampidoglio/[email protected]
with:
target: Compile
- name: Run the tests
uses: ecampidoglio/[email protected]
with:
target: Test
The second step will fail with the following error message:
dotnet tool install --tool-path tools Cake.Tool
Tool 'cake.tool' is already installed.
##[error]The process 'dotnet' failed with exit code 1
That's because the Cake Action tries to install the Cake.Tool before every run, which obviously doesn't work if the tool has already been installed by a previous instance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.