Skip to content

Commit 184b679

Browse files
authored
updating various ci bits, codecov action may be broken due to change … (#482)
* update ci to use python 3.12 across * more robust macos cross compilation to support either x86 or arm on either machine runner * fix test timezone deprecation warning * added pypi cache env var to action to enable new cache
1 parent d044027 commit 184b679

File tree

8 files changed

+65
-62
lines changed

8 files changed

+65
-62
lines changed

.cirrus.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/ci-build.yml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ on:
1010
env:
1111
# increment to rebuild cspice manually
1212
CSPICE_VERSION: 67
13-
CSPICE_CACHE_NUMBER: 1
13+
CSPICE_CACHE_NUMBER: 2
14+
PYPI_CACHE_NUMBER: 0
1415

1516
jobs:
1617
build:
@@ -34,11 +35,11 @@ jobs:
3435
uses: actions/checkout@v4
3536
with:
3637
ref: ${{ github.event.pull_request.head.sha }}
37-
- name: Set up Python 🐍 3.11
38+
- name: Set up Python 🐍 3.12
3839
if: steps.cache-libcspice.outputs.cache-hit != 'true'
3940
uses: actions/setup-python@v5
4041
with:
41-
python-version: '3.11'
42+
python-version: '3.12'
4243
- name: Display Python 🐍 version
4344
if: steps.cache-libcspice.outputs.cache-hit != 'true'
4445
run: python -c "import sys; print(sys.version)"
@@ -95,17 +96,17 @@ jobs:
9596
uses: actions/cache@v4
9697
with:
9798
path: ${{ steps.pip-cache-nix.outputs.pip_cache_dir }}
98-
key: ${{ runner.os }}-${{ matrix.python-version }}-test-pip-${{ hashFiles('**/ci-requirements.txt') }}
99+
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ env.PYPI_CACHE_NUMBER }}-test-pip-${{ hashFiles('**/ci-requirements.txt') }}
99100
restore-keys: |
100-
${{ runner.os }}-${{ matrix.python-version }}-test-pip-
101+
${{ runner.os }}-${{ matrix.python-version }}-${{ env.PYPI_CACHE_NUMBER }}-test-pip-
101102
- name: Cache pip's cache dir windows
102103
if: runner.os == 'Windows'
103104
uses: actions/cache@v4
104105
with:
105106
path: ${{ steps.pip-cache-win.outputs.pip_cache_dir }}
106-
key: ${{ runner.os }}-${{ matrix.python-version }}-test-pip-${{ hashFiles('**/ci-requirements.txt') }}
107+
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ env.PYPI_CACHE_NUMBER }}-test-pip-${{ hashFiles('**/ci-requirements.txt') }}
107108
restore-keys: |
108-
${{ runner.os }}-${{ matrix.python-version }}-test-pip-
109+
${{ runner.os }}-${{ matrix.python-version }}-${{ env.PYPI_CACHE_NUMBER }}-test-pip-
109110
- name: Install dependencies
110111
run: |
111112
python -m pip install -r ci-requirements.txt
@@ -116,8 +117,9 @@ jobs:
116117
run: |
117118
coverage run --source spiceypy -m pytest --pyargs spiceypy
118119
- name: Upload 🆙 coverage 📈 report to codecov
119-
uses: codecov/codecov-action@v3
120+
uses: codecov/codecov-action@v4
120121
with:
122+
fail_ci_if_error: false
121123
verbose: true
122124
test_offline_shared:
123125
runs-on: ubuntu-latest
@@ -126,10 +128,10 @@ jobs:
126128
uses: actions/checkout@v4
127129
with:
128130
ref: ${{ github.event.pull_request.head.sha }}
129-
- name: Set up Python 🐍 3.11
131+
- name: Set up Python 🐍 3.12
130132
uses: actions/setup-python@v5
131133
with:
132-
python-version: '3.11'
134+
python-version: '3.12'
133135
- name: Display Python 🐍 version
134136
run: python -c "import sys; print(sys.version)"
135137
- name: Install pip
@@ -143,9 +145,9 @@ jobs:
143145
uses: actions/cache@v4
144146
with:
145147
path: ${{ steps.pip-cache.outputs.pip_cache_dir }}
146-
key: ${{ runner.os }}-3.11-test-pip-${{ hashFiles('**/ci-requirements.txt') }}
148+
key: ${{ runner.os }}-3.12-test-pip-${{ hashFiles('**/ci-requirements.txt') }}
147149
restore-keys: |
148-
${{ runner.os }}-3.11-test-pip-
150+
${{ runner.os }}-3.12-test-pip-
149151
- name: Install dependencies
150152
run: |
151153
python -m pip install -U -r ci-requirements.txt
@@ -163,8 +165,9 @@ jobs:
163165
run: |
164166
coverage run --source spiceypy -m pytest --pyargs spiceypy
165167
- name: Upload 🆙 coverage 📈 report to codecov
166-
uses: codecov/codecov-action@v3
168+
uses: codecov/codecov-action@v4
167169
with:
170+
fail_ci_if_error: false
168171
verbose: true
169172
test_offline_cspice_install:
170173
runs-on: ubuntu-latest
@@ -173,10 +176,10 @@ jobs:
173176
uses: actions/checkout@v4
174177
with:
175178
ref: ${{ github.event.pull_request.head.sha }}
176-
- name: Set up Python 🐍 3.11
179+
- name: Set up Python 🐍 3.12
177180
uses: actions/setup-python@v5
178181
with:
179-
python-version: '3.11'
182+
python-version: '3.12'
180183
- name: Display Python 🐍 version
181184
run: python -c "import sys; print(sys.version)"
182185
- name: Install pip
@@ -190,9 +193,9 @@ jobs:
190193
uses: actions/cache@v4
191194
with:
192195
path: ${{ steps.pip-cache.outputs.pip_cache_dir }}
193-
key: ${{ runner.os }}-3.11-test-pip-${{ hashFiles('**/ci-requirements.txt') }}
196+
key: ${{ runner.os }}-3.12-test-pip-${{ hashFiles('**/ci-requirements.txt') }}
194197
restore-keys: |
195-
${{ runner.os }}-3.11-test-pip-
198+
${{ runner.os }}-3.12-test-pip-
196199
- name: Install dependencies
197200
run : |
198201
python -m pip install -U -r ci-requirements.txt
@@ -209,6 +212,7 @@ jobs:
209212
run: |
210213
coverage run --source spiceypy -m pytest --pyargs spiceypy
211214
- name: Upload 🆙 coverage 📈 report to codecov
212-
uses: codecov/codecov-action@v3
215+
uses: codecov/codecov-action@v4
213216
with:
217+
fail_ci_if_error: false
214218
verbose: true

