gpt4 book ai didi

github 操作共享工作区(yml 配置)

转载 作者:行者123 更新时间:2023-12-04 15:38:54 25 4
gpt4 key购买 nike

如果我可以运行如下所示的工作流会很酷 - 也许我只是在 GitHub 操作中缺少一个简单的配置,但我不知道如何在作业之间共享工作区,同时使用 job.needs指定当其他作业成功完成时可以运行哪些作业。

name: Node CI

on: [push]
env:
CI: true

jobs:
install:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: install node_modules
run: yarn install

lint:
runs-on: ubuntu-latest
needs: [install]
steps:
- name: eslint
run: yarn lint

build:
needs: [install]
runs-on: ubuntu-latest
steps:
- name: yarn build
run: yarn build

test:
needs: [install, build]
runs-on: ubuntu-latest
steps:
- name: jest
run: yarn test --coverage

我已阅读 Github actions share workspace/artifacts between jobs?但我宁愿不必上传 node_modules并下载每一步。

最佳答案

据我所知,操作工作区仅在同一作业的步骤之间共享。您不能在作业之间共享文件系统。

在作业之间上传/下载工件是一种解决方案。您也可以尝试新的 actions/cache 缓存 node_modules 的操作目录并在后续作业中恢复它。

- uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

请注意,目前有一些相当严格的限制,因此如果您有一个非常大的 node_modules,它可能不起作用。目录。

Individual caches are limited to 400MB and a repository can have up to 2GB of caches. Once the 2GB limit is reached, older caches will be evicted based on when the cache was last accessed. Caches that are not accessed within the last week will also be evicted.

关于github 操作共享工作区(yml 配置),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58738351/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com