Skip to content

Commit

Permalink
ci experiment: cache monorepo build
Browse files Browse the repository at this point in the history
  • Loading branch information
jochem-brouwer committed Aug 14, 2024
1 parent 08c1062 commit d80c4cf
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 18 deletions.
24 changes: 6 additions & 18 deletions .github/workflows/block-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,11 @@ jobs:
strategy:
matrix:
node-version: [18]
needs: build-monorepo
steps:
- uses: actions/checkout@v4
- name: 'Cache build'
- uses: 'actions/cache@v3'
with:
submodules: recursive

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- run: npm ci --omit=peer
working-directory: ${{github.workspace}}

- run: npm run lint
- run: npm run coverage
- uses: codecov/codecov-action@v3
with:
files: ${{ env.cwd }}/coverage/lcov.info
flags: block
path: '.'
key: '${{ runner.os }}-node-18-${{ git rev-parse HEAD }}'
restore-keys: '${{ runner.os }}-node-18'
39 changes: 39 additions & 0 deletions .github/workflows/build-monorepo-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Block
on:
push:
branches: [master, develop]
tags: ['*']
pull_request:
types: [opened, reopened, synchronize]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build-monorepo:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
steps:
- name: Checkout monorepo
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup node
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'

- name: 'Cache build'
- uses: 'actions/cache@v3'
with:
path: '.'
key: '${{ runner.os }}-node-18-${{ git rev-parse HEAD }}'
restore-keys: '${{ runner.os }}-node-18'

- run: npm i

0 comments on commit d80c4cf

Please sign in to comment.