Skip to content

Commit

Permalink
Merge branch 'main' into update-version-in-package-json
Browse files Browse the repository at this point in the history
  • Loading branch information
7h3Rabbit authored Jan 28, 2025
2 parents 399e914 + e6ae518 commit 4193c32
Show file tree
Hide file tree
Showing 13 changed files with 68 additions and 85 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.13"]
python-version: ["3.10", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -23,4 +23,4 @@ jobs:
pip install pylint
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py') --generated-members json,ssl,datetime --disable C0114
pylint $(git ls-files '*.py') --generated-members json,ssl,datetime --disable C0114 --errors-only
6 changes: 4 additions & 2 deletions .github/workflows/regression-test-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ jobs:
run: |
version=$(docker run ${{ env.TEST_TAG }} python --version)
echo "Python version: $version"
if [[ "$version" != "Python 3.13"* ]]; then
echo "Error: Default python version is not 3.13 based, was we unable to change default version?"
if [[ "$version" != "Python 3.10"* ]] && [[ "$version" != "Python 3.11"* ]] && [[ "$version" != "Python 3.12"* ]] && [[ "$version" != "Python 3.13"* ]]; then
echo "Error: Default python version is not one of the allowed versions (3.10, 3.11, 3.12, 3.13)"
exit 1
fi
- name: Check if webperf_core help command works
if: always()
run: |
help=$(docker run ${{ env.TEST_TAG }} python default.py -h)
echo "$help"
Expand All @@ -48,6 +49,7 @@ jobs:
exit 1
fi
- name: Check if dependency tool works
if: always()
run: |
help=$(docker run ${{ env.TEST_TAG }} python default.py --dependency)
echo "$help"
Expand Down
62 changes: 31 additions & 31 deletions .github/workflows/verify_browsertime_har.py

Large diffs are not rendered by default.

33 changes: 8 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM sitespeedio/sitespeed.io:36.1.0
FROM sitespeedio/sitespeed.io:36.2.1

USER root

Expand All @@ -24,23 +24,6 @@ RUN apt-get update &&\
update-ca-certificates && \
rm -rf /var/lib/apt/lists/*

# NOTE: Python speed improvements from: https://tecadmin.net/how-to-install-python-3-12-on-ubuntu/
RUN add-apt-repository ppa:deadsnakes/ppa -y

RUN apt update

RUN apt install -y python3.13 python3.13-venv

RUN apt install -y python3-pip

RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.13 311

RUN update-alternatives --config python3

RUN wget https://bootstrap.pypa.io/get-pip.py

RUN python3.13 get-pip.py

RUN apt -y autoremove

# Add user so we don't need --no-sandbox.
Expand All @@ -66,18 +49,18 @@ COPY pa11y-docker-config.json /usr/src/runner/pa11y.json

RUN chown --recursive sitespeedio:sitespeedio /usr/src/runner

RUN python3 -m pip install -r requirements.txt --break-system-packages && \
python3 -m pip install --upgrade pip --break-system-packages && \
python3 -m pip install --upgrade setuptools --break-system-packages && \
python3 -m pip install pyssim Pillow image --break-system-packages

# Run everything after as non-privileged user.
USER sitespeedio

RUN npm install --omit=dev

RUN python3.13 -m pip install -r requirements.txt --break-system-packages && \
python3.13 -m pip install --upgrade pip --break-system-packages && \
python3.13 -m pip install --upgrade setuptools --break-system-packages && \
python3.13 -m pip install pyssim Pillow image --break-system-packages

RUN python3.13 default.py --setting tests.sitespeed.xvfb=true --save-setting settings.json
RUN python3 default.py --setting tests.sitespeed.xvfb=true --save-setting settings.json

ENTRYPOINT []

CMD ["python3.13", "default.py -h"]
CMD ["python3", "default.py -h"]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Webperf.se
Copyright (c) 2020-2025 Webperf.se

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 1 addition & 3 deletions helpers/test_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,7 @@ def get_error_info(url, test_type, ex):
result.extend(get_versions())
result.extend(['###############################################',
'\n# Information:',
f"\nDateTime: { \
datetime.now().strftime('%Y-%m-%d %H:%M:%S') \
}",
f"\nDateTime: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}",
f'\nUrl: {url}',
f'\nTest Type(s): {test_type}',
'\n###############################################'
Expand Down
14 changes: 7 additions & 7 deletions helpers/translation_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def validate_po_file(locales_dir, locale_name, language_sub_directory, file, msg
if not os.path.exists(file_mo):
print(
(f' Expected compiled translation file not found, '
f'file: "{file.replace('.po', '.mo')}"'))
f"file: \"{file.replace('.po', '.mo')}\""))
return False

clear_cache = True
Expand Down Expand Up @@ -304,10 +304,11 @@ def validate_msg_ids(available_languages, msg_ids):
for msg in msg_list:
msg_langs.append(msg['locale_name'])
nof_langs = len(msg_langs)
tmp_str = '","'.join(msg_langs)
if nof_langs < nof_languages:
print(f" # msgid \"{msg_id}\" only in \"{'\",\"'.join(msg_langs)}\"")
print(f" # msgid \"{msg_id}\" only in \"{tmp_str}\"")
else:
print(f" # msgid \"{msg_id}\" occur multiple times \"{'\",\"'.join(msg_langs)}\"")
print(f" # msgid \"{msg_id}\" occur multiple times \"{tmp_str}\"")

if len(msg_ids_with_missing_language) > 0:
is_valid = False
Expand Down Expand Up @@ -477,7 +478,7 @@ def validate_locales(base_directory, msg_ids):

if len(available_languages) > 0:
print('')
print(f' Available Languages: {', '.join(available_languages)}')
print(f" Available Languages: {', '.join(available_languages)}")
else:
print(' No languages found')

Expand Down Expand Up @@ -523,9 +524,8 @@ def validate_locale(msg_ids, locales_dir,
if msgfmt_path is not None:
print(
' - Trying to generate .mo file so it matches .po file')
bash_command = (f"python {msgfmt_path} -o "
f"{os.path.join(lang_sub_directory,
file.replace('.po', '.mo'))} "
bash_command = (f"python {msgfmt_path} -o ",
f"{os.path.join(lang_sub_directory, file.replace('.po', '.mo'))} ",
f"{os.path.join(lang_sub_directory, file)}")

with subprocess.Popen(
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@sitespeed.io/plugin": "1.0.0",
"@sitespeed.io/plugin-lighthouse": "12.3.0",
"pa11y": "8.0.0",
"sitespeed.io": "36.1.0",
"sitespeed.io": "36.2.1",
"stylelint": "16.13.2",
"vnu-jar": "23.4.11",
"webperf-sitespeedio-plugin": "2025.1.4",
Expand All @@ -22,4 +22,4 @@
"engines": {
"node": "20.x"
}
}
}
2 changes: 1 addition & 1 deletion tests/frontend_quality_yellow_lab_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def add_category_ratings(global_translation, local_translation, result_dict):
if 'label' not in rule['policy']:
continue

rule_label = f'- {local_translation(rule['policy']['label'])}'
rule_label = f"- {local_translation(rule['policy']['label'])}"

# only do stuff for rules we know how to place in category
if rule_key in performance_keys:
Expand Down
2 changes: 1 addition & 1 deletion tests/lint_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def get_errors(test_type, params):

if 'https://' not in url and 'http://' not in url:
raise ValueError(
f'Tested url must start with \'https://\' or \'http://\': {url}')
f"Tested url must start with \'https://\' or \'http://\': {url}")

file_path = get_cache_path_for_file(url, True)
if is_html:
Expand Down
16 changes: 8 additions & 8 deletions tests/performance_sitespeed_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def validate_on_mobile_using_validator(url, validator_config):
'--speedIndex true '
'--browsertime.videoParams.createFilmstrip false '
'--browsertime.chrome.args ignore-certificate-errors '
f'-n {get_config('tests.sitespeed.iterations')} '
f"-n {get_config('tests.sitespeed.iterations')} "
'--preScript chrome-custom.cjs '
f'{url}'
f'{browertime_plugin_options}'
Expand Down Expand Up @@ -242,16 +242,16 @@ def get_browsertime_plugin_options(validator_config):
for header in validator_config['headers']:
browertime_plugin_options += (
f' --browsertime.webperf.header0{index}'
f' {header['name'].replace(' ', '%20').replace('=', '%3D')}='
f'{header['value'].replace(' ', '%20').replace('=', '%3D')}')
f" {header['name'].replace(' ', '%20').replace('=', '%3D')}="
f"{header['value'].replace(' ', '%20').replace('=', '%3D')}")
index += 1
if 'htmls' in validator_config:
index = 1
for header in validator_config['htmls']:
browertime_plugin_options += (
f' --browsertime.webperf.HTML0{index}'
f' {header['replace'].replace(' ', '%20').replace('=', '%3D')}='
f'{header['replaceWith'].replace(' ', '%20').replace('=', '%3D')}')
f" {header['replace'].replace(' ', '%20').replace('=', '%3D')}="
f"{header['replaceWith'].replace(' ', '%20').replace('=', '%3D')}")
index += 1
return browertime_plugin_options

Expand All @@ -278,7 +278,7 @@ def validate_on_desktop_using_validator(url, validator_config):
'--speedIndex true '
'--browsertime.videoParams.createFilmstrip false '
'--browsertime.chrome.args ignore-certificate-errors '
f'-n {get_config('tests.sitespeed.iterations')} '
f"-n {get_config('tests.sitespeed.iterations')} "
'--preScript chrome-custom.cjs '
f'{url}'
f'{browertime_plugin_options}'
Expand Down Expand Up @@ -312,7 +312,7 @@ def validate_on_desktop(url):
'--speedIndex true '
'--browsertime.videoParams.createFilmstrip false '
'--browsertime.chrome.args ignore-certificate-errors '
f'-n {get_config('tests.sitespeed.iterations')} '
f"-n {get_config('tests.sitespeed.iterations')} "
'--preScript chrome-custom.cjs '
f'{url}'
)
Expand Down Expand Up @@ -344,7 +344,7 @@ def validate_on_mobile(url):
'--speedIndex true '
'--browsertime.videoParams.createFilmstrip false '
'--browsertime.chrome.args ignore-certificate-errors '
f'-n {get_config('tests.sitespeed.iterations')} '
f"-n {get_config('tests.sitespeed.iterations')} "
'--preScript chrome-custom.cjs '
f'{url}'
)
Expand Down
2 changes: 1 addition & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def get_http_content(url, allow_redirects=False, use_text_instead_of_content=Tru
headers = {'user-agent': get_config('useragent')}
hostname = urlparse(url).hostname
if hostname == 'api.github.com' and get_config('github.api.key') is not None:
headers['authorization'] = f'Bearer {get_config('github.api.key')}'
headers['authorization'] = f"Bearer {get_config('github.api.key')}"
response = requests.get(url, allow_redirects=allow_redirects,
headers=headers, timeout=get_config('general.request.timeout')*2)

Expand Down
2 changes: 1 addition & 1 deletion tests/w3c_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def get_errors(test_type, params):

if 'https://' not in url and 'http://' not in url:
raise ValueError(
f'Tested url must start with \'https://\' or \'http://\': {url}')
f"Tested url must start with \'https://\' or \'http://\': {url}")

file_path = get_cache_path_for_file(url, True)
if is_html:
Expand Down

0 comments on commit 4193c32

Please sign in to comment.