Speedup CI with cache #73
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: [master] | |
tags: ['*'] | |
pull_request: | |
types: [opened, reopened, synchronize] | |
workflow_dispatch: | |
env: | |
cwd: ${{github.workspace}} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-build | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: actions/cache/restore@v4 | |
id: dep-cache | |
with: | |
path: ${{github.workspace}}/node_modules | |
key: npm-${{ hashFiles('package-lock.json') }} | |
- uses: actions/cache/restore@v4 | |
id: build-cache | |
with: | |
path: ${{github.workspace}}/packages | |
key: build-${{ hashFiles('./packages/**/src/**')}} | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- if: steps.dep-cache.outputs.cache-hit != 'true' | |
run: npm ci | |
working-directory: ${{github.workspace}} | |
- if: steps.dep-cache.outputs.cache-hit != 'true' | |
uses: actions/cache@v4 | |
with: | |
path: ${{github.workspace}}/node_modules | |
key: npm-${{ hashFiles('package-lock.json') }} | |
- if: steps.build-cache.outputs.cache-hit != 'true' | |
uses: actions/cache@v4 | |
with: | |
path: ${{github.workspace}}/packages | |
key: build-${{ hashFiles('./packages/**/src/**')}} | |
outputs: | |
dep-cache-key: ${{ steps.dep-cache.outputs.cache-primary-key }} | |
build-cache-key: ${{ steps.build-cache.outputs.cache-primary-key }} | |
block: | |
needs: build | |
uses: ./.github/workflows/block-build.yml | |
with: | |
dep-cache-key: ${{ needs.build.outputs.dep-cache-key }} | |
build-cache-key: ${{ needs.build.outputs.build-cache-key }} | |
# blockchain: | |
# needs: build | |
# uses: ./.github/workflows/blockchain-build.yml | |
# with: | |
# cache-key: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-build | |
# browser: | |
# needs: build | |
# uses: ./.github/workflows/browser.yml | |
# with: | |
# cache-key: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-build | |
# client: | |
# needs: build | |
# uses: ./.github/workflows/client-build.yml | |
# with: | |
# cache-key: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-build | |
# common: | |
# needs: build | |
# uses: ./.github/workflows/common-build.yml | |
# with: | |
# cache-key: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-build | |
# devp2p: | |
# needs: build | |
# uses: ./.github/workflows/devp2p-build.yml | |
# with: | |
# cache-key: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-build | |
# ethash: | |
# needs: build | |
# uses: ./.github/workflows/ethash-build.yml | |
# with: | |
# cache-key: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-build | |
# evm: | |
# needs: build | |
# uses: ./.github/workflows/evm-build.yml | |
# with: | |
# cache-key: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-build | |
# examples: | |
# needs: build | |
# uses: ./.github/workflows/examples.yml | |
# with: | |
# cache-key: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-build | |
# genesis: | |
# needs: build | |
# uses: ./.github/workflows/genesis-build.yml | |
# with: | |
# cache-key: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-build | |
# rlp: | |
# needs: build | |
# uses: ./.github/workflows/rlp-build.yml | |
# with: | |
# cache-key: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-build | |
# statemanager: | |
# needs: build | |
# uses: ./.github/workflows/statemanager-build.yml | |
# with: | |
# cache-key: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-build | |
# trie: | |
# needs: build | |
# uses: ./.github/workflows/trie-build.yml | |
# with: | |
# cache-key: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-build | |
# tx: | |
# needs: build | |
# uses: ./.github/workflows/tx-build.yml | |
# with: | |
# cache-key: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-build | |
util: | |
needs: build | |
uses: ./.github/workflows/util-build.yml | |
with: | |
dep-cache-key: ${{ needs.build.outputs.dep-cache-key }} | |
build-cache-key: ${{ needs.build.outputs.build-cache-key }} | |
# verkle: | |
# needs: build | |
# uses: ./.github/workflows/verkle-build.yml | |
# with: | |
# cache-key: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-build | |
# vm-build: | |
# needs: build | |
# uses: ./.github/workflows/vm-build.yml | |
# with: | |
# cache-key: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-build | |
# vm-pr: | |
# needs: build | |
# uses: ./.github/workflows/vm-pr.yml | |
# with: | |
# cache-key: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-build | |
# wallet: | |
# needs: build | |
# uses: ./.github/workflows/wallet-build.yml | |
# with: | |
# cache-key: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-build |