@@ -20,86 +20,16 @@ jobs:
2020 pull-requests : read
2121
2222 steps :
23- - name : Get PR details if triggered by workflow_dispatch with pr_number
24- id : get-pr-details
25- if : github.event_name == 'workflow_dispatch' && github.event.inputs.pr_number != ''
26- run : |
27- PR_NUMBER=${{ github.event.inputs.pr_number }}
28- API_URL="${{ github.api_url }}/repos/${{ github.repository }}/pulls/${PR_NUMBER}"
29- PR_INFO=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github.v3+json" "$API_URL")
30-
31- PR_HEAD_SHA=$(echo "$PR_INFO" | jq -r '.head.sha')
32- PR_URL=$(echo "$PR_INFO" | jq -r '.html_url')
33-
34- echo "PR Head SHA: $PR_HEAD_SHA"
35- echo "PR URL: $PR_URL"
36- echo "pr_head_sha=$PR_HEAD_SHA" >> $GITHUB_ENV
37- echo "pr_url=$PR_URL" >> $GITHUB_ENV
38-
39- - name : Checkout code
40- uses : actions/checkout@v3
41- with :
42- ref : ${{ env.pr_head_sha || github.ref }}
43-
44- - name : Set up Node.js
45- uses : actions/setup-node@v4
46- with :
47- node-version : 22
48- cache : " npm"
49-
50- - name : Install front-end dependencies
51- run : npm ci
52-
53- - name : Install playwright
54- run : npx playwright install --with-deps
55-
56- # This prevents an error related to minimum watchers when running the front-end and playwright
57- - name : Increase file watchers limit
58- run : echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
59-
60- - name : Update /etc/hosts
61- run : sudo npm run patch:hosts
62-
63- - name : Start front-end server
64- run : |
65- npm run start:federated &
66- npx wait-on http://localhost:8003/apps/image-builder/
67-
68- - name : Run testing proxy
69- run : docker run -d --network=host -e HTTPS_PROXY=$RH_PROXY_URL -v "$(pwd)/config:/config:ro,Z" --name frontend-development-proxy quay.io/redhat-user-workloads/hcc-platex-services-tenant/frontend-development-proxy
70-
7123 - name : Run front-end Playwright tests
7224 id : playwright-tests
7325 env :
7426 BASE_URL : https://stage.foo.redhat.com:1337
7527 run : |
76- export PLAYWRIGHT_USER=image-builder-playwright-$RANDOM
77- export PLAYWRIGHT_PASSWORD=image-builder-playwright-$(uuidgen)
78- # Step 1: Create a new empty account
79- curl -k -X POST https://account-manager-stage.app.eng.rdu2.redhat.com/account/new -d "{\"username\": \"$PLAYWRIGHT_USER\", \"password\":\"$PLAYWRIGHT_PASSWORD\"}"
80- # Step 2: Attach subscriptions to the new account
81- curl -k -X POST https://account-manager-stage.app.eng.rdu2.redhat.com/account/attach \
82- -d "{\"username\": \"$PLAYWRIGHT_USER\", \"password\":\"$PLAYWRIGHT_PASSWORD\", \"sku\":[\"RH00003\"],\"quantity\": 1}"
83- # Step 3: Activate the new account by accepting Terms and Conditions
84- curl -k -X POST https://account-manager-stage.app.eng.rdu2.redhat.com/account/activate -d "{\"username\": \"$PLAYWRIGHT_USER\", \"password\":\"$PLAYWRIGHT_PASSWORD\"}"
85- # Step 4: Refresh account to update subscription pools
86- curl -k -X POST https://account-manager-stage.app.eng.rdu2.redhat.com/account/refresh -d "{\"username\": \"$PLAYWRIGHT_USER\", \"password\":\"$PLAYWRIGHT_PASSWORD\"}"
87- # Step 5: View account to check account status
88- curl -k -X GET "https://account-manager-stage.app.eng.rdu2.redhat.com/account/get?username=$PLAYWRIGHT_USER&password=$PLAYWRIGHT_PASSWORD"
89-
90- CURRENTS_PROJECT_ID=hIU6nO CURRENTS_RECORD_KEY=$CURRENTS_RECORD_KEY npx playwright test playwright/BootTests
91-
92- - name : Store front-end Test report
93- uses : actions/upload-artifact@v4
94- if : always()
95- with :
96- name : playwright-report
97- path : playwright-report/
98- retention-days : 10
28+ exit 1
9929
10030 - name : Notify Slack on success
10131 uses : slackapi/slack-github-action@v2.1.1
102- if : github.event_name != 'workflow_dispatch' && steps.playwright-tests.outcome == 'success'
32+ if : steps.playwright-tests.outcome == 'success'
10333 with :
10434 webhook : ${{ secrets.SLACK_WEBHOOK_URL }}
10535 webhook-type : incoming-webhook
12353
12454 - name : Notify Slack on failure
12555 uses : slackapi/slack-github-action@v2.1.1
126- if : github.event_name != 'workflow_dispatch' && steps.playwright-tests.outcome != 'success'
56+ if : steps.playwright-tests.outcome != 'success'
12757 with :
12858 webhook : ${{ secrets.SLACK_WEBHOOK_URL }}
12959 webhook-type : incoming-webhook
0 commit comments