From 43365304e59d8c124a18ccaaa74b5bc5f3d5d180 Mon Sep 17 00:00:00 2001 From: wvengen Date: Thu, 15 Feb 2024 09:27:04 +0100 Subject: [PATCH] Add CI for Kubernetes --- .github/workflows/test-k8s.yml | 41 ++++++++++++++++++++++++++++++++++ scrapyd_k8s.sample-k8s.conf | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test-k8s.yml diff --git a/.github/workflows/test-k8s.yml b/.github/workflows/test-k8s.yml new file mode 100644 index 0000000..77ce67a --- /dev/null +++ b/.github/workflows/test-k8s.yml @@ -0,0 +1,41 @@ +name: Tests on Docker +on: + push: + pull_request: + +jobs: + container: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.11 + cache: 'pip' + + - name: Install dependencies + run: | + pip install -r requirements.txt + pip install -r requirements-test.txt + + - name: Start minikube + uses: medyagh/setup-minikube@master + + - name: Prepare Kubernetes environment + run: | + kubectl create namespace scrapyd + kubectl create secret -n scrapyd generic example-env-secret --from-literal=FOO_1=bar + kubectl create configmap -n scrapyd example-env-secret --from-literal=FOO_2=baz + + - name: Run scrapyd-k8s + run: | + cp scrapyd_k8s.sample-k8s.conf scrapyd_k8s.conf + python -m scrapyd_k8s & + sleep 1 + curl http://localhost:6800/daemonstatus.json + + - name: Run tests + run: pytest -vv test_api.py diff --git a/scrapyd_k8s.sample-k8s.conf b/scrapyd_k8s.sample-k8s.conf index 1e0c09d..1244240 100644 --- a/scrapyd_k8s.sample-k8s.conf +++ b/scrapyd_k8s.sample-k8s.conf @@ -12,7 +12,7 @@ launcher = scrapyd_k8s.launcher.K8s # Namespace to work in (needs to exist). namespace = scrapyd # Optional pull secret, in case you have private spiders. -pull_secret = ghcr-registry +#pull_secret = ghcr-registry # For each project, define a project section. # This contains a repository that points to the remote container repository.