Skip to content

Commit

Permalink
Add ci.yml file for workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
vigneshs committed Oct 22, 2024
1 parent 69a43e0 commit 75844d0
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: CI Workflow

on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev

jobs:
# Job for building the backend (Go)
backend:
name: Build Backend (Go)
runs-on: ubuntu-latest

steps:
# Step 1: Checkout the code
- name: Checkout Code
uses: actions/checkout@v3

# Step 2: Set up Go environment
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'

# Step 3: Cache Go modules for faster builds
- name: Cache Go Modules
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# Step 4: Install Go dependencies
- name: Install Go Dependencies
run: go mod tidy

# Step 5: Build the Go application
- name: Build Go Application
run: go build -o app ./main.go

# Job for building the frontend (React)
frontend:
name: Build Frontend (React)
runs-on: ubuntu-latest

steps:
# Step 1: Checkout the code
- name: Checkout Code
uses: actions/checkout@v3

# Step 2: Set up Node.js environment
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'

# Step 3: Cache Node.js dependencies
- name: Cache Node.js Modules
uses: actions/cache@v3
with:
path: client/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
# Step 4: Install frontend dependencies
- name: Install Dependencies
working-directory: ./client
run: npm install

# Step 5: Build for production
- name: Build Frontend
working-directory: ./client
run: npm run build

0 comments on commit 75844d0

Please sign in to comment.