Skip to content

Commit

Permalink
chore: improve workflow by caching node_modules
Browse files Browse the repository at this point in the history
  • Loading branch information
procaconsul committed May 16, 2024
1 parent 8a0011b commit 1b23f0c
Showing 1 changed file with 60 additions and 3 deletions.
63 changes: 60 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Frontend CI

on:
push:
branches:
Expand All @@ -7,19 +8,75 @@ on:
pull_request:
branches:
- master

jobs:
build:
install-dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
node-version-file: '.nvmrc'
cache: 'npm'
- name: Cache node_modules
uses: actions/cache@v4
id: cache-primes
with:
path: node_modules
key: ${{ runner.os }}-npm-v3-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
run: npm ci

type-check:
runs-on: ubuntu-latest
needs: install-dependencies
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Load cached node_modules
uses: actions/cache@v4
id: cache-primes
with:
path: node_modules
key: ${{ runner.os }}-npm-v3-${{ hashFiles('package-lock.json') }}
- name: Check TypeScript
run: npm run type-check

style-check:
runs-on: ubuntu-latest
needs: install-dependencies
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Load cached node_modules
uses: actions/cache@v4
id: cache-primes
with:
path: node_modules
key: ${{ runner.os }}-npm-v3-${{ hashFiles('package-lock.json') }}
- name: Run Prettier
run: npm run style-check

test:
runs-on: ubuntu-latest
needs: install-dependencies
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Load cached node_modules
uses: actions/cache@v4
id: cache-primes
with:
path: node_modules
key: ${{ runner.os }}-npm-v3-${{ hashFiles('package-lock.json') }}
- name: Run tests
run: npm run test:ci
run: npm run test:ci

0 comments on commit 1b23f0c

Please sign in to comment.