Skip to content

Commit

Permalink
Artifact builders
Browse files Browse the repository at this point in the history
  • Loading branch information
SimeonRolev committed Oct 7, 2024
1 parent 401dbf0 commit 5346e9d
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 126 deletions.
92 changes: 92 additions & 0 deletions .github/actions/build-win32/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: 'Build Windows'
description: 'Build ths packages for Windows package'
runs:
using: "composite"
steps:
# Prepare Visual Studio
- name: Set up Visual Studio
uses: microsoft/setup-msbuild@v2
with:
msbuild-architecture: x64

# --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Xerces-C - setup
- name: Xerces-C - prepare
shell: bash
run: |
mkdir xerces-c
cd xerces-c
curl -o xerces-c.zip https://dlcdn.apache.org//xerces/c/3/sources/xerces-c-3.2.5.zip
tar -xf xerces-c.zip --strip-components=1
del xerces-c.zip
# --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Boost - setup and build
- name: Boost - prepare
shell: bash
run: |
mkdir boost
cd boost
curl -o boost.zip https://archives.boost.io/release/1.86.0/source/boost_1_86_0.zip
tar -xf boost.zip --strip-components=1
del boost.zip
# --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Produce a batch file to be locally executed to build the library
- name: Generate build batch file
run: |
# Define the multi-line text
$text = @'
REM ------------------------------------------------
REM ------------------------------------------------
REM
REM Execute this batch in PowerShell
REM
REM Current folder should be the root of libMvrGdtf
REM
REM ------------------------------------------------
call "c:\program files\microsoft visual studio\2022\professional\Common7\Tools\VsDevCmd.bat"
REM ------------------------------------------------
REM Build xerces-c
cd xerces-c
rmdir /s /q build
mkdir build
cd build
cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX:PATH=libs -DCMAKE_CXX_FLAGS="/DWIN32 /D_WINDOWS -O2 -Ob2 -DNDEBUG" -DCMAKE_C_FLAGS="/DWIN32 /D_WINDOWS /W3" -DBUILD_SHARED_LIBS:BOOL=FALSE -Dxmlch-type=wchar_t
msbuild /m ALL_BUILD.vcxproj /p:Configuration=Debug
msbuild /m INSTALL.vcxproj /p:Configuration=Debug
cd ../..
REM ------------------------------------------------
REM libMvrGdtf
cd libMvrGdtf
rmdir /s /q build_MD
mkdir build_MD
cd build_MD
cmake .. -DCMAKE_INSTALL_PREFIX:PATH=libs -DWIN_RUNTIME_LIB=-MD -DXERCES_INCLUDE_PATH="..\xerces-c\build\libs\include;..\xerces\src" -DXERCES_LIB_PATH="..\xerces\build\libs\lib" -DXERCES_ROOT_PATH="..\xerces-c\build"
ren MvrGdtf.vcxproj MvrGdtf_ORG.vcxproj
powershell -Command "$xml = [xml](Get-Content 'MvrGdtf_ORG.vcxproj');$xml.Project.ItemDefinitionGroup | ForEach-Object {$node = $xml.CreateElement('AdditionalDependencies', 'http://schemas.microsoft.com/developer/msbuild/2003'); $node.InnerText = 'iphlpapi.lib;..\..\xerces-c\build\libs\lib\xerces-c_3.lib;mdns_cpp\lib\MinSizeRel\mdns_cpp.lib;%(AdditionalDependencies)';$_.Lib.AppendChild($node) | Out-Null; }; Set-Content -Path 'MvrGdtf.vcxproj' -Value $xml.OuterXml"
rm MvrGdtf_ORG.vcxproj
msbuild /m ALL_BUILD.vcxproj /p:Configuration=Debug
msbuild /m INSTALL.vcxproj /p:Configuration=Debug
'@
# Write the text to a file
Set-Content -Path "build_libMVRgdtf.bat" -Value $text
shell: pwsh

- name: Prepare package
run: |
mkdir .\libMvrGdtf\output
Copy-Item -Path xerces-c -Destination .\libMvrGdtf\output -Recurse
Copy-Item -Path libMvrGdtf -Destination .\libMvrGdtf\output -Recurse
Copy-Item -Path boost -Destination .\libMvrGdtf\output -Recurse
Copy-Item -Path build_libMVRgdtf.bat -Destination .\libMvrGdtf\output
shell: pwsh
32 changes: 32 additions & 0 deletions .github/workflows/artifact-os-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
on:
workflow_call:
inputs:
runner:
description: 'One of: [ubuntu-latest, windows-latest]'
required: true
type: string

jobs:
build_artifact:
runs-on: ${{ inputs.runner }}
name: Export artifact for ${{ inputs.runner }}
steps:
- name: libMVRGdtf - checkout repository
uses: actions/checkout@v4
with:
path: libMvrGdtf

- name: Build Linux
if: inputs.runner == 'ubuntu-latest'
uses: ./libMvrGdtf/.github/actions/build-linux

- name: Build Windows
if: inputs.runner == 'windows-latest'
uses: ./libMvrGdtf/.github/actions/build-windows

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: libMVRgdtf-${{ inputs.runner }}
path: |
libMvrGdtf/output
20 changes: 3 additions & 17 deletions .github/workflows/build-linux-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,6 @@ on:

jobs:
build_artifact:
runs-on: ubuntu-latest
name: Export a Linux build as an artifact
steps:
- name: libMVRGdtf - checkout repository
uses: actions/checkout@v4
with:
path: libMvrGdtf

- name: Build
uses: ./libMvrGdtf/.github/actions/build-linux

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: libMVRgdtf-linux
path: |
libMvrGdtf/output
uses: ./.github/workflows/artifact-os-build.yml
with:
runner: 'ubuntu-latest'
10 changes: 10 additions & 0 deletions .github/workflows/build-win32-artifact.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Build win32 artifact

on:
[workflow_call, workflow_dispatch]

jobs:
build_artifact:
uses: ./.github/workflows/artifact-os-build.yml
with:
runner: 'windows-latest'
109 changes: 0 additions & 109 deletions .github/workflows/package-dev-win.yml

This file was deleted.

0 comments on commit 5346e9d

Please sign in to comment.