Skip to content

Commit

Permalink
ci: 👷 add cypress in kube ci
Browse files Browse the repository at this point in the history
  • Loading branch information
this-is-tobi committed Jul 21, 2023
1 parent ff14d70 commit fb39805
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
25 changes: 18 additions & 7 deletions .github/workflows/test-kube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ on:
branches:
- 'enh/kube'


jobs:
test-app-k8s:
runs-on: ubuntu-latest
env:
LOCAL_DOMAIN: basegun.kubernetes.local
steps:
- name: Start minikube
uses: medyagh/setup-minikube@latest
Expand All @@ -25,11 +26,11 @@ jobs:
- name: Add hosts to /etc/hosts
run: |
MINIKUBE_IP="$(minikube ip)"
sudo echo "$MINIKUBE_IP basegun.kubernetes.local" | sudo tee -a /etc/hosts
sudo echo "$MINIKUBE_IP $LOCAL_DOMAIN" | sudo tee -a /etc/hosts
# we are forced to attribute a DNS to kube cluster for it to work properly

- name: Checkout to code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Build and install basegun with helm, and test if deployment is successful
id: tests
Expand All @@ -41,7 +42,7 @@ jobs:
TAG=$(make get-current-tag) BUILD_TARGET=test docker-compose -f docker-compose-prod.yml build backend
TAG=$(make get-current-tag) docker-compose -f docker-compose-prod.yml build frontend
helm upgrade --install basegun ./infra/kube/helm/ \
--set ingress.hosts[0].host="basegun.kubernetes.local" \
--set ingress.hosts[0].host="$LOCAL_DOMAIN" \
--set ingress.hosts[0].paths[0].path="/" \
--set ingress.hosts[0].paths[0].pathType="Prefix" \
--set backend.image.repository="basegun-backend" \
Expand All @@ -67,7 +68,17 @@ jobs:
- name: Test unitests on backend
run : |
kubectl exec deploy/basegun-backend -c basegun-backend -- python -m unittest discover -v
- name: Setup nodejs (for cypress)
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'

- name: Test frontend is alive
run: |
[[ "$(curl -L -s basegun.kubernetes.local/api/version)" == $(make get-current-tag) ]] || exit 1
- name: Install npm packages (for cypress)
run: npm ci
working-directory: ./frontend

- name: Test end to end
run: FRONTEND_HOST=$LOCAL_DOMAIN FRONTEND_PORT=80 npm run test:e2e-ci
working-directory: ./frontend
3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"format:css": "stylelint --fix src/**/*.{css,vue}",
"pretest:unit": "npm run lint",
"test:e2e": "start-server-and-test preview http://localhost:4173 'cypress run --e2e --browser firefox'",
"test:e2e-ci": "cypress run --e2e --browser firefox",
"test:e2e-dev": "API_HOST=localhost start-server-and-test 'vite --port 4173' http://localhost:4173 'cypress open --e2e'"
},
"dependencies": {
Expand Down Expand Up @@ -54,6 +55,6 @@
"not dead"
],
"volta": {
"node": "18.14.0"
"node": "18.16.1"
}
}

0 comments on commit fb39805

Please sign in to comment.