0

I want to reduce the testing time in github actions when I push changes to the github repository.

I need to run the sandbox in nearcore but for that I need to run the make command which takes more than 10 minutes. To reduce time, I tried to cache Cargo related things but it failed. Then I tried to cache the entire repo but it did not help either.

The following is my current code. I am absolutely new to this so please be patient.

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

0 Answers0