Skip to content

Commit

Permalink
updated ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Nagarjun Sanji committed Jun 29, 2024
1 parent 2f8d050 commit dddc076
Showing 1 changed file with 34 additions and 13 deletions.
47 changes: 34 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,45 @@ on:
branches: [main]

jobs:
build:
setup:
runs-on: ubuntu-latest
outputs:
node-modules-cache-key: ${{ steps.cache.outputs.cache-hit }}
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Cache node_modules and dist
id: cache
uses: actions/cache@v4
with:
path: |
node_modules
dist
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci

build:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Restore cache
uses: actions/cache@v4
with:
path: |
node_modules
dist
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
- name: Compile
run: npm run compile
- name: Upload dist to artifact
Expand All @@ -26,16 +54,9 @@ jobs:
name: dist
path: dist/
retention-days: 1
- name: Cache node_modules and dist
uses: actions/cache@v4
with:
path: |
node_modules
dist
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}

test:
needs: build
needs: [setup, build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -60,14 +81,14 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: coverage
path: out/
path: coverage/
retention-days: 1

cleanup:
needs: [build, test]
if: always()
needs: [setup, build, test]
runs-on: ubuntu-latest
if: always()
steps:
- name: Cleanup
run: |
npm cache clean --force
npm cache clean --force

0 comments on commit dddc076

Please sign in to comment.