-
Notifications
You must be signed in to change notification settings - Fork 120
152 lines (135 loc) · 4.5 KB
/
conda-install.yml
File metadata and controls
152 lines (135 loc) · 4.5 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
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
name: conda build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
types: [ opened, reopened, synchronize ]
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
permissions:
contents: read
env:
SNAP_VERSION: "13.0"
jobs:
build-linux:
runs-on: ubuntu-latest
defaults:
run:
shell: micromamba-shell {0}
services:
postgres:
image: postgis/postgis:16-3.4
env:
POSTGRES_PASSWORD: Password12!
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- name: Set up python environment
uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment-dev.yml
cache-environment: true
init-shell: bash
generate-run-shell: true
post-cleanup: 'all'
- name: Install ESA SNAP
run: |
wget -nv https://download.esa.int/step/snap/$SNAP_VERSION/installers/esa-snap_all_linux-$SNAP_VERSION.0.sh
bash esa-snap_all_linux-$SNAP_VERSION.0.sh -q -dir $GITHUB_ACTION_PATH/esa-snap
- name: Set paths and variables
run: |
echo "$CONDA/bin" >> $GITHUB_PATH
echo "$GITHUB_ACTION_PATH/esa-snap/bin" >> $GITHUB_PATH
echo "PROJ_DATA=$CONDA/share/proj" >> $GITHUB_ENV
- name: Lint with flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Install pyroSAR
run: |
pip install .
- name: Test with pytest
run: |
coverage run -m pytest
coverage xml
env:
PGUSER: postgres
PGPASSWORD: Password12!
- name: Publish to coveralls.io
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
uses: coverallsapp/github-action@v2.3.0
with:
github-token: ${{ github.token }}
format: cobertura
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- name: Set up micromamba environment
uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment-dev.yml
cache-environment: true
init-shell: bash
generate-run-shell: true
post-cleanup: 'all'
- uses: nyurik/action-setup-postgis@v2.2
with:
cached-dir: C:\downloads
postgres-version: 17
# ---------------- SNAP cache ----------------
- name: Cache SNAP zip
id: cache-snap
uses: actions/cache@v4
with:
path: |
snap.zip
key: snap-${{ env.SNAP_VERSION }}-windows
- name: Download and install SNAP (cache miss)
if: steps.cache-snap.outputs.cache-hit != 'true'
shell: cmd
run: |
echo Downloading SNAP installer...
curl -L -o snap.exe https://download.esa.int/step/snap/%SNAP_VERSION%/installers/esa-snap_all_windows-%SNAP_VERSION%.0.exe
echo Installing SNAP...
start /wait snap.exe -q -dir C:\esa-snap
echo Creating zip archive for cache...
powershell Compress-Archive -Path C:\esa-snap -DestinationPath snap.zip
- name: Restore SNAP from zip (cache hit)
if: steps.cache-snap.outputs.cache-hit == 'true'
shell: powershell
run: |
Write-Host "Unzipping cached SNAP..."
Expand-Archive snap.zip C:\
- name: Add SNAP to PATH
shell: powershell
run: |
echo "C:\esa-snap\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# ---------------- Python steps (micromamba env) ----------------
- name: Verify micromamba python
shell: bash -el {0}
run: |
where python
python -V
where pip
- name: Install pyroSAR
shell: bash -el {0}
run: |
python -m pip install .
- name: Setup tmate session (debug)
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
- name: Test with pytest
shell: bash -el {0}
run: |
pytest -vv
env:
PGUSER: postgres
PGPASSWORD: postgres