Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload playwright tests results in PR #187

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Tests
on:
push:
branches: [main, master, overlay2-rework]
branches: [main]
pull_request:
branches: [main, master, overlay2-rework]
branches: [main]
jobs:
test:
timeout-minutes: 20
Expand Down Expand Up @@ -54,6 +54,33 @@ jobs:
- name: Build with gradle
run: ./gradlew build release apiCheck --scan -Pnpm.download=false

- name: PR playwright - upload
id: pr_playwright-upload
if: github.event.pull_request.number != '' && hashFiles('./src/frontend/tests/playwright-report') != ''
working-directory: ./src/frontend/tests/playwright-report/data
env:
# using [email protected] IMGBB acount
IMGBB_API_TOKEN: ${{ secrets.IMGBB_API_TOKEN }}
run: |
ls *.png | \
xargs -i curl -s -P1 --location --request POST "https://api.imgbb.com/1/upload?expiration=604800&key=$IMGBB_API_TOKEN" --form "image=@{}" | \
jq -r '.data.url' | paste -sd "," - | awk '{print "pr_playwright-images="$0 }' >> "$GITHUB_OUTPUT"

- name: PR playwright - comment
uses: actions/github-script@v7
if: github.event.pull_request.number != '' && hashFiles('./src/frontend/tests/playwright-report') != ''
with:
script: |
const images_grid = '${{steps.pr_playwright-upload.outputs.pr_playwright-images}}'
.split(',').map(i => '<img src="' + i + '" width="400" />').join(' ');

github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Playwright tests screens\n\n<p float="left">' + images_grid + '</p>'
});

- uses: actions/upload-artifact@v3
if: always()
with:
Expand Down
Loading