Skip to content

PR and Merge builds (on main branch) #650

PR and Merge builds (on main branch)

PR and Merge builds (on main branch) #650

Workflow file for this run

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: 0
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.13
if: steps.cache-libcspice.outputs.cache-hit != 'true'
uses: actions/setup-python@v5
with:
python-version: '3.13'
- 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.9', '3.10', '3.11', '3.12', '3.13']
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.13
uses: actions/setup-python@v5
with:
python-version: '3.13'
- 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.13-test-pip-${{ hashFiles('**/ci-requirements.txt') }}
restore-keys: |
${{ runner.os }}-3.13-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.13
uses: actions/setup-python@v5
with:
python-version: '3.13'
- 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.13-test-pip-${{ hashFiles('**/ci-requirements.txt') }}
restore-keys: |
${{ runner.os }}-3.13-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