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

fix: refactor test workflow #2913

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
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
33 changes: 0 additions & 33 deletions .github/workflows/build.yaml

This file was deleted.

File renamed without changes.
34 changes: 34 additions & 0 deletions .github/workflows/install-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Install test dependencies

runs:
using: 'composite'
steps:
- name: install docker compose
shell: bash
run: sudo apt-get install -y docker-compose

- name: Build compose
shell: bash
run: docker-compose up -d

- name: Get installed Playwright version
id: playwright-version
shell: bash
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
shell: bash
if: steps.playwright-cache.outputs.cache-hit != 'true'

- name: Install allurectl
uses: allure-framework/setup-allurectl@v1
49 changes: 0 additions & 49 deletions .github/workflows/integration_test_runner.yaml

This file was deleted.

File renamed without changes.
71 changes: 71 additions & 0 deletions .github/workflows/publish-test-results/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Install test dependencies

inputs:
html_report_url_path:
type: string
description: The path to the HTML report
checkout_token:
type: string
description: The token to use for checking out the repository

env:
REPORTS_REPO_PATH: spektr-reports

runs:
using: 'composite'
steps:
- name: Checkout GitHub Pages Branch
uses: actions/checkout@v4
with:
repository: novasamatech/spektr-reports
ref: main
token: ${{ inputs.checkout_token }}
path: ${{ env.REPORTS_REPO_PATH }}

- name: Set Git User
shell: bash
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.REPORTS_REPO_PATH }}/${{ inputs.html_report_url_path }}

- name: Create reports directory
shell: bash
run: mkdir -p ${{ env.REPORTS_REPO_PATH }}/${{ inputs.html_report_url_path }}

- name: Push HTML Report
shell: bash
# 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: |
cd ${{ env.REPORTS_REPO_PATH }}
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
shell: bash
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
169 changes: 0 additions & 169 deletions .github/workflows/system_tests.yml

This file was deleted.

Loading
Loading