diff --git a/.github/scripts/setup_local_busola.sh b/.github/scripts/setup_local_busola.sh new file mode 100755 index 0000000000..2dd77374d8 --- /dev/null +++ b/.github/scripts/setup_local_busola.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# This script returns the id of the draft release + +# standard bash error handling +set -o nounset # treat unset variables as an error and exit immediately. +set -o errexit # exit immediately when a command fails. +set -E # needs to be set if we want the ERR trap +set -o pipefail # prevents errors in a pipeline from being masked + +npm ci +npm run build +cp -r build backend/core-ui +cd backend +npm run build +IS_DOCKER=true npm run start:prod > busola.log & +export DOMAIN=http://localhost:3001 +echo "waiting for server to be up..." +while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' "$DOMAIN")" != "200" ]]; do sleep 5; done \ No newline at end of file diff --git a/.github/workflows/pull-integration-cluster-k3d.yml b/.github/workflows/pull-integration-cluster-k3d.yml index f863006283..5dc3be0825 100644 --- a/.github/workflows/pull-integration-cluster-k3d.yml +++ b/.github/workflows/pull-integration-cluster-k3d.yml @@ -1,8 +1,8 @@ name: PR Integration Cluster Tests -on: +on: pull_request: - types: [opened, edited, synchronize, reopened, ready_for_review] + types: [ opened, edited, synchronize, reopened, ready_for_review ] paths: - ".github/workflows/pull-integration-cluster-k3d.yml" - "resources/**" @@ -39,26 +39,15 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 20 - - name: setup_busola + - name: Setup Busola shell: bash run: | - set -e - npm ci - npm run build - cp -r build backend/core-ui - cd backend - npm run build - IS_DOCKER=true npm run start:prod > busola.log & + .github/scripts/setup-local_busola.sh - name: run_tests shell: bash run: | k3d kubeconfig get k3dCluster > tests/integration/fixtures/kubeconfig.yaml - export CYPRESS_DOMAIN=http://localhost:3001 - - echo "waiting for server to be up..." - while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' "$CYPRESS_DOMAIN")" != "200" ]]; do sleep 5; done - sleep 10 - + export CYPRESS_DOMAIN=http://localhost:3001 cd tests/integration npm ci && npm run "test:cluster" - name: Uploads artifacts diff --git a/.github/workflows/pull-integration-namespace-k3d.yml b/.github/workflows/pull-integration-namespace-k3d.yml index ac4f0c5223..b43d379daa 100644 --- a/.github/workflows/pull-integration-namespace-k3d.yml +++ b/.github/workflows/pull-integration-namespace-k3d.yml @@ -39,26 +39,15 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 20 - - name: setup_busola + - name: Setup Busola shell: bash run: | - set -e - npm ci - npm run build - cp -r build backend/core-ui - cd backend - npm run build - IS_DOCKER=true npm run start:prod > busola.log & - - name: run_tests + .github/scripts/setup-local_busola.sh + - name: Run tests shell: bash run: | - k3d kubeconfig get k3dCluster > tests/integration/fixtures/kubeconfig.yaml export CYPRESS_DOMAIN=http://localhost:3001 - - echo "waiting for server to be up..." - while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' "$CYPRESS_DOMAIN")" != "200" ]]; do sleep 5; done - sleep 10 - + k3d kubeconfig get k3dCluster > tests/integration/fixtures/kubeconfig.yaml cd tests/integration npm ci && npm run "test:namespace" - name: Uploads artifacts diff --git a/.github/workflows/pull-kyma-integration-tests.yml b/.github/workflows/pull-kyma-integration-tests.yml index d28ef27b9d..d06ac02d0b 100644 --- a/.github/workflows/pull-kyma-integration-tests.yml +++ b/.github/workflows/pull-kyma-integration-tests.yml @@ -32,13 +32,13 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 20 - - name: setup_busola + - name: Setup Busola shell: bash run: | - ./.github/scripts/setup-busola.sh | tee busola-build.log + .github/scripts/setup-local_busola.sh env: ENV: dev - - name: run_tests + - name: Run tests shell: bash run: | k3d kubeconfig get kyma > tests/integration/fixtures/kubeconfig.yaml diff --git a/.github/workflows/pull-lighthouse.yml b/.github/workflows/pull-lighthouse.yml index 5cd64acba7..b176ff5ffd 100644 --- a/.github/workflows/pull-lighthouse.yml +++ b/.github/workflows/pull-lighthouse.yml @@ -32,26 +32,14 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 20 - - name: setup_busola + - name: Run busola shell: bash run: | - set -e - npm ci - npm run build - cp -r build backend/core-ui - cd backend - npm run build - IS_DOCKER=true npm run start:prod > busola.log & - - name: run_tests + .github/scripts/setup-local_busola.sh + - name: Run lighthouse tests shell: bash run: | k3d kubeconfig get k3dCluster > tests/lighthouse/fixtures/kubeconfig.yaml - export DOMAIN=http://localhost:3001 - - echo "waiting for server to be up..." - while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' "$DOMAIN")" != "200" ]]; do sleep 5; done - sleep 10 - cd tests/lighthouse npm ci && npx playwright install --with-deps && npm run "test" - name: Upload Busola logs diff --git a/tests/lighthouse/lighthouse.spec.js b/tests/lighthouse/lighthouse.spec.js index 439be72bae..3205ecff14 100644 --- a/tests/lighthouse/lighthouse.spec.js +++ b/tests/lighthouse/lighthouse.spec.js @@ -3,7 +3,10 @@ import { playAudit } from 'playwright-lighthouse'; import { chromium } from 'playwright'; import { tmpdir } from 'os'; -const ADDRESS = 'http://localhost:3001'; +const ADDRESS = process.env.LOCAL + ? 'http://localhost:8080' + : 'http://localhost:3001'; +// What to do with that test('Busola Lighthouse audit', async () => { const context = await chromium.launchPersistentContext(tmpdir(), {