-
Notifications
You must be signed in to change notification settings - Fork 5
85 lines (72 loc) · 2.08 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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.23'
# 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: Run Go Linter
- name: Run GolangCI-Lint Check
uses: golangci/golangci-lint-action@v6
# Step 5: Install Go dependencies
- name: Install Go Dependencies
run: go mod tidy
working-directory: ./server
# Step 6: Build the Go application
- name: Build Go Application
run: go build -o app ./main.go
working-directory: ./server
# 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