使用 本地构建我的 Haskell 项目时stack build,仅重新编译更改的源文件。不幸的是,我无法让 Stack 在 GitHub Actions 上表现得像这样。请问有什么建议吗?
例子
我用Lib.hsand创建了一个简单的例子Fib.hs,我什至检查缓存的 .stack-work 文件夹是否在构建之间更新,但它总是编译两个文件,即使只更改一个文件。
这是示例:
Lib.hs和Fib.hs+ 依赖项):https : //github.com/MarekSuchanek/stack-test/runs/542163994Lib.hs更改,同时构建Lib.hs和Fib.hs):https : //github.com/MarekSuchanek/stack-test/runs/542174351我可以从日志(详细堆栈)中观察到缓存中的某些内容正在更新,但我完全不清楚是什么以及为什么。它正确地发现只有Lib.hs被改变了:“ stack-test-0.1.0.0: unregistering (local file changes: src/Lib.hs)”所以我不明白为什么所有的都被编译了。我注意到,在2Fib.hi没有更新,.stack-work但其他人(Fib.o,Fib.dyn_hi,和Fib.dyn_o)是。
笔记
当没有更改源文件时, ~/.stack 缓存是可以的,也可以不构建。当然,这是一个虚拟示例,但我们有不同的项目,其中包含更多源文件,可以显着加快构建速度。当更改非源文件(例如 README 文件)时,不会按预期构建任何内容。
我正在尝试使用 github 操作为我的 node.js 服务器构建 CI 管道。
我只需要解决一个问题。我需要设置环境变量,以便我的 node.js 服务器可以通过访问 env 变量process.env
下面是 github 操作工作流文件。
name: Build and Deploy to GKE
on:
pull_request:
branches:
- master
# Environment variables available to all jobs and steps in this workflow
env:
ENGINE_API_KEY: ${{ secrets.ENGINE_API_KEY }}
jobs:
setup-build-publish-deploy:
name: Setup, Build, Publish, and Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Apollo Schema Update
env:
ENGINE_API_KEY: ${{ secrets.ENGINE_API_KEY }}
run: |
sudo npm install
sudo npm install -g apollo …Run Code Online (Sandbox Code Playgroud) 我有一个在线课程(Performance Ninja),我想将其变成公开分发的 Jupyter Notebook。该课程托管在 Github 上。那里有学生需要完成的实验室作业的源代码。他们需要通过更改代码并提交(git Push)他们的工作来解决问题。它将被 Github Actions 拾取并发送到我的远程服务器,该服务器已针对性能基准测试进行了适当配置。因此,我不依赖 Github 提供的虚拟化 CI 机器,例如它们不适合性能测量。
\n我想制作一个 Jupyter Notebook,它将作为我的 Github 存储库的视图。它将提供漂亮的界面,能够专注于重要的代码部分(基准测试的内核),并且有一种简单的方法来提交自动基准测试的解决方案(只需按 Shift-Enter)。
\n我正在查看 JupyterHub。它应该可以很好地工作,但问题是我必须为 JupyterHub 服务器拥有一个公共静态 IP。
\n理想情况下,我希望能够从 Jupyter Notebook 本身触发 Github Actions 工作流程。用户(学生)将通过 Github 验证自己的身份,更改代码并按 Shift-Enter,这将触发 Github 操作(可能将代码推送到私有分支)。
\n我假设我\xe2\x80\x99m 不是第一个面临类似问题的人。我想听听有经验的人的意见,我在这里最好的选择是什么?
\n我有一个设置名称并在拉取请求上运行的 Github 操作:
\nname: Code Quality\non:\n workflow_dispatch:\n pull_request:\n branches: [ main, develop ]\nRun Code Online (Sandbox Code Playgroud)\n当我手动触发运行时(因为workflow_dispatch也设置了),运行将在运行列表中获得标题 \xe2\x80\x9cCode Quality\xe2\x80\x9d 。
但是,当针对拉取请求运行该操作时,列表中的运行名称将设置为 PR 的名称。这可能是也可能不是一个好标题,很大程度上取决于 PR\xe2\x80\x99s 作者。有没有办法影响列表中操作的标题?
\n我们正在从 gitlab 迁移到 github。
使用 gitlab pipelines,我检查存储库并动态生成一个包含要运行的实际作业的子管道。通过实际定义最容易解释这一点:
stages:
- bootstrap
- run
# ---------------------------------------------------------------------------
# Bootstrap
# ---------------------------------------------------------------------------
bootstrap:
stage: bootstrap
# this will write the file jobs.yml to disk
script: ./bootstrap.ps1
artifacts:
paths:
- artifacts/jobs.yml
# ---------------------------------------------------------------------------
# Run
# ---------------------------------------------------------------------------
run:
stage: run
trigger:
include:
- artifact: artifacts/jobs.yml
job: bootstrap
strategy: depend
Run Code Online (Sandbox Code Playgroud)
github actions 有类似的吗?我发现可以动态生成矩阵,但这还不够。
我需要运行相互依赖并并行/顺序运行的作业。
例子:
整个作业图是动态生成的。
在这里,我有三个阶段,所有应用程序作业并行运行,并且单个部署作业等待所有应用程序作业完成。
我还需要将应用程序作业的输出传递到部署作业,这似乎也不能真正使用矩阵:https ://github.com/github-community/community/discussions/17245
即使输出由作业的多个矩阵变体设置,也只保留一个。
那么,实际的问题是有没有一种方法可以动态生成具有多个相互依赖的作业的工作流程并执行它,或者这是不存在的东西?
我有一个工作流程,workflow_dispatch输入默认为空字符串。该工作流程使用本地 github 操作,其自定义输入及其各自的默认值:
# .github/workflow/ci.yml
on:
push:
- main
- wip/**
workflow_dispatch:
inputs:
myInput:
description: An input string
type: string
jobs:
myJob:
steps:
- name: My action step
uses: ./.github/actions/my-action
with:
myInput: ${{ github.event.inputs.myInput }}
Run Code Online (Sandbox Code Playgroud)
# .github/actions/my-action/action.yml
name: 'My action'
description: 'An action'
inputs:
myInput:
description: An input
required: false
default: 'My default input'
runs:
steps:
- name: Run
shell: bash
run: echo Input: ${{ inputs.myInput }}
Run Code Online (Sandbox Code Playgroud)
如果工作流程是由推送触发的,或者如果我使用空输入手动启动工作流程,我希望该操作my-action保留其默认输入值My default input而不是空字符串。
您知道这是否可以从工作流程中实现,而无需调整my-action操作吗?
我尝试使用 GitHub Pages(GitHub Actions 的静态 HTML)并遇到此错误。
运行 actions/configure-pages@v2.1.1
警告:获取页面站点失败
错误:创建页面站点失败
错误:AxiosError:请求失败,状态代码 403
知道如何解决吗?我的存储库中只有一个简单的index.html,其中写着
任何线索都会有帮助,谢谢。
我想以编程方式确定特定的 Python 脚本是否在测试环境中运行,例如
等等。我意识到这需要一些启发,但这对我来说已经足够了。是否总是设置某些环境变量?用户名总是相同吗?ETC。
我正在尝试在我的存储库上创建一个复合操作,如下所示:
\n.github\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 actions\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 setup-composite.yml\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 workflows\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 composite_test.yml\nRun Code Online (Sandbox Code Playgroud)\n文件的内容是最低限度的
\n# setup-composite.yml\n\nname: setup-env\n\nruns:\n using: \'composite\'\n steps:\n - uses: actions/setup-python@v4\n with:\n python-version: \'3.9\'\n\n - name: run dependencies\n shell: bash\n run: |\n pip install -r requirements.txt\n\nRun Code Online (Sandbox Code Playgroud)\n然后我尝试使用引用复合工作流程
\n# composite_test.yml\n\nname: Composite Test\non:\n pull_request:\n push:\n branches: [main]\n workflow_dispatch:\n\njobs:\n setup:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v3\n\n - name: composite\n uses: ./.github/actions/setup-composite\nRun Code Online (Sandbox Code Playgroud)\nrequirements.txt 的内容只是几个用于测试目的的包。
\n但是当这个工作流程运行时我得到Error: Can\'t find \'action.yml\', \'action.yaml\' or \'Dockerfile\' under \'/home/runner/work/_actions/{profile}/{repo}/main/.github/actions/setup-composite\'. Did you forget to run actions/checkout …
目前,我正在尝试为自动发布 java 库的 GitHub Action 做出贡献。我正在开发的分支:https://github.com/MathieuSoysal/Java-maven-library-publisher/tree/2-add-automated-tests
Action 的 yaml 代码:
name: Java maven library publisher
author: "Mathieu Soysal (@MathieuSoysal)"
description: "Build automatically Java Maven library and publish it to GitHub Packages and Maven Central."
branding:
icon: "package"
color: "gray-dark"
inputs:
nexus-username:
description: "Nexus username"
required: true
nexus-password:
description: "Nexus password"
required: true
gpg-private-key:
description: "GPG private key"
required: true
gpg-passphrase:
description: "GPG passphrase"
required: true
github-token:
description: "GitHub token"
required: true
# Java version to use
java-version: …Run Code Online (Sandbox Code Playgroud) github-actions ×10
cabal ×1
caching ×1
cicd ×1
circleci ×1
github ×1
github-pages ×1
gitlab-ci ×1
haskell ×1
java ×1
jupyterhub ×1
maven ×1
node.js ×1
python ×1
travis-ci ×1