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

NOT READY - Switching to GitHub Actions npm Cache and Automating package-lock.json #772

Open
wants to merge 45 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
3367737
use npm cache and npm ci
cockroacher Dec 13, 2024
6581563
test
cockroacher Dec 13, 2024
5c24ad5
removed package-lock.json from ignore
cockroacher Dec 13, 2024
8029281
Updated version in package.json to latest
cockroacher Dec 13, 2024
b934da4
Merge pull request #773 from Webperf-se/update-version-in-package-json
cockroacher Dec 13, 2024
55abc3b
omit optional npm packages
cockroacher Dec 13, 2024
1f539da
test
cockroacher Dec 13, 2024
9637843
Merge branch 'main' into npm-cache
cockroacher Dec 14, 2024
3411588
change npm ci call
cockroacher Dec 14, 2024
ce51894
Merge branch 'npm-cache' of https://github.com/Webperf-se/webperf_cor…
cockroacher Dec 14, 2024
b6c6479
Updated version in package.json to latest
cockroacher Dec 14, 2024
b46b58e
Merge pull request #776 from Webperf-se/update-version-in-package-json
cockroacher Dec 14, 2024
5631c11
Merge branch 'main' into npm-cache
cockroacher Dec 18, 2024
aa28c01
Merge branch 'main' into npm-cache
cockroacher Dec 19, 2024
91f2c4c
Merge branch 'main' into npm-cache
cockroacher Dec 19, 2024
d1f861d
Merge branch 'main' into npm-cache
cockroacher Dec 19, 2024
dd65c12
Merge branch 'main' into npm-cache
7h3Rabbit Dec 19, 2024
70cb52e
Updated version in package.json to latest
7h3Rabbit Dec 19, 2024
a97d8ad
Merge pull request #804 from Webperf-se/update-version-in-package-json
7h3Rabbit Dec 19, 2024
4377314
clean out fsevents
7h3Rabbit Dec 19, 2024
e3a1989
Updated version in package.json to latest
7h3Rabbit Dec 19, 2024
a5393cb
Merge pull request #805 from Webperf-se/update-version-in-package-json
7h3Rabbit Dec 19, 2024
008b0af
test
7h3Rabbit Dec 20, 2024
171eef3
test
7h3Rabbit Dec 20, 2024
3f255f9
Merge branch 'main' into npm-cache
7h3Rabbit Dec 21, 2024
b5ee810
specify package-lock.json as only cache dep
cockroacher Dec 21, 2024
7006fcb
Merge branch 'main' into npm-cache
7h3Rabbit Dec 22, 2024
8d57eb0
Merge branch 'main' into npm-cache
7h3Rabbit Dec 22, 2024
2773bb2
Merge branch 'main' into npm-cache
7h3Rabbit Jan 15, 2025
e8e6e55
Merge branch 'main' into npm-cache
7h3Rabbit Jan 18, 2025
cd0563d
Updated version in package.json to latest
7h3Rabbit Jan 18, 2025
7cdd039
Merge pull request #863 from Webperf-se/update-version-in-package-json
7h3Rabbit Jan 18, 2025
39da221
Merge branch 'main' into npm-cache
7h3Rabbit Jan 18, 2025
216462d
Updated version in package.json to latest
cockroacher Jan 20, 2025
4fe1ad3
Merge pull request #872 from Webperf-se/update-version-in-package-json
cockroacher Jan 20, 2025
a3150b4
Merge branch 'main' into npm-cache
7h3Rabbit Jan 26, 2025
2345d0b
Updated version in package.json to latest
7h3Rabbit Jan 26, 2025
820666b
Merge pull request #897 from Webperf-se/update-version-in-package-json
7h3Rabbit Jan 26, 2025
0c6d6cb
Merge branch 'main' into npm-cache
7h3Rabbit Jan 27, 2025
41e913c
Updated version in package.json to latest
cockroacher Jan 27, 2025
fbd1d90
Merge pull request #902 from Webperf-se/update-version-in-package-json
cockroacher Jan 27, 2025
987d5e6
Merge branch 'main' into npm-cache
7h3Rabbit Feb 3, 2025
533c9cb
Updated version in package.json to latest
7h3Rabbit Feb 3, 2025
91441e0
Merge pull request #934 from Webperf-se/update-version-in-package-json
cockroacher Feb 3, 2025
e3bf92f
Merge branch 'main' into npm-cache
7h3Rabbit Mar 4, 2025
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
29 changes: 21 additions & 8 deletions .github/workflows/prep-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,27 @@ jobs:
architecture: "x64" # optional x64 or x86. Defaults to x64 if not specified
- name: Setup dependencies using pip
run: pip install -r requirements.txt
- name: 📋 Get Commits since last Release
id: changes
uses: simbo/[email protected]
- name: Remove old package-lock.json
uses: JesseTG/[email protected]
with:
line-prefix: "* "
include-hashes: false
- name: Generate new release version
id: newversion
run: python default.py --prepare-release "${{ steps.changes.outputs.last-tag }}"
path: package-lock.json
- name: Setup Node.js (v4 version 20.x)
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Create new package-lock.json
run: npm install --omit=dev --omit=optional
- name: Remove fsevents package
run: python default.py --update-package-lock
# - name: 📋 Get Commits since last Release
# id: changes
# uses: simbo/[email protected]
# with:
# line-prefix: "* "
# include-hashes: false
# - name: Generate new release version
# id: newversion
# run: python default.py --prepare-release "${{ steps.changes.outputs.last-tag }}"
- name: Create pull request
uses: peter-evans/create-pull-request@v7
with:
Expand All @@ -48,3 +60,4 @@ jobs:
labels: ignore-for-release
add-paths: |
package.json
package-lock.json
2 changes: 1 addition & 1 deletion .github/workflows/regression-test-404.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
sudo apt-get --only-upgrade install google-chrome-stable
google-chrome --version
- name: Setup npm packages
run: npm install
run: npm ci --only=production
- if: ${{ matrix.os == 'ubuntu-latest' }}
name: RUNNING TEST - LINUX
run: |
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/regression-test-css.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- if: ${{ matrix.os == 'ubuntu-latest' }}
shell: bash
name: Setup Google Chrome browser (ONLY used for Sitespeed)
Expand All @@ -66,7 +68,7 @@ jobs:
sudo apt-get --only-upgrade install google-chrome-stable
google-chrome --version
- name: Setup npm packages
run: npm install --omit=dev
run: npm ci --only=production
timeout-minutes: 30
- if: ${{ matrix.os == 'ubuntu-latest' }}
name: RUNNING TEST - LINUX
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- name: Setup npm packages
run: npm install --omit=dev
run: npm ci --only=production
timeout-minutes: 30
- if: ${{ matrix.os == 'ubuntu-latest' }}
name: RUNNING TEST - LINUX
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/regression-test-html.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- if: ${{ matrix.os == 'ubuntu-latest' }}
shell: bash
name: Setup Google Chrome browser (ONLY used for Sitespeed)
Expand All @@ -66,7 +68,7 @@ jobs:
sudo apt-get --only-upgrade install google-chrome-stable
google-chrome --version
- name: Setup npm packages
run: npm install --omit=dev
run: npm ci --only=production
timeout-minutes: 30
- if: ${{ matrix.os == 'ubuntu-latest' }}
name: RUNNING TEST - LINUX
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/regression-test-http.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- if: ${{ matrix.os == 'ubuntu-latest' }}
shell: bash
name: Setup Google Chrome browser (ONLY used for Sitespeed)
Expand All @@ -64,7 +66,7 @@ jobs:
sudo apt-get --only-upgrade install google-chrome-stable
google-chrome --version
- name: Setup npm packages
run: npm install --omit=dev
run: npm ci --only=production
timeout-minutes: 30
- if: ${{ matrix.os == 'ubuntu-latest' }}
name: RUNNING TEST - LINUX
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/regression-test-lint-css.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- if: ${{ matrix.os == 'ubuntu-latest' }}
shell: bash
name: Setup Google Chrome browser (ONLY used for Sitespeed)
Expand All @@ -66,7 +68,7 @@ jobs:
sudo apt-get --only-upgrade install google-chrome-stable
google-chrome --version
- name: Setup npm packages
run: npm install --omit=dev
run: npm ci --only=production
timeout-minutes: 30
- if: ${{ matrix.os == 'ubuntu-latest' }}
name: RUNNING TEST - LINUX (no-errors)
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/regression-test-pa11y.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- name: Setup npm packages
run: npm install --omit=dev
run: npm ci --only=production
timeout-minutes: 30
# Havn't yet been able to start Google Chrome in headless mode in pa11y since move to Chrome in Pa11y 5
- if: ${{ matrix.os == 'windows-latest' }}
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/regression-test-sitespeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- if: ${{ matrix.os == 'ubuntu-latest' }}
name: Setup SpeedIndex dependencies (ONLY used for Sitespeed) - Linux
run: |
Expand Down Expand Up @@ -80,7 +82,7 @@ jobs:
sudo apt-get --only-upgrade install google-chrome-stable
google-chrome --version
- name: Setup npm packages
run: npm install --omit=dev
run: npm ci --only=production
timeout-minutes: 30
- if: ${{ matrix.os == 'ubuntu-latest' }}
name: RUNNING TEST - LINUX
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/regression-test-software.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- if: ${{ matrix.os == 'ubuntu-latest' }}
shell: bash
name: Setup Google Chrome browser (ONLY used for Sitespeed)
Expand All @@ -61,7 +63,7 @@ jobs:
sudo apt-get --only-upgrade install google-chrome-stable
google-chrome --version
- name: Setup npm packages
run: npm install --omit=dev
run: npm ci --only=production
timeout-minutes: 30
- if: ${{ matrix.os == 'ubuntu-latest' }}
name: RUNNING TEST - LINUX
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/regression-test-tracking.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- if: ${{ matrix.os == 'ubuntu-latest' }}
shell: bash
name: Setup Google Chrome browser (ONLY used for Sitespeed)
Expand All @@ -120,7 +122,7 @@ jobs:
sudo apt-get --only-upgrade install google-chrome-stable
google-chrome --version
- name: Setup npm packages
run: npm install --omit=dev
run: npm ci --only=production
timeout-minutes: 30
- if: ${{ matrix.os == 'ubuntu-latest' }}
name: RUNNING TEST - LINUX
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/regression-test-ylt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- name: Setup node dependencies (ONLY used for Yellow Lab Tools)
run: npm install -g node-gyp
timeout-minutes: 30
- name: Setup npm packages
run: npm install --omit=dev
run: npm ci --only=production
timeout-minutes: 30
- if: ${{ matrix.os == 'windows-latest' }}
name: RUNNING TEST - WINDOWS
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/update-software.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- name: Setup SpeedIndex dependencies (ONLY used for Sitespeed) - Linux
run: |
sudo apt-get update -y
Expand All @@ -42,7 +44,7 @@ jobs:
sudo apt-get --only-upgrade install google-chrome-stable
google-chrome --version
- name: Setup npm packages
run: npm install --omit=dev
run: npm ci --only=production
timeout-minutes: 30
- name: Update USER_AGENT
run: python default.py --update-browser
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ geckodriver.exe
node_modules
data
sitespeed-result
package-lock.json
# package-lock.json
# package.json
sitespeed-rules.json
vnu.jar
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ RUN python3 -m pip install -r requirements.txt --break-system-packages && \
# Run everything after as non-privileged user.
USER sitespeedio

