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

Energy Efficiency Test - Update documentation & Regression Tests #847

Merged
merged 1 commit into from
Jan 10, 2025
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/regression-test-404.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:
- '**regression-test-css.yml'
- '**regression-test-docker-image.yml'
- '**regression-test-email.yml'
- '**regression-test-energy-efficiency.yml'
- '**regression-test-google-lighthouse-based.yml'
- '**regression-test-html.yml'
- '**regression-test-http.yml'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/regression-test-a11y-statement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:
- '**regression-test-css.yml'
- '**regression-test-docker-image.yml'
- '**regression-test-email.yml'
- '**regression-test-energy-efficiency.yml'
- '**regression-test-google-lighthouse-based.yml'
- '**regression-test-html.yml'
- '**regression-test-http.yml'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/regression-test-css.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:
- '**regression-test-a11y-statement.yml'
- '**regression-test-docker-image.yml'
- '**regression-test-email.yml'
- '**regression-test-energy-efficiency.yml'
- '**regression-test-google-lighthouse-based.yml'
- '**regression-test-html.yml'
- '**regression-test-http.yml'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/regression-test-email.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:
- '**regression-test-a11y-statement.yml'
- '**regression-test-css.yml'
- '**regression-test-docker-image.yml'
- '**regression-test-energy-efficiency.yml'
- '**regression-test-google-lighthouse-based.yml'
- '**regression-test-html.yml'
- '**regression-test-http.yml'
Expand Down
78 changes: 78 additions & 0 deletions .github/workflows/regression-test-energy-efficiency.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: "Regression Test - Energy Efficiency Test"
on:
workflow_dispatch:
push:
paths-ignore:
- '**.md'
- '**software-full.json'
- '**software-sources.json'
- '**update-software.yml'
- '**update_software_helper.py'
- '**software-rules.json'
- 'Dockerfile'
- '**regression-test-404.yml'
- '**regression-test-a11y-statement.yml'
- '**regression-test-css.yml'
- '**regression-test-docker-image.yml'
- '**regression-test-email.yml'
- '**regression-test-google-lighthouse-based.yml'
- '**regression-test-html.yml'
- '**regression-test-http.yml'
- '**regression-test-lint-css.yml'
- '**regression-test-pa11y.yml'
- '**regression-test-sitespeed-browsertime-har.yml'
- '**regression-test-sitespeed.yml'
- '**regression-test-software.yml'
- '**regression-test-standard-files.yml'
- '**regression-test-tracking.yml'
- '**regression-test-translations.yml'
- '**regression-test-webbkoll.yml'
- '**regression-test-ylt.yml'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
config: ['SITESPEED_USE_DOCKER=False']
version: [22]
include:
- os: ubuntu-latest
config: 'SITESPEED_USE_DOCKER=True'
version: 22
steps:
- 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: Setup Node.js (v4 version 20.x)
uses: actions/setup-node@v4
with:
node-version: '20.x'
- if: ${{ matrix.os == 'ubuntu-latest' }}
shell: bash
name: Setup Google Chrome browser (ONLY used for Sitespeed)
run: |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get --only-upgrade install google-chrome-stable
google-chrome --version
- name: Setup npm packages
run: npm install --omit=dev
timeout-minutes: 30
- if: ${{ matrix.os == 'ubuntu-latest' }}
name: RUNNING TEST - LINUX
run: |
python default.py -t ${{ matrix.version }} -r -u https://webperf.se?webperf-core-test-22 -o data/testresult-${{ matrix.version }}.json --setting ${{ matrix.config }} --setting tests.sitespeed.xvfb=true --setting general.cache.use=true --setting general.cache.max-age=5256000 --setting tests.sitespeed.cache.folder=unittests
python .github/workflows/verify_result.py -t ${{ matrix.version }}
- if: ${{ matrix.os == 'windows-latest' }}
name: RUNNING TEST - WINDOWS
run: |
python default.py -t ${{ matrix.version }} -r -u https://webperf.se?webperf-core-test-22 -o data\testresult-${{ matrix.version }}.json --setting ${{ matrix.config }} --setting general.cache.use=true --setting general.cache.max-age=5256000 --setting tests.sitespeed.cache.folder=unittests
python .github\workflows\verify_result.py -t ${{ matrix.version }}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
version: [1, 4, 5, 10, 22]
version: [1, 4, 5, 10]
steps:
- name: Check out repository code
uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/regression-test-html.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- '**regression-test-css.yml'
- '**regression-test-docker-image.yml'
- '**regression-test-email.yml'
- '**regression-test-energy-efficiency.yml'
- '**regression-test-google-lighthouse-based.yml'
- '**regression-test-http.yml'
- '**regression-test-lint-css.yml'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/regression-test-http.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- '**regression-test-css.yml'
- '**regression-test-docker-image.yml'
- '**regression-test-email.yml'
- '**regression-test-energy-efficiency.yml'
- '**regression-test-google-lighthouse-based.yml'
- '**regression-test-html.yml'
- '**regression-test-lint-css.yml'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/regression-test-lint-css.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- '**regression-test-css.yml'
- '**regression-test-docker-image.yml'
- '**regression-test-email.yml'
- '**regression-test-energy-efficiency.yml'
- '**regression-test-google-lighthouse-based.yml'
- '**regression-test-html.yml'
- '**regression-test-http.yml'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/regression-test-pa11y.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- '**regression-test-css.yml'
- '**regression-test-docker-image.yml'
- '**regression-test-email.yml'
- '**regression-test-energy-efficiency.yml'
- '**regression-test-google-lighthouse-based.yml'
- '**regression-test-html.yml'
- '**regression-test-http.yml'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/regression-test-sitespeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- '**regression-test-css.yml'
- '**regression-test-docker-image.yml'
- '**regression-test-email.yml'
- '**regression-test-energy-efficiency.yml'
- '**regression-test-google-lighthouse-based.yml'
- '**regression-test-html.yml'
- '**regression-test-http.yml'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/regression-test-software.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
- '**regression-test-css.yml'
- '**regression-test-docker-image.yml'
- '**regression-test-email.yml'
- '**regression-test-energy-efficiency.yml'
- '**regression-test-google-lighthouse-based.yml'
- '**regression-test-html.yml'
- '**regression-test-http.yml'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/regression-test-standard-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- '**regression-test-css.yml'
- '**regression-test-docker-image.yml'
- '**regression-test-email.yml'
- '**regression-test-energy-efficiency.yml'
- '**regression-test-google-lighthouse-based.yml'
- '**regression-test-html.yml'
- '**regression-test-http.yml'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/regression-test-tracking.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:
- '**regression-test-css.yml'
- '**regression-test-docker-image.yml'
- '**regression-test-email.yml'
- '**regression-test-energy-efficiency.yml'
- '**regression-test-google-lighthouse-based.yml'
- '**regression-test-html.yml'
- '**regression-test-http.yml'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/regression-test-translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:
- '**regression-test-css.yml'
- '**regression-test-docker-image.yml'
- '**regression-test-email.yml'
- '**regression-test-energy-efficiency.yml'
- '**regression-test-google-lighthouse-based.yml'
- '**regression-test-html.yml'
- '**regression-test-http.yml'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/regression-test-webbkoll.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- '**regression-test-css.yml'
- '**regression-test-docker-image.yml'
- '**regression-test-email.yml'
- '**regression-test-energy-efficiency.yml'
- '**regression-test-google-lighthouse-based.yml'
- '**regression-test-html.yml'
- '**regression-test-http.yml'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/regression-test-ylt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- '**regression-test-css.yml'
- '**regression-test-docker-image.yml'
- '**regression-test-email.yml'
- '**regression-test-energy-efficiency.yml'
- '**regression-test-google-lighthouse-based.yml'
- '**regression-test-html.yml'
- '**regression-test-http.yml'
Expand Down
19 changes: 8 additions & 11 deletions docs/tests/energy-efficiency.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Energy Efficiency
[![Regression Test - Google Lighthouse Based Test(s)](https://github.com/Webperf-se/webperf_core/actions/workflows/regression-test-google-lighthouse-based.yml/badge.svg)](https://github.com/Webperf-se/webperf_core/actions/workflows/regression-test-google-lighthouse-based.yml)
[![Regression Test - Energy Efficiency Test](https://github.com/Webperf-se/webperf_core/actions/workflows/regression-test-energy-efficiency.yml/badge.svg)](https://github.com/Webperf-se/webperf_core/actions/workflows/regression-test-energy-efficiency.yml)

Aim for this test is to start discussion regarding website impact on climate and environment.
It is not perfect but hopefully a start.
Expand All @@ -10,7 +10,7 @@ We are giving websites a relative rating depending on the impact they would have
We are doing this by taking the weight of the url in KiB and calculating a value from this.
We then compare that value with a reference values and gives you a rating.
The reference values represents the percentile for all urls checked by Webperf.se.
This is updated manually and you can see when it was done latet by looking at the date in top of [/tests/energy_efficiency_carbon_percentiles.py](../../tests/energy_efficiency_carbon_percentiles.py)).
This is updated manually and you can see when it was done latet by looking at the date in top of [/tests/energy_efficiency_carbon_percentiles.py](../../tests/energy_efficiency_carbon_percentiles.py).

If you know any other way we could automatically compare impact on climate and environment a certain url has, *PLEASE* let us know :)

Expand All @@ -25,8 +25,8 @@ This section has not been written yet.

## How to setup?

This test is using Google LightHouse in the background
so please follow instructions on page about [Google Lighthouse Based Test](./google-lighthouse-based.md)
This test is using Sitespeed.io in the background
so please follow instructions on page about [Sitespeed.io Based Test](./sitespeed.md)

### How to update carbon percentile reference?

Expand All @@ -38,21 +38,18 @@ It is also needed if you want to have your own reference to rate against, for ex
You do this by running Energy efficiency against a list of all sites you want to compare against.
For example:
```
python default.py -i webperf.csv -t 22 -o data\carbon-references-2022.json
python default.py -i kommuner.webprf -t 22 -o data\carbon-references-kommuner.json
```

#### Calculate new percentiles
You now have a baseline to create your carbon percentiles from.
You do this by running `carbon-rating.py`, you can see a full list of argument by writing `python carbon-rating.py -h`
You do this by running `python default.py --update-carbon <file path>`.
We recommend running it as follows:
```
python carbon-rating.py -i data\carbon-references-2022.json -o tests\energy_efficiency_carbon_percentiles.py
default.py --update-carbon data\carbon-references-kommuner.json
```

For webperf-core to use your new percentiles it has to be placed and named as follows
```
tests\energy_efficiency_carbon_percentiles.py
```
For webperf-core will now have updated `tests\energy_efficiency_carbon_percentiles.py` to use your new percentiles.

## FAQ

Expand Down
1 change: 1 addition & 0 deletions unittests/webperf.se/test-22.har

Large diffs are not rendered by default.

Loading