Skip to content

Commit 865d29c

Browse files
Added new file location as per the log
1 parent eccda4f commit 865d29c

3 files changed

Lines changed: 65 additions & 95 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 30 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,35 @@
1717
# 1.0 2026-04-14 Nitish Singh Initial Full-Project CI */
1818
# 1.1 2026-04-15 Nitish Singh Updated for Monorepo Paths */
1919
# 1.2 2026-04-15 Nitish Singh Extracted Frontend Job */
20+
# 1.3 2026-04-16 Nitish Singh Removed redundant tool */
21+
# installs; optimized Windows */
22+
# build */
2023
#*********************************************************************/
2124

2225
name: Build Full Project - All Platforms
2326

2427
on:
2528
push:
26-
branches:
27-
- main
29+
branches: [main]
2830

2931
jobs:
30-
# ======================================================
31-
# JOB 1: BACKEND (NATIVE C++ & .NET 8 INTEROP)
32-
# ======================================================
3332
build-dll-api:
3433
strategy:
3534
fail-fast: false
3635
matrix:
36+
# Use windows-2022 if 2025 is causing edge-case issues, but 2025 is fine if we skip Choco
3737
os: [ubuntu-latest, macos-latest, windows-latest]
3838
runs-on: ${{ matrix.os }}
39-
timeout-minutes: 60
39+
timeout-minutes: 30 # Reduced timeout; optimized builds shouldn't take an hour
4040

4141
steps:
4242
- name: Checkout repo
4343
uses: actions/checkout@v4
4444

45-
# --- Toolchain Setup ---
46-
- name: Setup CMake (Linux/macOS)
47-
if: runner.os != 'Windows'
45+
# --- Optimized Toolchain Setup ---
46+
# CMake is pre-installed on all GitHub runners.
47+
# We only need jwlawson's action if we need a specific, non-default version.
48+
- name: Setup CMake
4849
uses: jwlawson/actions-setup-cmake@v1.14
4950
with:
5051
cmake-version: '3.26.4'
@@ -53,28 +54,21 @@ jobs:
5354
if: runner.os == 'Linux'
5455
run: sudo apt-get update && sudo apt-get install -y build-essential
5556

56-
- name: Install CMake (macOS)
57-
if: runner.os == 'macOS'
58-
run: brew install cmake
59-
60-
- name: Install CMake (Windows)
61-
if: runner.os == 'Windows'
62-
run: choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' --yes
63-
6457
# --- Native Layer (C++) ---
65-
- name: Clean build folder
66-
shell: bash
67-
run: rm -rf backend/CaseConversionAPI/CppLib/build_dll || true
68-
6958
- name: Configure DLL (Unix)
7059
if: runner.os != 'Windows'
71-
shell: bash
72-
run: cmake -S backend/CaseConversionAPI/CppLib -B backend/CaseConversionAPI/CppLib/build_dll -DCMAKE_BUILD_TYPE=Release
60+
run: |
61+
cmake -S backend/CaseConversionAPI/CppLib \
62+
-B backend/CaseConversionAPI/CppLib/build_dll \
63+
-DCMAKE_BUILD_TYPE=Release
7364
7465
- name: Configure DLL (Windows)
7566
if: runner.os == 'Windows'
76-
shell: powershell
77-
run: cmake -S backend/CaseConversionAPI/CppLib -B backend/CaseConversionAPI/CppLib/build_dll -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 17 2022" -A x64
67+
# Note: We removed the Choco install. Windows runners already have CMake & VS 2022.
68+
run: |
69+
cmake -S backend/CaseConversionAPI/CppLib `
70+
-B backend/CaseConversionAPI/CppLib/build_dll `
71+
-DCMAKE_BUILD_TYPE=Release -G "Visual Studio 17 2022" -A x64
7872
7973
- name: Build DLL
8074
run: cmake --build backend/CaseConversionAPI/CppLib/build_dll --config Release --parallel
@@ -91,46 +85,38 @@ jobs:
9185
dotnet publish backend/CaseConversionAPI/DotNetAPI -c Release -o ./publish
9286
9387
# --- ABI Bridge (Artifact Injection) ---
94-
- name: Copy Linux .so
95-
if: runner.os == 'Linux'
96-
run: cp backend/CaseConversionAPI/CppLib/build_dll/libProcessStringDLL.so ./publish/
97-
- name: Copy macOS .dylib
98-
if: runner.os == 'macOS'
99-
run: cp backend/CaseConversionAPI/CppLib/build_dll/libProcessStringDLL.dylib ./publish/
100-
101-
- name: Copy Windows .dll
102-
if: runner.os == 'Windows'
103-
shell: powershell
88+
- name: Inject Native Artifacts
89+
shell: bash
10490
run: |
105-
$dll = Get-ChildItem -Recurse -Filter ProcessStringDLL.dll backend\CaseConversionAPI\CppLib\build_dll | Select-Object -First 1
106-
Copy-Item $dll.FullName -Destination ".\publish\"
91+
if [ "${{ runner.os }}" == "Linux" ]; then
92+
cp backend/CaseConversionAPI/CppLib/build_dll/libProcessStringDLL.so ./publish/
93+
elif [ "${{ runner.os }}" == "macOS" ]; then
94+
cp backend/CaseConversionAPI/CppLib/build_dll/libProcessStringDLL.dylib ./publish/
95+
elif [ "${{ runner.os }}" == "Windows" ]; then
96+
# Use find to locate the DLL regardless of the VS folder nesting (Debug/Release)
97+
find backend/CaseConversionAPI/CppLib/build_dll -name "ProcessStringDLL.dll" -exec cp {} ./publish/ \;
98+
fi
10799
108100
- name: Upload API + DLL artifact
109101
uses: actions/upload-artifact@v4
110102
with:
111103
name: DotNetAPI-${{ matrix.os }}
112104
path: ./publish/
113105