RUN npm install --omit=dev
RUN npm ci --only=production

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

Expand Down
10 changes: 9 additions & 1 deletion default.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from helpers.credits_helper import get_credits, update_credits_markdown
from helpers.dependency_helper import dependency
from helpers.mdn_helper import update_mdn_rules
from helpers.release_helper import set_new_release_version_in_env, update_release_version
from helpers.release_helper import set_new_release_version_in_env, update_package_lock_json, update_release_version
from helpers.setting_helper import config_mapping, get_config, set_config,\
set_config_from_cmd, set_runtime_config_only
from helpers.test_helper import TEST_ALL,\
Expand Down Expand Up @@ -146,6 +146,12 @@ def update_mdn(self, _):
update_mdn_rules()
sys.exit(0)

def update_package_lock(self, _):
if update_package_lock_json():
sys.exit(0)
else:
sys.exit(2)

def update_software_definitions(self, arg):
set_runtime_config_only("github.api.key", arg)
update_licenses()
Expand Down Expand Up @@ -484,6 +490,7 @@ def handle_option(self, opt, arg):
("-b", "--update-browser"): self.update_browser,
("--usr", "--update-stylelint-rules"): self.update_stylelint,
("-d", "--update-definitions"): self.update_software_definitions,
("--upl", "--update-package-lock"): self.update_package_lock,
("--ums", "--update-mdn-sources"): self.update_mdn,
("--ucr", "--update-carbon"): self.update_carbon_rating,
("--ut", "--update-translations"): self.update_translations,
Expand Down Expand Up @@ -538,6 +545,7 @@ def main(argv):
"uc" ,"update-credits",
"ums", "update-mdn-sources",
"update-browser", "update-definitions=",
"update-package-lock",
"usr", "update-stylelint-rules",
"update-translations",
"pr=", "prepare-release=",
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started-local.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ it is also best/fastest when wanting to contribute with new tests, translations
- Download and install Node.js (version 20.x)
- Download and install Google Chrome browser
* Download and install Mozilla Firefox
- Install required npm packages by typing following and hit Enter: `npm install --omit=dev`
- Install required npm packages by typing following and hit Enter: `npm install --omit=dev --omit=optional`
- Validate that core functionality is working by typing following and hit Enter `python default.py -h`
- If the output looks something like example in [options and arguments](getting-started.md#options-and-arguments) you have successfully setup the general parts of webperf-core.
- Please look at/return to the [specific test](tests/README.md) you want to run to make sure it doesn't require more steps.
Expand Down
2 changes: 1 addition & 1 deletion docs/tests/css.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Read more on the [general page for github actions](../getting-started-github-act

* Download and install Node.js (version 20.x)
* Download and install Google Chrome browser
* Install NPM packages ( `npm install --omit=dev` )
* Install NPM packages ( `npm install --omit=dev --omit=optional` )
* Set [tests.sitespeed.docker.use](../settings-json.md) to `false` in your `settings.json`

##### Windows Specific
Expand Down
2 changes: 1 addition & 1 deletion docs/tests/google-lighthouse-based.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Follow the instructions below depending on what you choose.
Benefit of this option is that you can use it to test pre production urls like your AcceptanceTest environment.

* Download and install Node.js (version 20.x)
* Install NPM packages ( `npm install --omit=dev` )
* Install NPM packages ( `npm install --omit=dev --omit=optional` )

## Read more

Expand Down
2 changes: 1 addition & 1 deletion docs/tests/html.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Read more on the [general page for github actions](../getting-started-github-act

* Download and install Node.js (version 20.x)
* Download and install Google Chrome browser
* Install NPM packages ( `npm install --omit=dev` )
* Install NPM packages ( `npm install --omit=dev --omit=optional` )
* Set `sitespeed_use_docker = False` in your `config.py`

##### Windows Specific
Expand Down
2 changes: 1 addition & 1 deletion docs/tests/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Read more on the [general page for github actions](../getting-started-github-act
* Download and install Node.js (version 20.x)
* Download and install Google Chrome browser
* Download and install Mozilla Firefox browser
* Install NPM packages ( `npm install --omit=dev` )
* Install NPM packages ( `npm install --omit=dev --omit=optional` )
* Set `sitespeed_use_docker = False` in your `config.py`

##### Windows Specific
Expand Down
2 changes: 1 addition & 1 deletion docs/tests/pa11y.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Read more on the [general page for github actions](../getting-started-github-act
* Follow [general local setup steps for this repository](../getting-started-local.md)
* Download and install Node.js (version 20.x)
* Download and install Google Chrome browser
* Install NPM packages ( `npm install --omit=dev` )
* Install NPM packages ( `npm install --omit=dev --omit=optional` )

## FAQ

Expand Down
4 changes: 2 additions & 2 deletions docs/tests/sitespeed.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Read more on the [general page for github actions](../getting-started-github-act
* Install ffmpeg `sudo apt install ffmpeg`
* Download and install Node.js (version 20.x)
* Download and install Google Chrome browser
* Install NPM packages ( `npm install --omit=dev` )
* Install NPM packages ( `npm install --omit=dev --omit=optional` )
* Set `sitespeed_use_docker = False` in your `config.py`

(You can always see [GitHub Actions SiteSpeed](../../.github/workflows/regression-test-sitespeed.yml) for all steps required line by line)
Expand All @@ -86,7 +86,7 @@ Read more on the [general page for github actions](../getting-started-github-act
* Download and Install ffmpeg `https://ffmpeg.org/download.html#build-windows`
* Download and install Node.js (version 20.x)
* Download and install Google Chrome browser
* Install NPM packages ( `npm install --omit=dev` )
* Install NPM packages ( `npm install --omit=dev --omit=optional` )
* Set `sitespeed_use_docker = False` in your `config.py`

#### Using Docker image
Expand Down
2 changes: 1 addition & 1 deletion docs/tests/software.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ TODO: Add links to blogs and articles showing how to remove info regarding what

* Download and install Node.js (version 20.x)
* Download and install Google Chrome browser
* Install NPM packages ( `npm install --omit=dev` )
* Install NPM packages ( `npm install --omit=dev --omit=optional` )
* Set `sitespeed_use_docker = False` in your `config.py`

##### Windows Specific
Expand Down
2 changes: 1 addition & 1 deletion docs/tests/tracking.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ This section has not been written yet.
* Download and install Node.js (version 20.x)
* Download and install Google Chrome browser
* Download and install Mozilla Firefox
* Install NPM packages ( `npm install --omit=dev` )
* Install NPM packages ( `npm install --omit=dev --omit=optional` )
* Set `sitespeed_use_docker = False` in your `config.py`

##### Windows Specific
Expand Down
4 changes: 2 additions & 2 deletions docs/tests/yellowlab.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ Read more on the [general page for github actions](../getting-started-github-act
* Download and install Node.js (version 20.x)
* Download and install node-gyp `npm install -g node-gyp`
* Setup libjpeg and fontconfig `sudo apt-get install libjpeg-dev libfontconfig`
* Install NPM packages ( `npm install --omit=dev` )
* Install NPM packages ( `npm install --omit=dev --omit=optional` )

##### On Windows:
* Download and install Node.js (version 20.x)
* Install NPM packages ( `npm install --omit=dev` )
* Install NPM packages ( `npm install --omit=dev --omit=optional` )

## FAQ

Expand Down
Loading
Loading