Skip to content

Commit 7796e18

Browse files
authored
Distribution fixes part deux (#26)
* Update CI/CD workflows to use Ubuntu 20.04 and enhance artifact installation process * fix windows test execution * Split Unix workflows into Linux and macOS builds and releases allows support for docker based ubunty-20.04 builds * Enhance Linux build workflow: replace 'gh' with 'curl' for artifact download and add 'jq' for JSON parsing * get latest cmake in ubuntu:20.04 * dist fix * Enhance packaging process across Linux, macOS, and Windows workflows to include versioning and curated selection of artifacts * switch to static build for windows
1 parent cec214e commit 7796e18

5 files changed

Lines changed: 81 additions & 19 deletions

File tree

.github/workflows/linux-build.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ jobs:
116116
cmake -B build \
117117
-DCMAKE_BUILD_TYPE=Release \
118118
-DCMAKE_PREFIX_PATH="${{ env.HIGHS_DIR }}" \
119-
-DBUILD_SHARED_LIBS=OFF
119+
-DBUILD_SHARED_LIBS=OFF \
120+
-DJRES_VERSION="${{ inputs.version }}"
120121
121122
- name: Build Project
122123
run: cmake --build build --config Release
@@ -151,10 +152,27 @@ jobs:
151152
- name: Set Asset Name
152153
run: echo "ASSET_NAME=jres-solver-${{ env.SAFE_VERSION }}-${{ env.SAFE_PLATFORM }}-${{ env.SAFE_ARCH }}.${{ inputs.asset_ext }}" >> $GITHUB_ENV
153154

154-
- name: Package (tar.gz)
155+
- name: Package (Curated Selection)
155156
run: |
156-
# Archive the entire 'dist' folder content (bin, include, lib)
157-
cd dist
157+
mkdir -p package/bin
158+
mkdir -p package/lib
159+
mkdir -p package/include/jres_solver
160+
161+
echo "Packaging Binary Artifacts..."
162+
163+
# Executables
164+
cp dist/bin/jres_solver package/bin/
165+
cp dist/bin/jres_formatter package/bin/
166+
167+
# Library (Grab .a or .so depending on build, likely .a)
168+
# Using find/cp with wildcard to be robust against lib vs lib64 differences
169+
find dist -name "libjres_solver.*" -exec cp {} package/lib/ \;
170+
171+
# Specific Header
172+
cp dist/include/jres_solver/jres_solver.hpp package/include/jres_solver/
173+
174+
# Archive the 'package' folder content
175+
cd package
158176
tar -czvf "../${{ env.ASSET_NAME }}" .
159177
160178
# ---------------------------------------------------------

.github/workflows/macos-build.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ jobs:
9292
-DCMAKE_BUILD_TYPE=Release \
9393
-DCMAKE_PREFIX_PATH="${{ env.HIGHS_DIR }}" \
9494
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/dist" \
95-
-DBUILD_SHARED_LIBS=OFF
95+
-DBUILD_SHARED_LIBS=OFF \
96+
-DJRES_VERSION="${{ inputs.version }}"
9697
9798
- name: Build Project
9899
run: cmake --build build --config Release
@@ -130,15 +131,32 @@ jobs:
130131
- name: Ad-hoc Sign Binary (macOS)
131132
if: startsWith(inputs.os, 'macos')
132133
run: |
133-
# Sign staged binaries in the /dist folder
134+
# Sign staged binaries in the /dist folder before packaging
134135
codesign --force --deep -s - dist/bin/jres_solver
135136
codesign --force --deep -s - dist/bin/jres_formatter
136137
# No need to sign .a static libs
137138
138-
- name: Package (tar.gz)
139+
- name: Package (Curated Selection)
139140
run: |
140-
# Archive the entire 'dist' folder content (bin, include, lib)
141-
cd dist
141+
mkdir -p package/bin
142+
mkdir -p package/lib
143+
mkdir -p package/include/jres_solver
144+
145+
echo "Packaging Binary Artifacts..."
146+
147+
# Executables
148+
cp dist/bin/jres_solver package/bin/
149+
cp dist/bin/jres_formatter package/bin/
150+
151+
# Library (Grab .dylib or .a)
152+
# Using find/cp with wildcard to be robust
153+
find dist -name "libjres_solver.*" -exec cp {} package/lib/ \;
154+
155+
# Specific Header
156+
cp dist/include/jres_solver/jres_solver.hpp package/include/jres_solver/
157+
158+
# Archive the 'package' folder content
159+
cd package
142160
tar -czvf "../${{ env.ASSET_NAME }}" .
143161
144162
# ---------------------------------------------------------

.github/workflows/win-build.yml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ jobs:
6262
-G "Visual Studio 17 2022" `
6363
-DCMAKE_BUILD_TYPE=Release `
6464
-DCMAKE_PREFIX_PATH="$env:HIGHS_DIR" `
65-
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}\dist"
65+
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}\dist" `
66+
-DBUILD_SHARED_LIBS=OFF `
67+
-DJRES_VERSION="${{ inputs.version }}"
6668
6769
- name: Add Build Dir to PATH
6870
shell: pwsh
@@ -106,15 +108,32 @@ jobs:
106108
$assetName = "jres-solver-${{ env.SAFE_VERSION }}-windows-${{ env.SAFE_ARCH }}.zip"
107109
echo "ASSET_NAME=$assetName" >> $env:GITHUB_ENV
108110
109-
- name: Create Release Zip
111+
- name: Package (Curated Selection)
110112
shell: pwsh
111113
run: |
112-
$assetPath = "$env:ASSET_NAME"
113-
$source = "${{ github.workspace }}\dist"
114-
Write-Host "Zipping staged artifacts from $source..."
114+
$pkg = "package"
115+
New-Item -ItemType Directory -Path "$pkg\bin" -Force | Out-Null
116+
New-Item -ItemType Directory -Path "$pkg\lib" -Force | Out-Null
117+
New-Item -ItemType Directory -Path "$pkg\include\jres_solver" -Force | Out-Null
118+
119+
Write-Host "Packaging Binary Artifacts..."
120+
121+
# Executables
122+
Copy-Item "dist\bin\jres_solver.exe" -Destination "$pkg\bin\"
123+
Copy-Item "dist\bin\jres_formatter.exe" -Destination "$pkg\bin\"
115124
116-
# Compress the whole 'dist' folder structure (bin, lib, include)
117-
Get-ChildItem $source -Recurse | Compress-Archive -DestinationPath $assetPath
125+
# Library (static)
126+
if (Test-Path "dist\lib\jres_solver.lib") {
127+
Copy-Item "dist\lib\jres_solver.lib" -Destination "$pkg\lib\"
128+
}
129+
130+
# Specific Header
131+
Copy-Item "dist\include\jres_solver\jres_solver.hpp" -Destination "$pkg\include\jres_solver\"
132+
133+
# Zip the package folder
134+
$assetPath = "$env:ASSET_NAME"
135+
Write-Host "Zipping curated package to $assetPath..."
136+
Get-ChildItem -Path $pkg | Compress-Archive -DestinationPath $assetPath
118137
119138
# ---------------------------------------------------------
120139
# Generate Signature (Checksum)

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,11 @@ set_target_properties(jres_solver_lib PROPERTIES OUTPUT_NAME "jres_solver")
166166

167167
if(WIN32)
168168
target_sources(jres_solver_lib PRIVATE ${VERSION_RC})
169-
# Only export symbols if we are actually building shared
169+
170170
if(BUILD_SHARED_LIBS)
171171
target_compile_definitions(jres_solver_lib PRIVATE JRES_SOLVER_EXPORTS)
172+
else()
173+
target_compile_definitions(jres_solver_lib PUBLIC JRES_STATIC)
172174
endif()
173175
endif()
174176

include/jres_solver/jres_solver.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,15 @@
1313
#define JRES_SOLVER_HPP
1414

1515
#if defined(_WIN32)
16-
// Windows/MSVC: Use __declspec(dllexport/dllimport)
17-
#ifdef JRES_SOLVER_EXPORTS
16+
// Windows/MSVC: Handle DLL exports, imports, AND static builds
17+
#if defined(JRES_STATIC)
18+
// Static build: No special attributes needed
19+
#define JRES_SOLVER_API
20+
#elif defined(JRES_SOLVER_EXPORTS)
21+
// Building the DLL: Export symbols
1822
#define JRES_SOLVER_API __declspec(dllexport)
1923
#else
24+
// Using the DLL: Import symbols
2025
#define JRES_SOLVER_API __declspec(dllimport)
2126
#endif
2227
#else

0 commit comments

Comments
 (0)