当我将更改推送到 github 存储库时,我想减少 github 操作中的测试时间。
我需要在 nearcore 中运行沙箱,但为此我需要运行 make 命令,这需要 10 多分钟。为了减少时间,我尝试缓存 Cargo 相关的东西,但它失败了。然后我尝试缓存整个回购,但它也没有帮助。
以下是我当前的代码。我对此完全陌生,所以请耐心等待。
name: Sandbox
on:
push
jobs:
test-sandbox:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
repository: near/nearcore
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
./
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: 'Make Sandbox'
working-directory: ./
if: steps.cache.outputs.cache-hit != 'true'
run: make sandbox
- name: 'Building near'
working-directory: ./
run: |
rm -rf /tmp/near-sandbox
target/debug/near-sandbox --home /tmp/near-sandbox init
target/debug/near-sandbox --home /tmp/near-sandbox run &
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '15'
- name: 'Building contracts'
working-directory: ./
run: |
ls
- name: 'Testing contracts'
working-directory: ./
run: |
ls