Skip to content

Commit

Permalink
chore: get playwright working again
Browse files Browse the repository at this point in the history
  • Loading branch information
casibbald committed Jan 16, 2025
1 parent 25dece3 commit 927649c
Show file tree
Hide file tree
Showing 15 changed files with 109 additions and 107 deletions.
210 changes: 106 additions & 104 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ name: Playwright Tests

on:
push:
branches: "disabled"
branches: "**"
pull_request:
branches: "**"
# schedule:
# - cron: "30 22 * * *"
workflow_dispatch:
Expand Down Expand Up @@ -33,7 +35,7 @@ jobs:
contents: read

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name : Set URL environment Variable
run: |
echo "URL=http://localhost:8000" >> $GITHUB_ENV
Expand Down Expand Up @@ -94,114 +96,114 @@ jobs:
- name: Setup management cluster
run: |
./utils/scripts/mgmt-cluster-setup.sh ${{ env.MANAGEMENT_CLUSTER_TYPE }} $(pwd) ${{ env.CLUSTER_NAME }}
./playwright/utils/scripts/mgmt-cluster-setup.sh ${{ env.MANAGEMENT_CLUSTER_TYPE }} $(pwd) ${{ env.CLUSTER_NAME }}
- name: Extract branch name
run: |
echo "branch_name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Setup wego enterprise
run: |
kubectl create namespace flux-system
flux install
kubectl create secret generic git-provider-credentials -n flux-system --from-literal=username="weave-gitops-bot" --from-literal=password="${WEAVEWORKS_BOT_TOKEN}"
sed -i 's/BRANCH_NAME/${{ steps.extract_branch.outputs.branch_name }}/' ./utils/scripts/resources/flux-system-gitrepo.yaml
./utils/scripts/wego-enterprise.sh setup ./utils/scripts
- name: Install violating-app
run: |
kubectl apply -f ./utils/data/violating-podinfo-kustomization.yaml
- name: Install policies
run: |
kubectl apply -f ./utils/data/policies.yaml
- name: Flux reconcile violating app
run: |
flux reconcile kustomization violating-podinfo -n default --with-source || true
kubectl get pods -A
- name: Install gitopsset-configmaps
run: |
kubectl apply -f ./utils/data/gitops-sets-kustomization.yaml
- name: run tests
if: success()
run: |
pytest -s -v --video=retain-on-failure --screenshot=only-on-failure --template=html1/index.html --report=test-results/test-run-report.html -o junit_family=xunit2 --junit-xml=test-results/junit_test_report.xml
- name: Generate tests report
if: always()
uses: pmeier/pytest-results-action@main
with:
path: test-results/junit_test_report.xml
summary: true
display-options: fEX
fail-on-empty: true

- name: Upload test report
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
if: success() || failure()
with:
name: playwright-tests-report
path: test-results/
retention-days: 3

- name: Download test artifacts
uses: actions/download-artifact@v4.1.8
if: success() || failure()
with:
name: playwright-tests-report
path: test-results/

- name: Display structure of downloaded files
if: always()
run: ls -R
working-directory: test-results

- name: Publish test report
id: test_summary
uses: mikepenz/action-junit-report@v5.2.0
if: success() || failure()
with:
report_paths: test-results/junit_test_report.xml

