Skip to content

Commit

Permalink
feat: add worflow for cluster and lighthouse tests to GHA (#3033)
Browse files Browse the repository at this point in the history
* feat: add worflow for cluster tests

* feat: change names of the workflows

* feat: add worflow for lighthouse test and fix paths

* fix: path to kubeconfig

* fix: artifacts

* feat: remove uploading artifacts

* feat: rename of the jobs

* fix: fix rename run

* test
  • Loading branch information
mrCherry97 authored Jul 5, 2024
1 parent dc381b7 commit a941e6a
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 8 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/busola-local-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: busola-local-build
name: Busola Local Build

on:
push:
Expand Down Expand Up @@ -31,16 +31,16 @@ permissions:
contents: read # This is required for actions/checkout

jobs:
build-image:
build-local-image:
uses: kyma-project/test-infra/.github/workflows/image-builder.yml@main # Usage: kyma-project/test-infra/.github/workflows/image-builder.yml@main
with:
name: busola
dockerfile: Dockerfile.local
context: .
export-tags: true
test-image:
test-local-image:
runs-on: ubuntu-latest
needs: build-image
needs: build-local-image
steps:
- name: Test image
run: echo "Testing images ${{ needs.build-image.outputs.images }}"
run: echo "Testing images ${{ needs.build-local-image.outputs.images }}"
74 changes: 74 additions & 0 deletions .github/workflows/pull-integration-cluster-k3d.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: PR Integration Cluster Tests

on:
pull_request:
types: [opened, edited, synchronize, reopened, ready_for_review]
paths:
- ".github/workflows/pull-integration-cluster-k3d.yml"
- "resources/**"
- "tests/**"
- "nginx/**"
- "src/**"

jobs:
run-cluster-test:
runs-on: ubuntu-latest
steps:
- uses: gardenlinux/workflow-telemetry-action@v2
with:
comment_on_pr: false
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create Single Cluster
uses: AbsaOSS/k3d-action@4e8b3239042be1dc0aed6c5eb80c13b18200fc79 #v2.4.0
with:
cluster-name: "k3dCluster"
args: >-
--agents 1
--port 80:80@loadbalancer
--port 443:443@loadbalancer
--wait
- uses: actions/setup-node@v4
with:
node-version: 20
- name: setup_busola
shell: bash
run: |
set -e
npm ci
npm run build
npm i -g serve
- name: run_tests
shell: bash
run: |
k3d kubeconfig get k3dCluster > tests/integration/fixtures/kubeconfig.yaml
export CYPRESS_DOMAIN=http://localhost:3000
serve -s build > busola.log &
pushd backend
npm start > backend.log &
popd
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
cd tests/integration
npm ci && npm run "test:cluster"
- name: Uploads artifacts
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: cypress-${{ github.job }}
path: tests/integration/cypress/
retention-days: 90
- name: Upload Busola logs
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: busola-logs-${{ github.job }}
path: |
backend/backend.log
busola.log
retention-days: 90
5 changes: 2 additions & 3 deletions .github/workflows/pull-integration-namespace-k3d.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: pull-integration-namespace-k3d
name: PR Integration Namespace Tests

on:
pull_request:
Expand All @@ -9,10 +9,9 @@ on:
- "tests/**"
- "nginx/**"
- "src/**"
- "tests/**"

jobs:
run-test:
run-namespace-test:
runs-on: ubuntu-latest
steps:
- uses: gardenlinux/workflow-telemetry-action@v2
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/pull-lighthouse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: PR Lighthouse Test

on:
pull_request:
types: [opened, edited, synchronize, reopened, ready_for_review]
paths:
- ".github/workflows/pull-lighthouse.yml"
- "resources/**"
- "tests/**"
- "nginx/**"
- "src/**"

jobs:
run-lighthouse-test:
runs-on: ubuntu-latest
steps:
- uses: gardenlinux/workflow-telemetry-action@v2
with:
comment_on_pr: false
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create Single Cluster
uses: AbsaOSS/k3d-action@4e8b3239042be1dc0aed6c5eb80c13b18200fc79 #v2.4.0
with:
cluster-name: "k3dCluster"
args: >-
--agents 1
--port 80:80@loadbalancer
--port 443:443@loadbalancer
--wait
- uses: actions/setup-node@v4
with:
node-version: 20
- name: setup_busola
shell: bash
run: |
set -e
npm ci
npm run build
npm i -g serve
- name: run_tests
shell: bash
run: |
k3d kubeconfig get k3dCluster > tests/lighthouse/fixtures/kubeconfig.yaml
export DOMAIN=http://localhost:3000
serve -s build > busola.log &
pushd backend
npm start > backend.log &
popd
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
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: busola-logs-${{ github.job }}
path: |
backend/backend.log
busola.log
retention-days: 90

0 comments on commit a941e6a

Please sign in to comment.