Skip to content

Added Xunit tes

Added Xunit tes #54

Workflow file for this run

name: Build Full Project - All Platforms
on:
push:
branches:
- main
jobs:
build-dll-api:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
# -------------------------------
# 1. Checkout repository
# -------------------------------
- name: Checkout repo
uses: actions/checkout@v4
# -------------------------------
# 2. Setup compilers / CMake
# -------------------------------
- name: Setup CMake (Linux/macOS)
if: runner.os != 'Windows'
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
- name: Install CMake (macOS)
if: runner.os == 'macOS'
run: brew install cmake
- name: Install CMake (Windows)
if: runner.os == 'Windows'
run: choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' --yes
# -------------------------------
# 3. Build C++ DLL
# -------------------------------
- name: Clean build folder (Unix)
if: runner.os != 'Windows'
shell: bash
run: rm -rf CaseConversionAPI/CppLib/build_dll
- name: Clean build folder (Windows)
if: runner.os == 'Windows'
shell: powershell
run: Remove-Item -Recurse -Force "CaseConversionAPI\CppLib\build_dll" -ErrorAction SilentlyContinue
- name: Configure DLL (Unix)
if: runner.os != 'Windows'
shell: bash
run: cmake -S CaseConversionAPI/CppLib -B CaseConversionAPI/CppLib/build_dll -DCMAKE_BUILD_TYPE=Release
- name: Configure DLL (Windows)
if: runner.os == 'Windows'
shell: powershell
run: cmake -S CaseConversionAPI/CppLib -B CaseConversionAPI/CppLib/build_dll -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 17 2022" -A x64
- name: Build DLL (Unix)
if: runner.os != 'Windows'
shell: bash
run: cmake --build CaseConversionAPI/CppLib/build_dll --parallel
- name: Build DLL (Windows)
if: runner.os == 'Windows'
shell: powershell
run: cmake --build CaseConversionAPI/CppLib/build_dll --config Release --parallel
# -------------------------------
# 4. Setup .NET
# -------------------------------
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Restore .NET dependencies
run: dotnet restore CaseConversionAPI/DotNetAPI
# -------------------------------
# 5. Publish .NET API
# -------------------------------
- name: Build and publish .NET API
run: dotnet publish CaseConversionAPI/DotNetAPI -c Release -o ./publish
# -------------------------------
# 6. Copy correct DLL for platform
# -------------------------------
- name: Copy Linux .so
if: runner.os == 'Linux'
shell: bash
run: cp CaseConversionAPI/CppLib/build_dll/lib/libProcessStringDLL.so ./publish/
- name: Copy macOS .dylib
if: runner.os == 'macOS'
shell: bash
run: cp CaseConversionAPI/CppLib/build_dll/lib/libProcessStringDLL.dylib ./publish/
- name: Copy Windows .dll
if: runner.os == 'Windows'
shell: powershell
run: |
$dll = Get-ChildItem -Recurse -Filter ProcessStringDLL.dll CaseConversionAPI\CppLib\build_dll | Select-Object -First 1
Copy-Item $dll.FullName -Destination ".\publish\"
# -------------------------------
# 7. Build Frontend
# -------------------------------
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install frontend dependencies
run: |
cd string-conversion-ui
npm install
- name: Build frontend
run: |
cd string-conversion-ui
npm run build
# -------------------------------
# 8. Upload artifacts
# -------------------------------
- name: Upload API + DLL artifact
uses: actions/upload-artifact@v4
with:
name: DotNetAPI-${{ matrix.os }}
path: ./publish/
- name: Upload frontend artifact
uses: actions/upload-artifact@v4
with:
name: Frontend-${{ matrix.os }}
path: string-conversion-ui/dist/