Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
199 changes: 69 additions & 130 deletions .github/workflows/release-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ on:
env:
DEVPI_USER: github
KETE_KERNEL_VERSION: v1
RUSTFLAGS: "-D warnings"
RUSTDOCFLAGS: "-D warnings"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand Down Expand Up @@ -103,13 +105,14 @@ jobs:

build_linux:
name: Build wheel for python ${{ matrix.python }} on internal runner
runs-on: self-hosted
permissions:
id-token: write
contents: read
runs-on: kete-arc-runners
container:
image: harbor.ipac.caltech.edu/builder/python:latest
credentials:
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_PASSWORD }}
timeout-minutes: 30
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
python:
Expand All @@ -120,10 +123,21 @@ jobs:
- "3.13"
- "3.14"
- "3.15"
env:
UV_PYTHON: ${{ matrix.python }}
UV_DEFAULT_INDEX: https://devpi.devpi.svc:8443/neos/stable/+simple/
UV_INDEX: https://devpi.devpi.svc:8443/neos/stable/+simple/
PIP_INDEX_URL: https://devpi.devpi.svc:8443/neos/stable/+simple/
PIP_EXTRA_INDEX_URL: https://devpi.devpi.svc:8443/neos/stable/+simple/
PIP_TRUSTED_HOST: devpi.devpi.svc
DEVPI: https://devpi.devpi.svc:8443/neos/stable
steps:
- name: Checkout
uses: actions/checkout@v7

- name: Mark the workspace as a safe git directory
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- name: Cache downloaded files
id: cache-kete
uses: actions/cache@v6
Expand All @@ -136,66 +150,20 @@ jobs:
# between runs. So there is no need to a changing name.
key: kete-cache

