From e094bb6f00ea6828683440f705e035d6e9233a65 Mon Sep 17 00:00:00 2001 From: Loxeris <30194187+Loxeris@users.noreply.github.com> Date: Wed, 28 Aug 2024 17:24:06 +0200 Subject: [PATCH] fixup! ci(Gubbins): add extension workflow --- .github/workflows/extension.yml | 110 +++++++++++++------------ .github/workflows/integration-test.yml | 4 - 2 files changed, 58 insertions(+), 56 deletions(-) diff --git a/.github/workflows/extension.yml b/.github/workflows/extension.yml index 6f5a197d..057cb775 100644 --- a/.github/workflows/extension.yml +++ b/.github/workflows/extension.yml @@ -1,60 +1,66 @@ name: Gubbins extension on: - push: - branches-ignore: - - dependabot/** - - release-please-** - pull_request: - branches-ignore: - - release-please-** + push: + branches-ignore: + - dependabot/** + - release-please-** + pull_request: + branches-ignore: + - release-please-** -defaults: - run: - shell: bash -el {0} - jobs: - run-demo: - runs-on: ubuntu-latest - if: github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web' - steps: - - uses: actions/checkout@v4 + run-demo: + runs-on: ubuntu-latest + # Run the tests only if It's a PR or if the repo is DIRACGrid/diracx-web + if: github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web' + steps: + # Checkout the new source code + - uses: actions/checkout@v4 + + # Clone diracx-charts + - name: Clone source + run: | + cd .. + git clone https://github.com/DIRACGrid/diracx-charts.git - - 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/packages/extensions - - 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 + # Runs the demo with the extension source code + - name: Start demo + run: | + cd .. + diracx-charts/run_demo.sh --exit-when-done diracx-web/packages/extensions + + # Prints some debugging information in case something goes wrong + - 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 - - name: Check for success - run: | - cd ../diracx-charts - if [ ! -f ".demo/.success" ]; then - echo "Demo failed" - cat ".demo/.failed" - exit 1 - fi + done - - name: Set DIRACX_URL - run: echo "DIRACX_URL=https://$(ifconfig | grep 'inet ' | awk '{ print $2 }' | grep -v '^127' | head -n 1 | cut -d '/' -f 1).nip.io:8000" >> $GITHUB_ENV - - - name: Start Cypress - uses: cypress-io/github-action@v6 - with: - browser: chrome - config: baseUrl=${{ env.DIRACX_URL }} \ No newline at end of file + - name: Check for success + run: | + cd ../diracx-charts + if [ ! -f ".demo/.success" ]; then + echo "Demo failed" + cat ".demo/.failed" + exit 1 + fi + + # Find the URL to be tested and put it in the github environment + - name: Set DIRACX_URL + run: echo "DIRACX_URL=https://$(ifconfig | grep 'inet ' | awk '{ print $2 }' | grep -v '^127' | head -n 1 | cut -d '/' -f 1).nip.io:8000" >> $GITHUB_ENV + + # Run e2e tests with Cypress + - name: Start Cypress + uses: cypress-io/github-action@v6 + with: + browser: chrome + config: baseUrl=${{ env.DIRACX_URL }} \ No newline at end of file diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index d5455add..4bf4185a 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -9,10 +9,6 @@ on: branches-ignore: - release-please-** -defaults: - run: - shell: bash -el {0} - jobs: run-demo: runs-on: ubuntu-latest