Skip to content

feat: field ui component (#2625) #576

feat: field ui component (#2625)

feat: field ui component (#2625) #576

Workflow file for this run

name: Run system tests
on:
workflow_dispatch:
push:
branches:
- 'dev'
schedule:
- cron: '0 6 * * *' # 9:00 GMT+3
pull_request:
paths:
- 'tests/**'
env:
CI: true
jobs:
system-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install docker compose
run: sudo apt-get install -y docker-compose
- name: Build compose
run: docker-compose up -d
- name: ⚙️ Install dependencies
uses: ./.github/workflows/install-pnpm
- name: Get installed Playwright version
id: playwright-version
run: |
PLAYWRIGHT_VERSION=$(node -e "console.log(require('yaml').parse(require('fs').readFileSync('./pnpm-lock.yaml', 'utf8')).importers['.'].devDependencies['@playwright/test'].version)")
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
- name: Cache playwright binaries
uses: actions/cache@v3
id: playwright-cache
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
- run: npx playwright install --with-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
- name: Run Playwright tests
if: github.event_name != 'schedule'
run: npx playwright test --grep @regress
- name: Run Playwright tests for schedule event
if: github.event_name == 'schedule'
run: npx playwright test --grep @fee-test
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
publish_report:
name: Publish HTML Report
if: success() || needs.system-tests.result == 'failure'
needs: [system-tests]
runs-on: ubuntu-latest
continue-on-error: true
env:
# Unique URL path for each workflow run attempt
HTML_REPORT_URL_PATH: reports/${{ github.ref_name }}/${{ github.run_id }}/${{ github.run_attempt }}
steps:
- name: Checkout GitHub Pages Branch
uses: actions/checkout@v2
with:
repository: novasamatech/spektr-reports
ref: main
token: ${{ secrets.CREATE_TAG_PAT }}
- name: Set Git User
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Download zipped HTML report
uses: actions/download-artifact@v4
with:
name: playwright-report
path: ${{ env.HTML_REPORT_URL_PATH }}
- name: Push HTML Report
timeout-minutes: 3
# commit report, then try push-rebase-loop until it's able to merge the HTML report to the gh-pages branch
# this is necessary when this job is running at least twice at the same time (e.g. through two pushes at the same time)
run: |
git add .
git commit -m "workflow: add HTML report for run-id ${{ github.run_id }} (attempt: ${{ github.run_attempt }})"
while true; do
git pull --rebase
if [ $? -ne 0 ]; then
echo "Failed to rebase. Please review manually."
exit 1
fi
git push
if [ $? -eq 0 ]; then
echo "Successfully pushed HTML report to repo."
exit 0
fi
done
- name: Output Report URL as Worfklow Annotation
run: |
FULL_HTML_REPORT_URL=https://novasamatech.github.io/spektr-reports/$HTML_REPORT_URL_PATH
echo "::notice title=📋 Published Playwright Test Report::$FULL_HTML_REPORT_URL"
echo "FULL_HTML_REPORT_URL<<EOF" >> $GITHUB_ENV
echo "$FULL_HTML_REPORT_URL" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- run: |
if [ "${{ github.event_name }}" = "schedule" ]; then
COMMIT_INFO="Branch: dev"
RUN_TYPE_INFO="🤑 Fee loading"
else
COMMIT_INFO="Commit: [${{ github.sha }}](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }})"
RUN_TYPE_INFO="✔ Regression"
fi
echo "COMMIT_INFO<<EOF" >> $GITHUB_ENV
echo "$COMMIT_INFO" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "RUN_TYPE_INFO<<EOF" >> $GITHUB_ENV
echo "$RUN_TYPE_INFO" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
shell: bash
- name: Set Status
run: |
if [[ "${{ needs.system-tests.result }}" == 'failure' ]]; then
echo "STATUS=❌" >> $GITHUB_ENV
else
echo "STATUS=✅" >> $GITHUB_ENV
fi
- name: Notify Telegram channel
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
message: |
📋 Playwright Test Report Published
URL: ${{ env.FULL_HTML_REPORT_URL }}
Run type: ${{ env.RUN_TYPE_INFO }}
Status: ${{ env.STATUS }}
${{ env.COMMIT_INFO }}