- name: Check cache
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Check if the cache was populated. If not, grab it from the OCI container.
- name: Trust the cluster service CA (devpi's in-cluster cert)
run: |
if [[ ! -d "$HOME/.kete/kernels" ]]; then
rm -rf "$HOME/.kete"
gh release download "kete-kernels-$KETE_KERNEL_VERSION" --repo ${{ github.repository }} --dir "$HOME/.kete"
cd "$HOME/.kete"
sha256sum -c kete-kernels.tar.gz.sha256
tar -xzf kete-kernels.tar.gz
fi
cat /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem \
/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt > "$RUNNER_TEMP/ca.pem"
echo "SSL_CERT_FILE=$RUNNER_TEMP/ca.pem" >> "$GITHUB_ENV"

- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
cache-key: ${{ runner.os }}-stable

- name: Install uv and set the Python version
uses: astral-sh/setup-uv@v10.4.2
with:
python-version: ${{ matrix.python }}
activate-environment: true
ignore-nothing-to-cache: true

- name: Install devpi
run: |
uv tool install devpi-client

- name: Configure uv to use devpi
run: |
devpi use -y https://devpi.apps.neoscluster.ipac.caltech.edu
devpi login -y "$DEVPI_USER" --password '${{ secrets.DEVPI_PASS }}'
devpi use --set-cfg --always-set-cfg yes --pip-set-trusted yes neos/stable

- name: Install dependencies
run: |
uv sync
env:
UV_INDEX: "https://devpi.apps.neoscluster.ipac.caltech.edu/neos/stable/+simple/"
UV_DEFAULT_INDEX: "https://devpi.apps.neoscluster.ipac.caltech.edu/neos/stable/+simple/"
UV_INDEX_URL: "https://devpi.apps.neoscluster.ipac.caltech.edu/neos/stable/+simple/"
UV_EXTRA_INDEX_URL: "https://devpi.apps.neoscluster.ipac.caltech.edu/neos/stable/+simple/"
PIP_INDEX_URL: "https://devpi.apps.neoscluster.ipac.caltech.edu/neos/stable/+simple/"
PIP_EXTRA_INDEX_URL: "https://devpi.apps.neoscluster.ipac.caltech.edu/neos/stable/+simple/"
PIP_TRUSTED_HOST: "pypi.org devpi.apps.neoscluster.ipac.caltech.edu"

- name: Build wheels
run: |
uv build --wheel
env:
UV_INDEX: "https://devpi.apps.neoscluster.ipac.caltech.edu/neos/stable/+simple/"
UV_DEFAULT_INDEX: "https://devpi.apps.neoscluster.ipac.caltech.edu/neos/stable/+simple/"
UV_INDEX_URL: "https://devpi.apps.neoscluster.ipac.caltech.edu/neos/stable/+simple/"
UV_EXTRA_INDEX_URL: "https://devpi.apps.neoscluster.ipac.caltech.edu/neos/stable/+simple/"
PIP_INDEX_URL: "https://devpi.apps.neoscluster.ipac.caltech.edu/neos/stable/+simple/"
PIP_EXTRA_INDEX_URL: "https://devpi.apps.neoscluster.ipac.caltech.edu/neos/stable/+simple/"
PIP_TRUSTED_HOST: "pypi.org devpi.apps.neoscluster.ipac.caltech.edu"
- name: Build
run: uv build --wheel

- name: Upload wheels
uses: actions/upload-artifact@v7
Expand All @@ -204,21 +172,19 @@ jobs:
path: ./dist/*.whl
if-no-files-found: error

- name: Remove local configuration changes
run: |
rm -f ~/.config/pip/pip.conf
rm -f ~/.config/uv/uv.toml
rm -f ~/.pydistutils.cfg
rm -f ~/.buildout/default.cfg

publish-to-pypi:
name: Publish Kete to PyPI
needs:
- build_wheels
- build_linux
runs-on: self-hosted
permissions:
id-token: write
runs-on: kete-arc-runners
container:
image: harbor.ipac.caltech.edu/builder/python:latest
credentials:
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_PASSWORD }}
env:
DEVPI: https://devpi.devpi.svc:8443/neos/stable
steps:
- name: Download all the dists
uses: actions/download-artifact@v8
Expand All @@ -227,29 +193,40 @@ jobs:
path: dist
merge-multiple: true

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
print-hash: true
attestations: false
skip-existing: false
user: ${{ env.DEVPI_USER }}
password: ${{ secrets.DEVPI_PASS }}
repository-url: https://devpi.apps.neoscluster.ipac.caltech.edu/neos/stable/
- name: Publish to devpi
run: |
cat /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem \
/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt > "$RUNNER_TEMP/ca.pem"
SSL_CERT_FILE="$RUNNER_TEMP/ca.pem" uv publish --publish-url "$DEVPI/" dist/*
env:
UV_PUBLISH_USERNAME: ${{ env.DEVPI_USER }}
UV_PUBLISH_PASSWORD: ${{ secrets.DEVPI_PASS }}

build_docs:
name: Build docs
runs-on: self-hosted
runs-on: kete-arc-runners
container:
image: harbor.ipac.caltech.edu/builder/python:latest
credentials:
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_PASSWORD }}
needs: [publish-to-pypi]
permissions:
id-token: write
contents: read
timeout-minutes: 30
env:
UV_PYTHON: "3.13"
DEVPI: https://devpi.devpi.svc:8443/neos/stable
UV_DEFAULT_INDEX: https://devpi.devpi.svc:8443/neos/stable/+simple/
UV_INDEX: https://devpi.devpi.svc:8443/neos/stable/+simple/
PIP_INDEX_URL: https://devpi.devpi.svc:8443/neos/stable/+simple/
PIP_EXTRA_INDEX_URL: https://devpi.devpi.svc:8443/neos/stable/+simple/
PIP_TRUSTED_HOST: devpi.devpi.svc
steps:
- name: Checkout
uses: actions/checkout@v7

- name: Mark the workspace as a safe git directory
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- name: Cache downloaded files
id: cache-kete
uses: actions/cache@v6
Expand All @@ -262,55 +239,19 @@ jobs:
# between runs. So there is no need to a changing name.
key: kete-cache

- name: Check cache
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Check if the cache was populated. If not, grab it from the OCI container.
- name: Trust the cluster service CA (devpi's in-cluster cert)
run: |
if [[ ! -d "$HOME/.kete/kernels" ]]; then
rm -rf "$HOME/.kete"
gh release download "kete-kernels-$KETE_KERNEL_VERSION" --repo ${{ github.repository }} --dir "$HOME/.kete"
cd "$HOME/.kete"
sha256sum -c kete-kernels.tar.gz.sha256
tar -xzf kete-kernels.tar.gz
fi
cat /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem \
/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt > "$RUNNER_TEMP/ca.pem"
echo "SSL_CERT_FILE=$RUNNER_TEMP/ca.pem" >> "$GITHUB_ENV"
echo "REQUESTS_CA_BUNDLE=$RUNNER_TEMP/ca.pem" >> "$GITHUB_ENV"

- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
cache-key: ${{ runner.os }}-stable

- name: Install uv and set the Python version
uses: astral-sh/setup-uv@v10.4.2
with:
python-version: "3.13"
activate-environment: true
ignore-nothing-to-cache: true

- name: Install devpi
run: |
uv tool install devpi-client

- name: Configure uv to use devpi
run: |
devpi use -y https://devpi.apps.neoscluster.ipac.caltech.edu
devpi login -y "$DEVPI_USER" --password '${{ secrets.DEVPI_PASS }}'
devpi use --set-cfg --always-set-cfg yes --pip-set-trusted yes neos/stable

- name: Install dependencies
run: |
uv sync --all-groups --all-extras
env:
UV_INDEX: "https://devpi.apps.neoscluster.ipac.caltech.edu/neos/stable/+simple/"
UV_DEFAULT_INDEX: "https://devpi.apps.neoscluster.ipac.caltech.edu/neos/stable/+simple/"
UV_INDEX_URL: "https://devpi.apps.neoscluster.ipac.caltech.edu/neos/stable/+simple/"
UV_EXTRA_INDEX_URL: "https://devpi.apps.neoscluster.ipac.caltech.edu/neos/stable/+simple/"
PIP_INDEX_URL: "https://devpi.apps.neoscluster.ipac.caltech.edu/neos/stable/+simple/"
PIP_EXTRA_INDEX_URL: "https://devpi.apps.neoscluster.ipac.caltech.edu/neos/stable/+simple/"
PIP_TRUSTED_HOST: "pypi.org devpi.apps.neoscluster.ipac.caltech.edu"

- name: Install dependencies
run: |
uv sync --all-groups --all-extras
Expand All @@ -319,23 +260,21 @@ jobs:
run: |
cargo doc -p kete_core --no-deps --release

# Build documentation and push artifact
- name: Build Docs
run: |
cd docs
make clean
make doctest
make html

- name: Fix permissions
run: |
chmod -c -R +rX "docs/" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done

- name: Upload docs
run: |
read -r package_name package_version < <(uv version)
cd docs
zip -rz "${package_name}-${package_version}.doc.zip" html/*
uv run python -m zipfile -c "${package_name}-${package_version}.doc.zip" html/
devpi() { uvx --from devpi-client devpi "$@"; }
devpi use "$DEVPI"
devpi login "$DEVPI_USER" --password "$DEVPI_PASS"
devpi upload "${package_name}-${package_version}.doc.zip"
env:
DEVPI_PASS: ${{ secrets.DEVPI_PASS }}
Loading