Skip to content

Commit

Permalink
validating browsertime fields and structure
Browse files Browse the repository at this point in the history
  • Loading branch information
7h3Rabbit committed Dec 6, 2024
1 parent a08c73a commit 2f0e809
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/regression-test-sitespeed-browsertime-har.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: "Regression Test - Sitespeed.io - Browsertime.har fields and structure"
on:
workflow_dispatch:
push:
paths:
- '**verify_result.py'
- '**regression-test-sitespeed-browsertime-har.yml'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
browser: ['firefox', 'chrome']
steps:
- uses: actions/checkout@v4
- name: Setup QEMU # used to allow multiplatform docker builds
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx # used to allow multiplatform docker builds
uses: docker/setup-buildx-action@v3
- name: Test includeResponseBodies using ${{ matrix.browser }}
if: always()
run: |
command="docker run --rm -v $(pwd):/sitespeed.io sitespeedio/sitespeed.io:35.7.0 -b ${{ matrix.browser }} -n 1 --chrome.includeResponseBodies html --firefox.includeResponseBodies html https://webperf.se"
echo "$command"
testresult=$($command)
echo "$testresult"
path=$(echo "$testresult" | grep -o "/sitespeed.io/.*")
if [ -n result ]; then
har_file=$(find $(pwd) -name "browsertime.har")
if [ -f "$har_file" ]; then
echo "Found browsertime.har at $har_file"
content=$(cat "$har_file")
if [[ "$content" != *"<!DOCTYPE html>"* ]]; then
echo "Error: browsertime.har is not including html file content"
exit 1
else
echo "browsertime.har is OK"
fi
else
echo "Error: browsertime.har not found in $path"
exit 1
fi
else
echo "Error: No path found starting with /sitespeed.io/"
exit 1
fi
# - name: Check out repository code
# uses: actions/checkout@v4
# - name: Setup python
# uses: actions/setup-python@v5
# with:
# python-version: '3.13' # Version range or exact version of a Python version to use, using SemVer's version range syntax
# architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
# - name: Setup dependencies using pip
# run: pip install -r requirements.txt
# - name: RUNNING TEST - LINUX
# run: |
# python default.py -t ${{ matrix.version }} -r -i defaults/sites.json -o data/testresult-${{ matrix.version }}.json --setting ${{ matrix.config }} --setting tests.sitespeed.xvfb=true
# python .github/workflows/verify_result.py -t ${{ matrix.version }}
2 changes: 2 additions & 0 deletions .github/workflows/update-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ jobs:
Following files may be touched:
- Dockerfile
- .github/workflows/regression-test-sitespeed-browsertime-har.yml
assignees: 7h3Rabbit
reviewers: 7h3Rabbit
add-paths: |
Dockerfile
.github/workflows/regression-test-sitespeed-browsertime-har.yml
11 changes: 11 additions & 0 deletions .github/workflows/verify_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,17 @@ def handle_update_docker():
print('Dockerfile requires update')
set_file_content(our_docker_filepath, our_docker_content)
print('Dockerfile was updated')

our_browsertime_har_yml_filepath = os.path.join(base_directory, '.github', 'workflows', 'regression-test-sitespeed-browsertime-har.yml')
if os.path.exists(our_browsertime_har_yml_filepath):
our_from_os = our_from_os.replace('FROM ', '')
sitespeed_from_os = sitespeed_from_os.replace('FROM ', '')

our_browsertime_har_yml_content = get_file_content(our_browsertime_har_yml_filepath)
our_browsertime_har_yml_content = our_browsertime_har_yml_content.replace(our_from_os, sitespeed_from_os)
print('regression-test-sitespeed-browsertime-har.yml requires update')
set_file_content(our_browsertime_har_yml_filepath, our_browsertime_har_yml_content)
print('regression-test-sitespeed-browsertime-har.yml was updated')
else:
print('Dockerfile is up to date')

Expand Down

0 comments on commit 2f0e809

Please sign in to comment.