114-
# ======================================================
115-
# JOB 2: FRONTEND (REACT/VITE) - RUNS ONCE
116-
# ======================================================
117106
build-frontend:
118107
runs-on: ubuntu-latest
119108
steps:
120109
- name: Checkout repo
121110
uses: actions/checkout@v4
122-
123111
- name: Setup Node.js
124112
uses: actions/setup-node@v3
125113
with:
126114
node-version: 20
127-
128115
- name: Build Frontend
116+
working-directory: ./frontend
129117
run: |
130-
cd frontend
131118
npm install
132119
npm run build
133-
134120
- name: Upload Frontend artifact
135121
uses: actions/upload-artifact@v4
136122
with:

.github/workflows/docker-build.yml

Lines changed: 23 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
#*********************************************************************/
2-
# CI Pipeline - Docker Orchestration & Image Distribution */
2+
# CI Pipeline - Docker Orchestration & Image Distribution */
33
# */
44
# Purpose : Packages the CaseConversionAPI ecosystem into */
55
# separate Backend and Frontend images for DockerHub. */
66
# Trigger : Push to main / Pull Request to main */
77
# Runtime : Ubuntu Latest */
88
# */
9-
# Notes : - Context set to root (.) to allow cross-repo access. */
10-
# - Builds Backend from /backend/Dockerfile. */
11-
# - Builds Frontend from /frontend/Dockerfile. */
9+
# Notes : - Builds Backend from /backend/Dockerfile. */
10+
# - Builds Frontend from /frontend/Dockerfile. */
1211
# - Requires DOCKER_USERNAME and DOCKER_PASSWORD secrets. */
1312
# */
1413
# Revision History: */
1514
# ------------------------------------------------------------------ */
16-
# Version Date Author Description */
15+
# Version Date Author Description */
1716
# ------------------------------------------------------------------ */
18-
# 1.0 2026-04-14 Nitish Singh Initial Docker Hub Workflow */
19-
# 1.1 2026-04-15 Nitish Singh Updated for Monorepo Paths */
20-
# 1.2 2026-04-16 Nitish Singh Optimized Context & Metadata */
17+
# 1.0 2026-04-14 Nitish Singh Initial Docker Hub Workflow */
18+
# 1.1 2026-04-15 Nitish Singh Updated for Monorepo Paths */
2119
#*********************************************************************/
2220

2321
name: Build and Push Docker Images
@@ -31,16 +29,19 @@ on:
3129
jobs:
3230
docker:
3331
runs-on: ubuntu-latest
32+
3433
steps:
3534
# ======================================================
3635
# 1. WORKSPACE PREPARATION
3736
# ======================================================
37+
3838
- name: Checkout repo
3939
uses: actions/checkout@v4
4040

4141
# ======================================================
4242
# 2. VIRTUALIZED BUILDER SETUP
4343
# ======================================================
44+
4445
- name: Set up Docker Buildx
4546
uses: docker/setup-buildx-action@v3
4647
with:
@@ -49,60 +50,41 @@ jobs:
4950
# ======================================================
5051
# 3. REGISTRY AUTHENTICATION
5152
# ======================================================
53+
5254
- name: Login to DockerHub
53-
if: github.event_name != 'pull_request'
5455
uses: docker/login-action@v3
5556
with:
5657
username: ${{ secrets.DOCKER_USERNAME }}
5758
password: ${{ secrets.DOCKER_PASSWORD }}
5859