- name: Notify Slack
id: slack
uses: slackapi/slack-github-action@v2.0.0
with:
channel-id: C058RPVS5DZ
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Tests result:*"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Tests :test_tube:\t\t\tPassed :check:\t\t\tSkipped :arrow_right_hook:\t\t\tFailed :x:\n>executed:*${{steps.test_summary.outputs.total}}*\t\t\tpassed:*${{steps.test_summary.outputs.passed}}*\t\t\tskipped:*${{steps.test_summary.outputs.skipped}}*\t\t\tfailed:*${{steps.test_summary.outputs.failed}}*"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*View result on Github:* ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
}
]
}
if: always()
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
# - name: Setup wego enterprise
# run: |
# kubectl create namespace flux-system
# flux install
# kubectl create secret generic git-provider-credentials -n flux-system --from-literal=username="weave-gitops-bot" --from-literal=password="${WEAVEWORKS_BOT_TOKEN}"
# sed -i 's/BRANCH_NAME/${{ steps.extract_branch.outputs.branch_name }}/' ./utils/scripts/resources/flux-system-gitrepo.yaml
# ./utils/scripts/wego-enterprise.sh setup ./utils/scripts
#
# - name: Install violating-app
# run: |
# kubectl apply -f ./utils/data/violating-podinfo-kustomization.yaml
#
# - name: Install policies
# run: |
# kubectl apply -f ./utils/data/policies.yaml
#
# - name: Flux reconcile violating app
# run: |
# flux reconcile kustomization violating-podinfo -n default --with-source || true
# kubectl get pods -A
#
# - name: Install gitopsset-configmaps
# run: |
# kubectl apply -f ./utils/data/gitops-sets-kustomization.yaml
#
# - name: run tests
# if: success()
# run: |
# pytest -s -v --video=retain-on-failure --screenshot=only-on-failure --template=html1/index.html --report=test-results/test-run-report.html -o junit_family=xunit2 --junit-xml=test-results/junit_test_report.xml
#
# - name: Generate tests report
# if: always()
# uses: pmeier/pytest-results-action@main
# with:
# path: test-results/junit_test_report.xml
# summary: true
# display-options: fEX
# fail-on-empty: true
#
# - name: Upload test report
# uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
# if: success() || failure()
# with:
# name: playwright-tests-report
# path: test-results/
# retention-days: 3
#
# - name: Download test artifacts
# uses: actions/download-artifact@v4.1.8
# if: success() || failure()
# with:
# name: playwright-tests-report
# path: test-results/
#
# - name: Display structure of downloaded files
# if: always()
# run: ls -R
# working-directory: test-results
#
# - name: Publish test report
# id: test_summary
# uses: mikepenz/action-junit-report@v5.2.0
# if: success() || failure()
# with:
# report_paths: test-results/junit_test_report.xml
#
# - name: Notify Slack
# id: slack
# uses: slackapi/slack-github-action@v2.0.0
# with:
# channel-id: C058RPVS5DZ
# payload: |
# {
# "blocks": [
# {
# "type": "section",
# "text": {
# "type": "mrkdwn",
# "text": "*Tests result:*"
# }
# },
# {
# "type": "section",
# "text": {
# "type": "mrkdwn",
# "text": "Tests :test_tube:\t\t\tPassed :check:\t\t\tSkipped :arrow_right_hook:\t\t\tFailed :x:\n>executed:*${{steps.test_summary.outputs.total}}*\t\t\tpassed:*${{steps.test_summary.outputs.passed}}*\t\t\tskipped:*${{steps.test_summary.outputs.skipped}}*\t\t\tfailed:*${{steps.test_summary.outputs.failed}}*"
# }
# },
# {
# "type": "section",
# "text": {
# "type": "mrkdwn",
# "text": "*View result on Github:* ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
# }
# }
# ]
# }
# if: always()
# env:
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
# SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

- name : Delete test cluster
if: success() || failure()
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions playwright/utils/scripts/mgmt-cluster-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function setup_gke {

export CLUSTER_NAME=${args[2]}
export CLUSTER_REGION=${args[3]}
export CLUSTER_VERSION=1.23.13
export CLUSTER_VERSION=1.31.0

export CLUSTER_EXISTS=$(gcloud container clusters list | grep -i $CLUSTER_NAME)
if [ -z $CLUSTER_EXISTS ]; then
Expand Down Expand Up @@ -129,7 +129,7 @@ function setup_kind {

export CLUSTER_NAME=${args[2]}

kind create cluster --name $CLUSTER_NAME --image=kindest/node:v1.23.4 --config ${args[1]}/utils/data/kind/local-kind-config.yaml
kind create cluster --name $CLUSTER_NAME --image=kindest/node:v1.31.0 --config ${args[1]}/utils/data/kind/local-kind-config.yaml
kubectl wait --for=condition=Ready --timeout=120s -n kube-system pods --all
kubectl get pods -A
exit 0
Expand All @@ -141,4 +141,4 @@ elif [ ${args[0]} = 'gke' ]; then
setup_gke
elif [ ${args[0]} = 'kind' ]; then
setup_kind
fi
fi
File renamed without changes.
File renamed without changes.

0 comments on commit 927649c

Please sign in to comment.