Skip to content

Commit 5d7008a

Browse files
fix: use conda pack
1 parent 5f278b3 commit 5d7008a

1 file changed

Lines changed: 18 additions & 74 deletions

File tree

.github/workflows/build.yml

Lines changed: 18 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
tags:
66
- 'v[0-9]+.[0-9]+.[0-9]+'
7-
branches: ["main"]
7+
# branches: ["main"]
88

99
jobs:
1010

@@ -16,11 +16,11 @@ jobs:
1616
matrix:
1717
include:
1818
- os: windows-latest
19-
artifact_name: ogs-tools-windows.zip
20-
# - os: macos-13
21-
# artifact_name: ogs-tools-macos-x64.zip
19+
artifact_name: python-env-windows.zip
20+
# - os: macos-13 # Intel Mac (x64)
21+
# artifact_name: python-env-macos-x64.tar.gz
2222
- os: macos-latest
23-
artifact_name: ogs-tools-macos-arm64.zip
23+
artifact_name: python-env-macos-arm64.tar.gz
2424

2525
steps:
2626
- name: Checkout Code
@@ -34,79 +34,23 @@ jobs:
3434
activate-environment: ogs_python_tools
3535
environment-file: environment.yml
3636
channels: conda-forge,nodefaults
37-
38-
- name: Extract lean binaries (Windows)
39-
if: runner.os == 'Windows'
40-
shell: pwsh
41-
run: |
42-
$src = "$env:CONDA_PREFIX"
43-
$out = "dist"
44-
New-Item -ItemType Directory -Force -Path $out
45-
46-
# CLI binaries
47-
$bins = @("pdal.exe", "gdal_translate.exe", "gdaldem.exe", "gdalinfo.exe", "gdal_grid.exe", "gdal_rasterize.exe")
48-
foreach ($bin in $bins) {
49-
$path = Join-Path $src "Library\bin\$bin"
50-
if (Test-Path $path) { Copy-Item $path $out; Write-Host "Copied $bin" }
51-
else { Write-Warning "Not found: $bin" }
52-
}
53-
54-
# All DLLs (pdal + gdal have many transitive deps — copy the lot)
55-
Copy-Item "$src\Library\bin\*.dll" $out
56-
57-
# GDAL data (projections, format drivers)
58-
Copy-Item -Recurse "$src\Library\share\gdal" "$out\gdal-data"
59-
60-
# PROJ data (coordinate transforms)
61-
Copy-Item -Recurse "$src\Library\share\proj" "$out\proj-data"
62-
63-
Write-Host "Total size: $([math]::Round((Get-ChildItem $out -Recurse | Measure-Object -Property Length -Sum).Sum / 1MB, 1)) MB"
64-
65-
- name: Extract lean binaries (macOS)
66-
if: runner.os == 'macOS'
37+
38+
- name: Install Requirements
39+
shell: bash -el {0}
40+
run: conda install -n base -c conda-forge conda-pack mamba -y
41+
42+
- name: Cleanup Environment
6743
shell: bash -el {0}
6844
run: |
69-
src="$CONDA_PREFIX"
70-
out="dist"
71-
mkdir -p "$out/lib"
72-
73-
# CLI binaries
74-
for bin in pdal gdal_translate gdaldem gdalinfo gdal_grid gdal_rasterize; do
75-
path="$src/bin/$bin"
76-
if [ -f "$path" ]; then
77-
cp "$path" "$out/"
78-
echo "Copied $bin"
79-
else
80-
echo "WARNING: $bin not found"
81-
fi
82-
done
83-
84-
# All dylibs
85-
cp "$src/lib/"*.dylib "$out/lib/" 2>/dev/null || true
86-
87-
# GDAL + PROJ data
88-
cp -r "$src/share/gdal" "$out/gdal-data"
89-
cp -r "$src/share/proj" "$out/proj-data"
90-
91-
# Patch rpath on each binary so dylibs resolve relative to the binary
92-
for bin in pdal gdal_translate gdaldem gdalinfo gdal_grid gdal_rasterize; do
93-
[ -f "$out/$bin" ] && install_name_tool -add_rpath @executable_path/lib "$out/$bin" 2>/dev/null || true
94-
done
95-
96-
echo "Total size: $(du -sh $out | cut -f1)"
97-
98-
- name: Zip output (Windows)
99-
if: runner.os == 'Windows'
100-
shell: pwsh
101-
run: Compress-Archive -Path dist\* -DestinationPath ${{ matrix.artifact_name }}
102-
103-
- name: Zip output (macOS)
104-
if: runner.os == 'macOS'
105-
shell: bash
106-
run: cd dist && zip -r ../${{ matrix.artifact_name }} .
45+
conda clean --all -y
46+
pip cache purge
10747
48+
- name: Pack Environment
49+
shell: bash -el {0}
50+
run: conda run -n base conda-pack -n ogs_python_tools -o ${{ matrix.artifact_name }}
51+
10852
- name: Upload Artifact
10953
uses: actions/upload-artifact@v4
11054
with:
11155
name: ${{ matrix.artifact_name }}
112-
path: ${{ matrix.artifact_name }}
56+
path: ${{ matrix.artifact_name }}

0 commit comments

Comments
 (0)