5960
# ======================================================
60-
# 4. METADATA EXTRACTION (Automated Tagging)
61+
# 4. BACKEND: COMPILATION & DISTRIBUTION
6162
# ======================================================
62-
- name: Extract Backend Metadata
63-
id: meta_backend
64-
uses: docker/metadata-action@v5
65-
with:
66-
images: nitishhsinghhh/case-api
67-
tags: |
68-
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
69-
type=raw,value=staging,enable=${{ github.ref == 'refs/heads/main' }}
70-
type=ref,event=pr
7163

72-
- name: Extract Frontend Metadata
73-
id: meta_frontend
74-
uses: docker/metadata-action@v5
75-
with:
76-
images: nitishhsinghhh/case-ui
77-
tags: |
78-
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
79-
type=raw,value=staging,enable=${{ github.ref == 'refs/heads/main' }}
80-
type=ref,event=pr
81-
82-
# ======================================================
83-
# 5. BACKEND: COMPILATION & DISTRIBUTION
84-
# ======================================================
8564
- name: Build and Push Backend
8665
uses: docker/build-push-action@v5
8766
with:
88-
context: .
67+
context: ./backend
8968
file: ./backend/Dockerfile
90-
push: ${{ github.event_name != 'pull_request' }}
91-
tags: ${{ steps.meta_backend.outputs.tags }}
92-
labels: ${{ steps.meta_backend.outputs.labels }}
69+
push: true
70+
tags: |
71+
nitishhsinghhh/case-api:latest
72+
nitishhsinghhh/case-api:staging
9373
cache-from: type=gha
9474
cache-to: type=gha,mode=max
9575

9676
# ======================================================
97-
# 6. FRONTEND: COMPILATION & DISTRIBUTION
77+
# 5. FRONTEND: COMPILATION & DISTRIBUTION
9878
# ======================================================
79+
9980
- name: Build and Push Frontend
10081
uses: docker/build-push-action@v5
10182
with:
102-
context: .
83+
context: ./frontend
10384
file: ./frontend/Dockerfile
104-
push: ${{ github.event_name != 'pull_request' }}
105-
tags: ${{ steps.meta_frontend.outputs.tags }}
106-
labels: ${{ steps.meta_frontend.outputs.labels }}
85+
push: true
86+
tags: |
87+
nitishhsinghhh/case-ui:latest
88+
nitishhsinghhh/case-ui:staging
10789
cache-from: type=gha
10890
cache-to: type=gha,mode=max

backend/Dockerfile

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,21 @@ RUN apt-get update && apt-get install -y \
1515
cmake
1616

1717
WORKDIR /src
18+
# Copy everything from the root context (which includes the 'backend' folder)
1819
COPY . .
1920

20-
# Clean old CMake cache
21-
RUN rm -rf CaseConversionAPI/CppLib/build
21+
# 1. Clean old CMake cache (Updated path)
22+
RUN rm -rf backend/CaseConversionAPI/CppLib/build
2223

23-
# Build C++ shared library
24-
RUN cmake -S CaseConversionAPI/CppLib -B CaseConversionAPI/CppLib/build -DCMAKE_BUILD_TYPE=Release
25-
RUN cmake --build CaseConversionAPI/CppLib/build --parallel
24+
# 2. Build C++ shared library (Added 'backend/' prefix)
25+
RUN cmake -S backend/CaseConversionAPI/CppLib -B backend/CaseConversionAPI/CppLib/build -DCMAKE_BUILD_TYPE=Release
26+
RUN cmake --build backend/CaseConversionAPI/CppLib/build --parallel
2627

27-
# Publish .NET API
28-
RUN dotnet publish CaseConversionAPI/DotNetAPI -c Release -o /app/publish
28+
# 3. Publish .NET API (Added 'backend/' prefix)
29+
RUN dotnet publish backend/CaseConversionAPI/DotNetAPI -c Release -o /app/publish
2930

30-
# Copy shared library
31-
RUN cp CaseConversionAPI/CppLib/build/lib/libProcessStringDLL.so /app/publish/
31+
# 4. Copy shared library (Note: check if your CMake output goes to 'lib' or root of build)
32+
RUN cp backend/CaseConversionAPI/CppLib/build/libProcessStringDLL.so /app/publish/
3233

3334
# ---------- Runtime ----------
3435
FROM mcr.microsoft.com/dotnet/aspnet:8.0
@@ -38,4 +39,5 @@ COPY --from=build /app/publish .
3839

3940
EXPOSE 8080
4041

41-
ENTRYPOINT ["dotnet", "DotNetAPI.dll"]
42+
# Ensure this matches the actual .csproj name in your backend folder
43+
ENTRYPOINT ["dotnet", "CaseConversionAPI.dll"]

0 commit comments

Comments
 (0)