.github/workflows/publish-to-test-and-live-pypi.yml

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,29 @@ jobs:
1515
steps:
1616
- name: Checkout 🌶️ 🥧
1717
uses: actions/checkout@v4
18-
- name: Set up Python 🐍 3.11
18+
- name: Set up Python 🐍 3.12
1919
uses: actions/setup-python@v5
2020
with:
21-
python-version: '3.11'
21+
python-version: '3.12'
2222
- name: Display Python 🐍
2323
run: python -c "import sys; print(sys.version)"
2424
- name: Install dependencies
2525
run: |
2626
python -m pip install --upgrade pip
27-
python -m pip install -r ci-requirements.txt
27+
python -m pip install -r test-requirements.txt
28+
python -m pip install build coverage>=5.1.0 twine>=3.3.0
2829
- name: Build 🛠️ sdist source and Install SpiceyPy 🌶️ 🥧
2930
run: |
3031
python -m build --sdist
31-
pip install dist/*.tar.gz --user
32+
echo "Running Pip install from sdist"
33+
python -m pip install dist/*.tar.gz --user
3234
- name: Test 🧪 with coverage 📈
3335
run: |
3436
coverage run --source spiceypy -m pytest --pyargs spiceypy
3537
- name: Upload 🆙 coverage 📈 report to codecov
36-
uses: codecov/codecov-action@v3
38+
uses: codecov/codecov-action@v4
3739
with:
40+
fail_ci_if_error: false
3841
verbose: true
3942
- name: Check dists
4043
run: |
@@ -62,11 +65,16 @@ jobs:
6265
- name: Setup 🔬🍦🏗️
6366
if: runner.os == 'Windows'
6467
uses: ilammy/[email protected]
65-
- name: set additional environment variables
66-
if: runner.name == 'macOS' && runner.arch == 'arm64'
68+
- name: set additional environment variables for macOS arm
69+
if: runner.name == 'macOS' && matrix.config.arch == 'arm64'
6770
run: |
6871
echo "CIBW_ARCHS_MACOS=arm64" >> $GITHUB_ENV
6972
echo "ARCHFLAGS='-arch arm64'" >> $GITHUB_ENV
73+
- name: set additional environment variables for macOS x86
74+
if: runner.name == 'macOS' && matrix.config.arch == 'x86_64'
75+
run: |
76+
echo "CIBW_ARCHS_MACOS=x86_64" >> $GITHUB_ENV
77+
echo "ARCHFLAGS='-arch x86_64'" >> $GITHUB_ENV
7078
- name: Set up QEMU for arm64 builds
7179
if: matrix.config.arch == 'aarch64'
7280
uses: docker/setup-qemu-action@v3
@@ -78,17 +86,17 @@ jobs:
7886
with:
7987
path: ./src/spiceypy/utils/libcspice.so
8088
key: ${{ env.CSPICE_CACHE }}-${{ matrix.config.os }}-${{ matrix.config.arch }}-${{ hashFiles('get_spice.py') }}-${{ hashFiles('setup.cfg') }}
81-
- name: Set up Python 🐍 3.11
89+
- name: Set up Python 🐍 3.12
8290
uses: actions/setup-python@v5
8391
with:
84-
python-version: '3.11'
92+
python-version: '3.12'
8593
- name: Display Python 🐍 Version
8694
run: python -c "import sys; print(sys.version)"
8795
- name: Install dependencies
8896
run: |
8997
python -m pip install --upgrade pip
9098
python -m pip install -r ci-requirements.txt
91-
python -m pip install cibuildwheel==2.16.4
99+
python -m pip install cibuildwheel==2.19.1
92100
- name: See if libcspice.so is available from cache
93101
if: matrix.config.arch == 'aarch64'
94102
run: |
@@ -128,10 +136,10 @@ jobs:
128136
pattern: artifact-*
129137
merge-multiple: true
130138
path: dist
131-
- name: Set up Python 🐍 3.11
139+
- name: Set up Python 🐍 3.12
132140
uses: actions/setup-python@v5
133141
with:
134-
python-version: '3.11'
142+
python-version: '3.12'
135143
- name: Display Python 🐍
136144
run: python -c "import sys; print(sys.version)"
137145
- name: Install dependencies

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ as newer versions are released.
109109

110110
- OS: OS X, Linux, Windows, FreeBSD
111111
- CPU: 64bit only!
112-
- Python 3.6, 3.7, 3.8, 3.9, 3.10, 3.11
112+
- Python 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12
113113
- ARM support for Linux-aarch64 & osx-arm64
114114

115115
* Support for Python 2.7 ended with version 2.3.2 January 2020 *

get_spice.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,28 @@
9393
os_supported = host_OS in ("Linux", "Darwin", "FreeBSD", "Windows")
9494
# Get platform is Unix-like OS or not
9595
is_unix = host_OS in ("Linux", "Darwin", "FreeBSD")
96+
is_macos = host_OS == "Darwin"
9697
# Get current working directory
9798
root_dir = str(Path(os.path.realpath(__file__)).parent)
9899
# Make the directory path for cspice
99100
cspice_dir = os.environ.get(CSPICE_SRC_DIR, os.path.join(root_dir, "cspice"))
100101
# and make a global tmp cspice directory
101102
tmp_cspice_root_dir = None
103+
# macos builds can occur on x86 or arm64 machines.
104+
# but we need to support cross compilation either way
105+
# so be a little pedantic here
106+
requested_arch_x86 = os.environ.get("ARCHFLAGS", "") == "-arch x86_64"
107+
requested_arch_arm = os.environ.get("ARCHFLAGS", "") == "-arch arm64"
108+
# if both are false and on macos do something
109+
if is_macos and (not requested_arch_arm and not requested_arch_x86):
110+
# default to building arm on macos
111+
requested_arch_arm = True
112+
build_macos_x86 = is_macos and (('x86' in host_arch) or requested_arch_x86) and not requested_arch_arm
113+
build_macos_arm = is_macos and ((host_arch == 'arm64') or requested_arch_arm) and not requested_arch_x86
114+
# if host arch is x86 it will go to x86 build
115+
# if however archflags was set explicitly to not be arm64 we need cross compile
102116
# if we need to cross compile or compile for arm64
103-
is_macos_arm = host_OS == "Darwin" and (
104-
host_arch == "arm64" or os.environ.get("ARCHFLAGS", "") == "-arch arm64"
105-
)
117+
is_macos_arm = build_macos_arm
106118
# versions
107119
spice_version = "N0067"
108120
spice_num_v = "67"
@@ -209,7 +221,6 @@ def _distribution_info(self):
209221
machine = "x86_64"
210222

211223
if is_macos_arm:
212-
print("either running on apple arm64 or cross-compiling")
213224
machine = "arm64"
214225

215226
print("SYSTEM: ", system)
@@ -349,8 +360,9 @@ def build_cspice() -> str:
349360
global cspice_dir, host_OS
350361
if is_unix:
351362
libname = f"libcspice.so"
352-
target = "-target arm64-apple-macos11" if is_macos_arm else ""
363+
target = ""
353364
if host_OS == "Darwin":
365+
target = "-target arm64-apple-macos11" if build_macos_arm else "-target x86_64-apple-macos10.9"
354366
extra_flags = f"-dynamiclib -install_name @rpath/{libname}"
355367
else:
356368
extra_flags = f"-shared -Wl,-soname,{libname}"

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ build-backend = "setuptools.build_meta"
77
build-frontend = "build"
88
# build libcspice inside cibuildwheel before running python build steps
99
before-build = "python {project}/get_spice.py"
10-
# Only build on CPython 3.11
11-
build = "cp311-*"
10+
# Only build on CPython 3.12
11+
build = "cp312-*"
1212
# Skip 32-bit builds, pypy, and musllinux
1313
skip = ["*-win32", "*-manylinux_i686", "*-musllinux_i686", "pypy*", "pp*", "*-musllinux_aarch64", "*-musllinux_x86_64"]
1414
# other options

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ classifiers =
3333
Programming Language :: Python :: 3.9
3434
Programming Language :: Python :: 3.10
3535
Programming Language :: Python :: 3.11
36+
Programming Language :: Python :: 3.12
3637
Operating System :: MacOS :: MacOS X
3738
Operating System :: POSIX :: Linux
3839
Operating System :: POSIX :: BSD :: FreeBSD

src/spiceypy/tests/test_wrapper.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6751,10 +6751,9 @@ def test_raxisa():
67516751

67526752

67536753
def test_rdtext():
6754-
import datetime
6755-
6754+
from datetime import datetime, timezone
67566755
# Create ISO UTC datetime string using current time
6757-
utcnow = datetime.datetime.utcnow().isoformat()
6756+
utcnow = datetime.now(timezone.utc).isoformat()
67586757
spice.reset()
67596758
# Create temporary filenames
67606759
RDTEXT = os.path.join(cwd, "ex_rdtext.txt")

0 commit comments

Comments
 (0)