小编bar*_*iro的帖子

如何在一个 Github Actions Docker 中运行多个命令

在一个中运行多个命令的正确方法是什么action

例如:

我想将 python 脚本作为action. 在运行此脚本之前,我需要安装requirements.txt.

我可以想到几个选项:

  • 使用Dockerfile其中的命令创建一个RUN pip install -r requirements.txt
  • 使用python:3图像,并在运行pip install -r requirements.txtin 中entrypoint.sh的参数之前运行文件args中的main.workflow
  • 同时使用pip installpython myscript.py作为args

另一个例子:

我想运行一个存在于我的存储库中的脚本,然后比较 2 个文件(它的输出和一个已经存在的文件)。

这是一个包含两个命令的过程,而在第一个示例中,该pip install命令可以被视为构建命令而不是测试命令。

问题:

我可以为另一个命令创建另一个 Docker,其中将包含前一个 Docker 的输出吗?

我正在寻找有关命令 in Dockerfile、inentrypoint或 in位置的指南args

docker dockerfile docker-entrypoint github-actions

45
推荐指数
1
解决办法
3万
查看次数

发布创建和发布之间的 Github Action 不同

由于Github Release s 实际上是一个Git Tag s,我想package.json在有新的 Release (和标签)时使用Github Action自动升级我的版本。

我知道我需要触发 a job on: release,但是根据Github Actions 文档,我不知道我是否需要触发 when createdpublished, both or all?

Github 说:

注意:发布release不会触发该事件draft

我创建了两个管道:一个on: release, type: created和一个on: release, type: published

然后我创建了一个draft版本,然后我发布了它。

只有published管道触发,而且是在我发布版本的时候。

versioning git-tag npm package.json github-actions

18
推荐指数
2
解决办法
2416
查看次数

为什么更新 VSCode 后会出现此错误?无法读取 ... (Node.js) 的源映射

我的程序在更新Visual Studio Code之前正在运行。更新后,为什么会出现此错误?

Could not read source map for file:///c:/Users/s.aytan/Desktop/node/new/Dashboard2/node_modules/fecha/lib/fecha.umd.js: ENOENT: no such file or directory, open 'c:\Users\s.aytan\Desktop\node\new\Dashboard2\node_modules\fecha\lib\fecha.umd.js.map'
Run Code Online (Sandbox Code Playgroud)

node.js visual-studio-code

18
推荐指数
1
解决办法
1万
查看次数

如何在vue 3子组件中导入css文件?

我正在开发Vue 3,我需要知道如何为不同的子组件导入不同的样式表。

例如,我有 3 个子组件,假设AB,并且我想导入样式表XinA和 样式表Zin B

vue.js vue-cli-3

16
推荐指数
1
解决办法
3万
查看次数

如何知道我是在 .NET Framework 还是 .NET Core 下运行

假设我有一个 Nuget 库,它编译为netstandard2.0支持netcoreapp2.1net471.

现在,在编译时,我不知道我是否在net471netcoreapp2.1或下运行(我强调这一点是因为我不能将我的 dll 编译为 和netstandard2.0netstandard因为net471如果调用程序集netstandard2.0,我仍然不知道什么关于入口组件)。

我如何在运行时知道我正在运行哪个 TargetFramwork?


我知道有一个这样的解决方案:

Assembly.GetEntryAssembly()?
    .GetCustomAttribute<TargetFrameworkAttribute>()?
    .FrameworkName
Run Code Online (Sandbox Code Playgroud)

但是,如果您在 MSTest 和 中运行此net471命令Assembly.GetEntryAssembly() == null,那么我不想破坏使用我的 Nuget 的项目中的测试。

c# .net-assembly .net-core

9
推荐指数
1
解决办法
3329
查看次数

Github Action- 如何重新启动会话?

我有一个Github Action,它创建了一个dotnet 工具,并尝试使用它。

$ dotnet pack MyTool.csproj --configuration Release
$ dotnet tool install --global --add-source . MyTool

Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed.
You can invoke the tool using the following command: my-tool
Tool 'MyTool' (version '1.0.0') was successfully installed.

$ my-tool

my-tool: command not found
Run Code Online (Sandbox Code Playgroud)

我怎样才能logout or restart my session在工作中,重新加载PATH

ubuntu dotnet-tool github-actions

8
推荐指数
1
解决办法
390
查看次数

我可以在本地编辑 main.workflow github-actions 文件吗?

如果我main.workflow在本地更改我的文件,而不是在master分支中,提交并推送更改,我会从push命令中收到此错误:

> git diff
diff --git a/.github/main.workflow b/.github/main.workflow
index 135d8ea..0a13a28 100644
--- a/.github/main.workflow
+++ b/.github/main.workflow
@@ -6,7 +6,7 @@ workflow "Build and Test in PR" {
   ]
 }

-action ".NET Core CLI" {
+action ".NET Core CLI"  {
   uses = "./.github/net-core/"
   args = "test"
 }

> git push
! [remote rejected] my-branch -> my-branch (refusing to allow an integration to create or update .github/main.workflow)
error: failed to push some refs to 'https://github.com/my-user-name/my-repo.git'
Run Code Online (Sandbox Code Playgroud)

git github github-actions

7
推荐指数
2
解决办法
1320
查看次数

.net Core解析csproj文件为对象

问题 - 我们可以通过某些方式解析 csproj 文件,但大多数信息不在文件中,而是默认情况下或受其他属性影响。

我想处理 csproj 文件和解决方案 - 获取项目依赖项、获取属性和项目(例如“TargetFramework”、编译文件等)

TargetFramework 可以是具有值的标记,也可以是具有解析为“TargetFramework”的多值的“TargetFramework s ”标记。

旧的解决方案 - MSBuild 提供了一个microsoft.build.evaluation 库来处理 csproj 文件,但该库编译为 net471,并且当我们在 netcoreapp 中使用它时会导致错误。

在 .net core 项目中,问题的解决方案是什么?

c# msbuild csproj .net-core

6
推荐指数
1
解决办法
3990
查看次数

带有DisableRequestSizeLimit的ASP.NET Core测试方法

我有一个 ASP.NET Core 项目,使用以下方法:

public async Task<ActionResult<ResultDto>> StartReadFiles(
    [ModelBinder(typeof(JsonModelBinder))] RequestDto request,
    IFormFile file1,
    IFormFile file2
)
Run Code Online (Sandbox Code Playgroud)

我推送方法后,进行性能测试失败,因为他在请求中发送了非常大的文件。

所以我DisableRequestSizeLimit在方法中添加了:

[DisableRequestSizeLimit]
public async Task<ActionResult<ResultDto>> StartReadFiles(
    [ModelBinder(typeof(JsonModelBinder))] RequestDto request,
    IFormFile file1,
    IFormFile file2
)
Run Code Online (Sandbox Code Playgroud)

现在,我想为这个错误编写一个测试。

我怎样才能用很大的身体来伪造请求?

c# testing integration-testing httprequest asp.net-core

6
推荐指数
1
解决办法
8759
查看次数

防止其他应用读取 Keytar 保存的密码

keytar文档和所有其他文章中,示例表明存储密码只需要ServiceName

keytar.setPassword('KeytarTest', 'MyAccount', 'password');
Run Code Online (Sandbox Code Playgroud)

是什么阻止其他软件请求和读取这些数据?

node.js atom-editor electron keytar

6
推荐指数
1
解决办法
78
查看次数