k8s: fix #152
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test with Kubernetes | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: '0 10 * * 3' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# transporter: [NATS, Redis, MQTT, AMQP, AMQP10, Kafka] | |
transporter: [NATS, Redis, MQTT, AMQP, Kafka] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js with ${{ matrix.transporter }} transporter | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22.x | |
- name: Install dependencies | |
run: npm i | |
- name: Create answers file | |
run: node update-answers.js | |
working-directory: ./test/ci | |
env: | |
TRANSPORTER: ${{ matrix.transporter }} | |
- name: Generate project with '${{ matrix.transporter }}' transporter | |
run: npm test | |
- name: Run tests in the generated project | |
run: npm test | |
working-directory: ./ci-test | |
- name: Build Docker image | |
run: docker build -t ci-test . | |
working-directory: ./ci-test | |
- uses: engineerd/[email protected] | |
with: | |
version: "v0.29.0" | |
config: ./test/ci/kind-config.yaml | |
- run: kubectl cluster-info | |
- run: kubectl get nodes | |
- run: kubectl get pods --all-namespaces | |
- name: Load built image | |
run: kind load docker-image ci-test | |
- name: Install NGINX Ingress | |
run: | | |
kubectl apply -f https://kind.sigs.k8s.io/examples/ingress/deploy-ingress-nginx.yaml | |
kubectl wait --namespace ingress-nginx \ | |
--for=condition=ready pod \ | |
--selector=app.kubernetes.io/component=controller \ | |
--timeout=90s | |
# kubectl patch deployments -n ingress-nginx ingress-nginx-controller -p '{"spec":{"template":{"spec":{"containers":[{"name":"nginx-ingress-controller","ports":[{"containerPort":80,"hostPort":80},{"containerPort":443,"hostPort":443}]}],"nodeSelector":{"ingress-ready":"true"},"tolerations":[{"key":"node-role.kubernetes.io/master","operator":"Equal","effect":"NoSchedule"}]}}}}' | |
- name: Kubectl apply | |
working-directory: ./ci-test | |
run: | | |
kubectl apply -f k8s.yaml | |
kubectl rollout status deployment greeter --timeout=180s | |
- name: Sleeping 90 secs (for Redis, Mongo...etc) | |
run: sleep 90 | |
- name: Check pods | |
run: | | |
kubectl get all | |
- run: curl --silent --show-error --fail http://ci-test.127.0.0.1.nip.io/api/greeter/hello | |
- run: curl --silent --show-error --fail http://ci-test.127.0.0.1.nip.io/api/products | |
- run: | | |
curl --silent --show-error --fail -H "Content-Type: application/json" --data '{"query": "query { hello } "}' http://ci-test.127.0.0.1.nip.io/graphql | |
- name: Check Pod | |
run: kubectl describe pod greeter | |
if: failure() | |
- name: Check logs | |
run: kubectl logs deployment/greeter | |
if: failure() |