Skip to content

Commit

Permalink
Testing new pipeline changes: Cache node modules
Browse files Browse the repository at this point in the history
  • Loading branch information
sayoungestguy committed Sep 19, 2024
1 parent 83b848f commit 856b405
Showing 1 changed file with 33 additions and 14 deletions.
47 changes: 33 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,20 @@ on:
branches:
- '**' # Trigger on any branch push
jobs:
build:
name: Build Stage
npm-install:
name: Install Node.js packages
runs-on: ubuntu-latest
steps:
- name: Run NPM Install
run: npm install
- name: Cache Dependencies
uses: actions/upload-artifact@v4
with:
name: node-modules
path: node_modules # Upload node_modules as an artifact

package:
name: Package App
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.pull_request.title, '[skip ci]') && !contains(github.event.pull_request.title, '[ci skip]')"
timeout-minutes: 10
Expand All @@ -23,22 +35,22 @@ jobs:
with:
distribution: 'temurin'
java-version: 17
- name: Install Node.js packages
run: npm install
- name: Cache Node.js dependencies
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Package application
run: npm run java:jar:prod

# Push to Docker
# jib-build:
# name: containerize
# runs-on: ubuntu-latest
# needs: package
# steps:
# - name: Push to Docker registry
# run: ./mvnw package -Pprod verify jib:build -Djib.to.image=<dockerhub-username>/<artifact-id>

backend-test:
name: Backend Test Stage
runs-on: ubuntu-latest
needs: build
needs: package
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
Expand All @@ -49,18 +61,23 @@ jobs:
run: |
chmod +x mvnw
npm run ci:backend:test
frontend-test:
name: Frontend Test Stage
runs-on: ubuntu-latest
needs: build
needs: package
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.15.0
- name: Download Node Modules
uses: actions/download-artifact@v4
with:
name: node-modules
path: node_modules # Extract node_modules to the right path
- name: Run frontend test
run: npm run ci:frontend:test

sonar:
name: Sonar SAST Scan
runs-on: ubuntu-latest
Expand Down Expand Up @@ -119,6 +136,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20.15.0
- name: Install Node.js packages
run: npm install
- name: Install ESLint
run: npm install eslint --save-dev

Expand Down

0 comments on commit 856b405

Please sign in to comment.