Skip to content

Commit

Permalink
Test notebooks against k8s qs deployment (Qiskit#1216)
Browse files Browse the repository at this point in the history
* test notebooks against k8s qs deployment

Signed-off-by: Paul S. Schweigert <paul@paulschweigert.com>

* update notebook location

Signed-off-by: Paul S. Schweigert <paul@paulschweigert.com>

* use action for kind creation

Signed-off-by: Paul S. Schweigert <paul@paulschweigert.com>

* test all notebooks

Signed-off-by: Paul S. Schweigert <paul@paulschweigert.com>

* drop sleep

Signed-off-by: Paul S. Schweigert <paul@paulschweigert.com>

This was redundant, as the python setup in the next few steps takes
waaaay longer than 60s

---------

Signed-off-by: Paul S. Schweigert <paul@paulschweigert.com>
  • Loading branch information
psschwei authored and david-alber committed Feb 13, 2024
1 parent 9df01ce commit 8154cae
Showing 1 changed file with 92 additions and 0 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/kubernetes-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Test QS on Kubernetes

on:
pull_request:
branches: [ main ]

jobs:
tests:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Install Kind
run: |
curl -Lo ./kind "https://github.com/kubernetes-sigs/kind/releases/download/v0.20.0/kind-$(uname)-amd64"
chmod +x ./kind
sudo mv kind /usr/local/bin
which kind
- name: Create Kind cluster
uses: chainguard-dev/actions/setup-kind@main
with:
k8s-version: 1.27.x
kind-worker-count: 0
- name: Build and load gateway
run: |
docker build -t gateway:test --build-arg TARGETARCH="amd64" -f ./gateway/Dockerfile .
kind load docker-image gateway:test
docker image rm gateway:test
- name: Build and load ray node
run: |
docker build -t ray:test --build-arg TARGETARCH="amd64" -f ./Dockerfile-ray-node .
kind load docker-image ray:test
docker image rm ray:test
- name: Install helm chart
run: |
cd charts/quantum-serverless
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add kuberay https://ray-project.github.io/kuberay-helm
helm dependency build
helm install qs \
--set platform=kind \
--set repositoryEnable=false \
--set nginxIngressControllerEnable=false \
--set gateway.image.repository=gateway \
--set gateway.image.tag=test \
--set gateway.application.ray.nodeImage=ray:test \
--set gateway.application.limits.keepClusterOnComplete=false \
.
- name: setup python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
cd client
pip install . --no-cache-dir
pip install --no-cache-dir \
ipywidgets==8.1.0 \
circuit-knitting-toolbox==0.2.0 \
matplotlib==3.7.1 \
pyscf==2.2.1 \
scipy==1.10 \
qiskit-ibmq-provider==0.20.2 \
qiskit-aer==0.12.0 \
certifi==2023.7.22
pip install nbmake pytest
- name: Run notebooks
run: |
kubectl patch svc gateway -p '{"spec": {"type": "LoadBalancer"}}'
export GATEWAY_HOST="http://$(kubectl get svc gateway -o jsonpath="{.status.loadBalancer.ingress[0].ip}"):8000"
echo $GATEWAY_HOST
pytest --nbmake /home/runner/work/quantum-serverless/quantum-serverless/docs/getting_started/basic/
pytest --nbmake /home/runner/work/quantum-serverless/quantum-serverless/docs/getting_started/experimental/
- name: Echo gateway logs
if: ${{ failure() }}
run: |
GATEWAY=$(kubectl get pods --no-headers -o custom-columns=":metadata.name" | grep gateway)
kubectl logs $GATEWAY
- name: Echo scheduler logs
if: ${{ failure() }}
run: |
SCHEDULER=$(kubectl get pods --no-headers -o custom-columns=":metadata.name" | grep scheduler)
kubectl logs $SCHEDULER
- uses: chainguard-dev/actions/kind-diag@main
# Only upload logs on failure.
if: ${{ failure() }}
with:
cluster-resources: nodes,namespaces,crds
namespace-resources: configmaps,pods,svc,pvc
artifact-name: logs-${{ github.run_id }}

0 comments on commit 8154cae

Please sign in to comment.