-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (91 loc) · 3.53 KB
/
build.yml
File metadata and controls
112 lines (91 loc) · 3.53 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
name: Build and Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
branches: ["main"]
jobs:
build:
name: Building Python Tools ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
artifact_name: ogs-tools-windows.zip
# - os: macos-13
# artifact_name: ogs-tools-macos-x64.zip
- os: macos-latest
artifact_name: ogs-tools-macos-arm64.zip
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: "3.10"
activate-environment: ogs_python_tools
environment-file: environment.yml
channels: conda-forge,nodefaults
- name: Extract lean binaries (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$src = "$env:CONDA_PREFIX"
$out = "dist"
New-Item -ItemType Directory -Force -Path $out
# CLI binaries
$bins = @("pdal.exe", "gdal_translate.exe", "gdaldem.exe", "gdalinfo.exe", "gdal_grid.exe", "gdal_rasterize.exe")
foreach ($bin in $bins) {
$path = Join-Path $src "Library\bin\$bin"
if (Test-Path $path) { Copy-Item $path $out; Write-Host "Copied $bin" }
else { Write-Warning "Not found: $bin" }
}
# All DLLs (pdal + gdal have many transitive deps — copy the lot)
Copy-Item "$src\Library\bin\*.dll" $out
# GDAL data (projections, format drivers)
Copy-Item -Recurse "$src\Library\share\gdal" "$out\gdal-data"
# PROJ data (coordinate transforms)
Copy-Item -Recurse "$src\Library\share\proj" "$out\proj-data"
Write-Host "Total size: $([math]::Round((Get-ChildItem $out -Recurse | Measure-Object -Property Length -Sum).Sum / 1MB, 1)) MB"
- name: Extract lean binaries (macOS)
if: runner.os == 'macOS'
shell: bash -el {0}
run: |
src="$CONDA_PREFIX"
out="dist"
mkdir -p "$out/lib"
# CLI binaries
for bin in pdal gdal_translate gdaldem gdalinfo gdal_grid gdal_rasterize; do
path="$src/bin/$bin"
if [ -f "$path" ]; then
cp "$path" "$out/"
echo "Copied $bin"
else
echo "WARNING: $bin not found"
fi
done
# All dylibs
cp "$src/lib/"*.dylib "$out/lib/" 2>/dev/null || true
# GDAL + PROJ data
cp -r "$src/share/gdal" "$out/gdal-data"
cp -r "$src/share/proj" "$out/proj-data"
# Patch rpath on each binary so dylibs resolve relative to the binary
for bin in pdal gdal_translate gdaldem gdalinfo gdal_grid gdal_rasterize; do
[ -f "$out/$bin" ] && install_name_tool -add_rpath @executable_path/lib "$out/$bin" 2>/dev/null || true
done
echo "Total size: $(du -sh $out | cut -f1)"
- name: Zip output (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: Compress-Archive -Path dist\* -DestinationPath ${{ matrix.artifact_name }}
- name: Zip output (macOS)
if: runner.os == 'macOS'
shell: bash
run: cd dist && zip -r ../${{ matrix.artifact_name }} .
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.artifact_name }}