-
-
Notifications
You must be signed in to change notification settings - Fork 84
230 lines (228 loc) · 8.19 KB
/
ci-build.yml
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
name: PR and Merge builds (on main branch)
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
schedule:
- cron: "0 4 * * 0"
env:
# increment to rebuild cspice manually
CSPICE_VERSION: 67
CSPICE_CACHE_NUMBER: 2
PYPI_CACHE_NUMBER: 0
jobs:
build:
name: Build libcspice 🌶️ 📚
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
steps:
- name: Look for cached libcspice 🌶️ 📚
id: cache-libcspice
uses: actions/cache@v4
with:
path: ./src/spiceypy/utils/libcspice.*
key: ${{ matrix.os }}-${{ env.CSPICE_VERSION }}-${{ env.CSPICE_CACHE_NUMBER }}-libcspice
- name: Setup 🔬🍦🏗️
if: ${{ matrix.os == 'windows-latest' && steps.cache-libcspice.outputs.cache-hit != 'true' }}
uses: ilammy/[email protected]
- name: Checkout 🌶️ 🥧
if: steps.cache-libcspice.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python 🐍 3.12
if: steps.cache-libcspice.outputs.cache-hit != 'true'
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Display Python 🐍 version
if: steps.cache-libcspice.outputs.cache-hit != 'true'
run: python -c "import sys; print(sys.version)"
- name: Build libcspice 🌶️ 📚
if: steps.cache-libcspice.outputs.cache-hit != 'true'
run: |
python get_spice.py
- name: Upload built 🏗️ libcspice 🌶️ 📚
uses: actions/upload-artifact@v4
with:
name: artifact-${{ matrix.os }}
path: ./src/spiceypy/utils/libcspice.*
test:
name: Test SpiceyPy 🌶️ 🥧
needs: build
runs-on: ${{ matrix.os }}
permissions:
id-token: write
contents: read
strategy:
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12' ]
steps:
- name: Checkout 🌶️ 🥧
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Download built 🏗️ libcspice 🌶️ 📚
uses: actions/download-artifact@v4
with:
name: artifact-${{ matrix.os }}
path: ./src/spiceypy/utils/
- name: Set up Python 🐍 ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
check-latest: true
- name: Display Python 🐍 version
run: python -c "import sys; print(sys.version)"
- name: Install pip
run: |
python -m pip install --upgrade pip
- name: Get pip cache dir on mac/linux
if: runner.os != 'Windows'
id: pip-cache-nix
run: |
echo "pip_cache_dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Get pip cache dir on windows
if: runner.os == 'Windows'
shell: pwsh
id: pip-cache-win
run: |
echo "pip_cache_dir=$(pip cache dir)" >> $env:GITHUB_OUTPUT
- name: Cache pip's cache dir mac/linux
if: runner.os != 'Windows'
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache-nix.outputs.pip_cache_dir }}
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ env.PYPI_CACHE_NUMBER }}-test-pip-${{ hashFiles('**/ci-requirements.txt') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-${{ env.PYPI_CACHE_NUMBER }}-test-pip-
- name: Cache pip's cache dir windows
if: runner.os == 'Windows'
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache-win.outputs.pip_cache_dir }}
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ env.PYPI_CACHE_NUMBER }}-test-pip-${{ hashFiles('**/ci-requirements.txt') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-${{ env.PYPI_CACHE_NUMBER }}-test-pip-
- name: Install dependencies
run: |
python -m pip install -r ci-requirements.txt
- name: Install SpiceyPy 🌶️ 🥧
run: |
python -m pip install .
- name: Test 🧪 with coverage 📈
run: |
coverage run --source spiceypy -m pytest --pyargs spiceypy
- name: Upload 🆙 coverage 📈 report to codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
verbose: true
use_oidc: true
test_offline_shared:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout 🌶️ 🥧
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python 🐍 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Display Python 🐍 version
run: python -c "import sys; print(sys.version)"
- name: Install pip
run: |
python -m pip install --upgrade pip
- name: Get pip cache dir
id: pip-cache
run: |
echo "pip_cache_dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Cache pip's cache dir
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.pip_cache_dir }}
key: ${{ runner.os }}-3.12-test-pip-${{ hashFiles('**/ci-requirements.txt') }}
restore-keys: |
${{ runner.os }}-3.12-test-pip-
- name: Install dependencies
run: |
python -m pip install -U -r ci-requirements.txt
- name: Download and extract the shared library for CSPICE 🌶️
run: |
mkdir -p /tmp/cspice/
wget -O - https://anaconda.org/conda-forge/cspice/67/download/linux-64/cspice-67-h7f98852_0.tar.bz2 | tar xjC /tmp/cspice/
- name: Install SpiceyPy 🌶️ 🥧
env:
CSPICE_SHARED_LIB: "/tmp/cspice/lib/libcspice.so"
run: |
python get_spice.py
python -m pip install .
- name: Test 🧪 with coverage 📈
run: |
coverage run --source spiceypy -m pytest --pyargs spiceypy
- name: Upload 🆙 coverage 📈 report to codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
verbose: true
use_oidc: true
test_offline_cspice_install:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout 🌶️ 🥧
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python 🐍 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Display Python 🐍 version
run: python -c "import sys; print(sys.version)"
- name: Install pip
run: |
python -m pip install --upgrade pip
- name: Get pip cache dir
id: pip-cache
run: |
echo "pip_cache_dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Cache pip's cache dir
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.pip_cache_dir }}
key: ${{ runner.os }}-3.12-test-pip-${{ hashFiles('**/ci-requirements.txt') }}
restore-keys: |
${{ runner.os }}-3.12-test-pip-
- name: Install dependencies
run : |
python -m pip install -U -r ci-requirements.txt
- name: Download and extract CSPICE 🌶️
run: |
wget -O - https://naif.jpl.nasa.gov/pub/naif/misc/toolkit_N0067/C/PC_Linux_GCC_64bit/packages/cspice.tar.Z | gunzip -c | tar xC /tmp/
- name: Install SpiceyPy 🌶️ 🥧
env:
CSPICE_SRC_DIR: "/tmp/cspice"
run: |
python get_spice.py
python -m pip install .
- name: Test 🧪 with coverage 📈
run: |
coverage run --source spiceypy -m pytest --pyargs spiceypy
- name: Upload 🆙 coverage 📈 report to codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
verbose: true
use_oidc: true