Skip to content

Commit

Permalink
feat: add cypress in the CI
Browse files Browse the repository at this point in the history
  • Loading branch information
aldbr committed Apr 2, 2024
1 parent 86ab6a9 commit dd6ebf6
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 112 deletions.
87 changes: 46 additions & 41 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,54 @@ name: Integration Tests

on:
push:
branches: [main_FEAT_integrationtests]
branches: [main]
pull_request:
branches: [main_FEAT_integrationtests]
branches: [main]

defaults:
run:
shell: bash -el {0}
run:
shell: bash -el {0}

jobs:
run-demo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Clone source
run: |
cd ..
git clone -b main_FEAT_update-node-image --single-branch https://github.com/aldbr/diracx-charts.git
- name: Start demo
run: |
cd ..
diracx-charts/run_demo.sh --exit-when-done diracx-web/
- name: Debugging information
run: |
cd ../diracx-charts
export KUBECONFIG=$PWD/.demo/kube.conf
.demo/kubectl get pods
for pod_name in $(.demo/kubectl get pods -o json | jq -r '.items[] | .metadata.name' | grep -vE '(dex|minio|mysql|rabbitmq|opensearch)'); do
echo "${pod_name}"
.demo/kubectl describe pod/"${pod_name}" || true
for container_name in $(.demo/kubectl get pods $pod_name -o jsonpath='{.spec.initContainers[*].name} {.spec.containers[*].name}'); do
echo $pod_name $container_name
.demo/kubectl logs "${pod_name}" -c "${container_name}" || true
done
done
- name: Check for success
run: |
cd ../diracx-charts
if [ ! -f ".demo/.success" ]; then
echo "Demo failed"
cat ".demo/.failed"
exit 1
fi
- name: Start integration tests
run: |
ls -la
run-demo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Clone source
run: |
cd ..
git clone https://github.com/DIRACGrid/diracx-charts.git
- name: Start demo
run: |
cd ..
diracx-charts/run_demo.sh --exit-when-done diracx-web/
- name: Debugging information
run: |
cd ../diracx-charts
export KUBECONFIG=$PWD/.demo/kube.conf
.demo/kubectl get pods
for pod_name in $(.demo/kubectl get pods -o json | jq -r '.items[] | .metadata.name' | grep -vE '(dex|minio|mysql|rabbitmq|opensearch)'); do
echo "${pod_name}"
.demo/kubectl describe pod/"${pod_name}" || true
for container_name in $(.demo/kubectl get pods $pod_name -o jsonpath='{.spec.initContainers[*].name} {.spec.containers[*].name}'); do
echo $pod_name $container_name
.demo/kubectl logs "${pod_name}" -c "${container_name}" || true
done
done
- name: Check for success
run: |
cd ../diracx-charts
if [ ! -f ".demo/.success" ]; then
echo "Demo failed"
cat ".demo/.failed"
exit 1
fi
- name: Set BASE_URL
run: echo "BASE_URL=$(hostname)" >> $GITHUB_ENV

- name: Start Cypress
uses: cypress-io/github-action@v6
with:
browser: chrome
env: BASE_URL=${{ env.BASE_URL }}
1 change: 1 addition & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { defineConfig } from "cypress";
export default defineConfig({
e2e: {
specPattern: "test/e2e/**/*.cy.ts",
supportFile: false,
setupNodeEvents(on, config) {
// implement node event listeners here
},
Expand Down
5 changes: 0 additions & 5 deletions cypress/fixtures/example.json

This file was deleted.

37 changes: 0 additions & 37 deletions cypress/support/commands.ts

This file was deleted.

20 changes: 0 additions & 20 deletions cypress/support/e2e.ts

This file was deleted.

8 changes: 0 additions & 8 deletions cypress/tsconfig.json

This file was deleted.

2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules", "cyrpress", "test/*/*.ts", "test/*/*.tsx", "jest.setup.ts"]
"exclude": ["node_modules", "test/*/*.ts", "test/*/*.tsx", "jest.setup.ts"]
}

0 comments on commit dd6ebf6

Please sign in to comment.