-
Notifications
You must be signed in to change notification settings - Fork 0
161 lines (149 loc) · 5.54 KB
/
package-release.yaml
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Package and Release
on:
push:
tags:
- '*'
workflow_dispatch:
permissions:
packages: write
contents: write
jobs:
all:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
include:
- os: windows-latest
artifact_name: geodepot-win
conda_path: C:\Miniconda
conda_exe: C:\Miniconda\Scripts\conda.exe
geodepot_exe: \dist\geodepot\geodepot.exe
- os: ubuntu-latest
artifact_name: geodepot-ubuntu
conda_path: /usr/share/miniconda
conda_exe: conda
geodepot_exe: /dist/geodepot/geodepot
- os: macos-latest
artifact_name: geodepot-macos
conda_path: /Users/runner/miniconda3
conda_exe: conda
geodepot_exe: /dist/geodepot/geodepot
steps:
- uses: actions/checkout@v4
- if: runner.os == 'Windows'
name: Install wget on Windows
run: choco install wget
- uses: extractions/setup-just@v2
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Download test data
run: just download-data
# Install dependencies
- if: runner.os == 'macOS'
name: Install Miniconda on macOS
run: |
mkdir -p $HOME/miniconda3
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -o $HOME/miniconda3/miniconda.sh
bash $HOME/miniconda3/miniconda.sh -b -u -p $HOME/miniconda3
rm $HOME/miniconda3/miniconda.sh
$HOME/miniconda3/bin/conda init bash
echo "CONDA=$HOME/miniconda3" >> $GITHUB_ENV
- if: runner.os != 'Windows'
name: Add conda to system path non-Windows
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- if: runner.os == 'Windows'
name: Add conda to system path Windows
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA\Scripts >> $GITHUB_PATH
- name: Cache conda environment
id: cache-conda
uses: actions/cache@v4
with:
path: ${{ matrix.conda_path }}
key: ${{ runner.os }}-conda
- name: Install dependencies
if: steps.cache-conda.outputs.cache-hit != 'true'
run: |
${{ matrix.conda_exe }} install -y --name base --solver=classic conda-forge::conda-libmamba-solver conda-forge::libmamba conda-forge::libmambapy conda-forge::libarchive
${{ matrix.conda_exe }} install -y --name base --solver libmamba --channel conda-forge proj=9.4 click=8.1 requests=2.32 fabric=3.2 gdal=3.9 pdal=2.7 python-pdal=3.4 pyinstaller=6.10 pytest ruff
- name: Re-init conda shell
run: |
${{ matrix.conda_exe }} init --all
- name: Test if fucking pdal didn't fuck up gdal
run: |
python -c 'import osgeo'
# Install and test
- name: Install package
run: |
pip install .
- name: Lint
run: ruff check
- name: Format
run: ruff format --check
- name: Run unit tests
run: pytest
# Package
- if: runner.os == 'Linux'
name: Pyinstaller package Linux
run: |
pyinstaller --name geodepot --onedir --noconfirm --optimize 2 --add-data $CONDA/share/proj:share/proj --collect-all pdal --collect-all osgeo src/geodepot/__main__.py
- if: runner.os == 'macOS'
name: Pyinstaller package macOS
run: |
pyinstaller --name geodepot --onedir --console --noconfirm --optimize 2 --add-data $CONDA/share/proj/proj.db:share/proj/proj.db --collect-all pdal --collect-all osgeo src/geodepot/__main__.py
- if: runner.os == 'Windows'
name: Pyinstaller package Windows
run: |
pyinstaller --name geodepot --onedir --console --noconfirm --optimize 2 --add-data C:/Miniconda/Library/share/proj/proj.db:share/proj/proj.db --collect-all pdal --collect-all osgeo src/geodepot/__main__.py
# Test exe
- name: Test exe
run: |
${{ github.workspace }}${{ matrix.geodepot_exe }} init
${{ github.workspace }}${{ matrix.geodepot_exe }} add wippolder tests/data/sources/wippolder/wippolder.gpkg
${{ github.workspace }}${{ matrix.geodepot_exe }} list
${{ github.workspace }}${{ matrix.geodepot_exe }} show wippolder/wippolder.gpkg
# Create package archive
- if: runner.os == 'Linux'
name: Create package archive Linux
run: |
cd dist
zip -r geodepot-ubuntu.zip geodepot
sha256sum geodepot-ubuntu.zip > geodepot-ubuntu.zip.sha256sum
rm -rf geodepot
- if: runner.os == 'macOS'
name: Create package archive macOS
run: |
cd dist
zip -r geodepot-macos.zip geodepot
shasum -a 256 geodepot-macos.zip > geodepot-macos.zip.sha256sum
rm -rf geodepot
- if: runner.os == 'Windows'
name: Create package archive Windows
run: |
cd dist
7z a geodepot-win.zip geodepot
certUtil -hashfile geodepot-win.zip SHA256 > geodepot-win.zip.sha256sum
rm -r -fo geodepot
- name: List contents
run: |
ls dist
- name: Upload binaries to
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: dist/*
retention-days: 7
- name: Release
uses: softprops/action-gh-release@v2
with:
prerelease: true
repository: 3DBAG/geodepot
token: ${{ secrets.GITHUB_TOKEN }}
files: dist/*