-
Notifications
You must be signed in to change notification settings - Fork 1
153 lines (134 loc) · 5.37 KB
/
deploy.yml
File metadata and controls
153 lines (134 loc) · 5.37 KB
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#*********************************************************************/
# CI Pipeline - Full Stack Project (Core, API, & Frontend) */
# */
# Purpose : Orchestrates multi-platform builds and automates */
# Docker distribution to GitHub Packages (GHCR). */
# Trigger : Push to main */
# Runtime : Matrix Build (Linux, Win, macOS) + Docker Publish */
# */
# Notes : - v1.4 adds GHCR (GitHub Packages) integration. */
# - v1.5 Fixes Dockerfile pathing and build context. */
# */
# Revision History: */
# ------------------------------------------------------------------ */
# Version Date Author Description */
# ------------------------------------------------------------------ */
# 1.0 2026-04-14 Nitish Singh Initial Full-Project CI */
# 1.1 2026-04-15 Nitish Singh Updated for Monorepo Paths */
# 1.2 2026-04-15 Nitish Singh Extracted Frontend Job */
# 1.3 2026-04-16 Nitish Singh Optimized Toolchain Setup */
# 1.4 2026-04-22 Nitish Singh Added Docker GHCR Deployment*/
# 1.5 2026-04-22 Nitish Singh Fixed Docker Context & Path */
#*********************************************************************/
name: Build Full Project - All Platforms
on:
push:
branches: [main]
permissions:
contents: read
packages: write
jobs:
build-dll-api:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup CMake
uses: jwlawson/actions-setup-cmake@v1.14
with:
cmake-version: '3.26.4'
- name: Install compiler (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y build-essential
# --- Native Layer (C++) ---
- name: Configure DLL (Unix)
if: runner.os != 'Windows'
run: |
cmake -S backend/CaseConversionAPI/CppLib \
-B backend/CaseConversionAPI/CppLib/build_dll \
-DCMAKE_BUILD_TYPE=Release
- name: Configure DLL (Windows)
if: runner.os == 'Windows'
run: |
cmake -S backend/CaseConversionAPI/CppLib `
-B backend/CaseConversionAPI/CppLib/build_dll `
-DCMAKE_BUILD_TYPE=Release `
-DPROCESSSTRING_EXPORTS=ON `
-G "Visual Studio 17 2022" -A x64
- name: Build DLL
run: cmake --build backend/CaseConversionAPI/CppLib/build_dll --config Release --parallel
# --- Managed Layer (.NET 8) ---
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Restore & Publish .NET API
run: |
dotnet restore backend/CaseConversionAPI/DotNetAPI
dotnet publish backend/CaseConversionAPI/DotNetAPI -c Release -o ./publish
# --- ABI Bridge (Artifact Injection) ---
- name: Inject Native Artifacts
shell: bash
run: |
if [ "${{ runner.os }}" == "Linux" ]; then
cp backend/CaseConversionAPI/CppLib/build_dll/libProcessStringDLL.so ./publish/
elif [ "${{ runner.os }}" == "macOS" ]; then
cp backend/CaseConversionAPI/CppLib/build_dll/libProcessStringDLL.dylib ./publish/
elif [ "${{ runner.os }}" == "Windows" ]; then
find backend/CaseConversionAPI/CppLib/build_dll -name "ProcessStringDLL.dll" -exec cp {} ./publish/ \;
fi
- name: Upload API + DLL artifact
uses: actions/upload-artifact@v4
with:
name: DotNetAPI-${{ matrix.os }}
path: ./publish/
build-frontend:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: Build Frontend
working-directory: ./frontend
run: |
npm install
npm run build
- name: Upload Frontend artifact
uses: actions/upload-artifact@v4
with:
name: Frontend-Static-Assets
path: frontend/dist/
publish-docker:
needs: [build-dll-api]
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Download Linux Artifacts
uses: actions/download-artifact@v4
with:
name: DotNetAPI-ubuntu-latest
path: ./publish # Keeps consistency with the Dockerfile's expectations
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push to Packages
uses: docker/build-push-action@v5
with:
context:
file: ./backend/Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ github.sha }}