From 777f280651212179b9f928f96eba4dc89cb4bbd6 Mon Sep 17 00:00:00 2001 From: James Meng Date: Fri, 5 Jan 2024 00:28:20 +0000 Subject: [PATCH 01/10] Testing: Ruby version 3.0.0 --- Dockerfile | 38 +++++++++++++++++++++++++++++++++----- Dockerfile.base | 4 ++-- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index cf1e893..d646c5f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,33 @@ -FROM cpclermont/lighthouse-ci-action:1.0.0 -RUN gem uninstall shopify-cli -RUN gem install shopify-cli -N -n /usr/local/bin -COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT ["/entrypoint.sh"] +FROM node:14-buster + +ENV PATH="/root/.rbenv/shims:${PATH}" + +# Install dependencies +RUN apt-get update \ + && apt-get -y install sudo jq rbenv \ + && mkdir -p "$(rbenv root)"/plugins \ + && git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build \ + && git -C "$(rbenv root)"/plugins/ruby-build pull \ + && rbenv install 3.0.0 \ + && rbenv global 3.0.0 \ + && gem install shopify-cli -N + +### +# Chrome in Docker fix +# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others) +# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer installs, work. +RUN apt-get update \ + && apt-get install -y wget gnupg \ + && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ + && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ + && apt-get update \ + && apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \ + --no-install-recommends \ + && rm -rf /var/lib/apt/lists/* + +ENV npm_config_prefix="$GITHUB_WORKSPACE/.node" +ENV PATH="$npm_config_prefix:${PATH}" +RUN mkdir -p "$npm_config_prefix" \ + && chmod -R 777 "$npm_config_prefix" \ + && umask 000 \ + && npm install -g @lhci/cli@0.8.x puppeteer diff --git a/Dockerfile.base b/Dockerfile.base index df7b152..d646c5f 100644 --- a/Dockerfile.base +++ b/Dockerfile.base @@ -8,8 +8,8 @@ RUN apt-get update \ && mkdir -p "$(rbenv root)"/plugins \ && git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build \ && git -C "$(rbenv root)"/plugins/ruby-build pull \ - && rbenv install 2.7.5 \ - && rbenv global 2.7.5 \ + && rbenv install 3.0.0 \ + && rbenv global 3.0.0 \ && gem install shopify-cli -N ### From ae099b5161c4f24a9306d466032a717ec9039f54 Mon Sep 17 00:00:00 2001 From: James Meng Date: Fri, 5 Jan 2024 02:56:13 +0000 Subject: [PATCH 02/10] Testing: Ruby version 3.1.4 --- Dockerfile | 4 ++-- Dockerfile.base | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index d646c5f..2bfffe4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,8 +8,8 @@ RUN apt-get update \ && mkdir -p "$(rbenv root)"/plugins \ && git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build \ && git -C "$(rbenv root)"/plugins/ruby-build pull \ - && rbenv install 3.0.0 \ - && rbenv global 3.0.0 \ + && rbenv install 3.1.4 \ + && rbenv global 3.1.4 \ && gem install shopify-cli -N ### diff --git a/Dockerfile.base b/Dockerfile.base index d646c5f..2bfffe4 100644 --- a/Dockerfile.base +++ b/Dockerfile.base @@ -8,8 +8,8 @@ RUN apt-get update \ && mkdir -p "$(rbenv root)"/plugins \ && git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build \ && git -C "$(rbenv root)"/plugins/ruby-build pull \ - && rbenv install 3.0.0 \ - && rbenv global 3.0.0 \ + && rbenv install 3.1.4 \ + && rbenv global 3.1.4 \ && gem install shopify-cli -N ### From ea4e3bc46d1be2ec3693d9e676197bca50bcd975 Mon Sep 17 00:00:00 2001 From: James Meng Date: Fri, 5 Jan 2024 02:56:43 +0000 Subject: [PATCH 03/10] Testing: Ruby version 3.2.0 --- Dockerfile | 4 ++-- Dockerfile.base | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2bfffe4..94ddf5c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,8 +8,8 @@ RUN apt-get update \ && mkdir -p "$(rbenv root)"/plugins \ && git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build \ && git -C "$(rbenv root)"/plugins/ruby-build pull \ - && rbenv install 3.1.4 \ - && rbenv global 3.1.4 \ + && rbenv install 3.2.0 \ + && rbenv global 3.2.0 \ && gem install shopify-cli -N ### diff --git a/Dockerfile.base b/Dockerfile.base index 2bfffe4..94ddf5c 100644 --- a/Dockerfile.base +++ b/Dockerfile.base @@ -8,8 +8,8 @@ RUN apt-get update \ && mkdir -p "$(rbenv root)"/plugins \ && git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build \ && git -C "$(rbenv root)"/plugins/ruby-build pull \ - && rbenv install 3.1.4 \ - && rbenv global 3.1.4 \ + && rbenv install 3.2.0 \ + && rbenv global 3.2.0 \ && gem install shopify-cli -N ### From 91a144b458ab8d3e0011cf2a99dce782c84f2998 Mon Sep 17 00:00:00 2001 From: James Meng Date: Fri, 5 Jan 2024 03:34:01 +0000 Subject: [PATCH 04/10] Remove testing artifact in Dockerfile --- Dockerfile | 38 +++++--------------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/Dockerfile b/Dockerfile index 94ddf5c..cf1e893 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,33 +1,5 @@ -FROM node:14-buster - -ENV PATH="/root/.rbenv/shims:${PATH}" - -# Install dependencies -RUN apt-get update \ - && apt-get -y install sudo jq rbenv \ - && mkdir -p "$(rbenv root)"/plugins \ - && git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build \ - && git -C "$(rbenv root)"/plugins/ruby-build pull \ - && rbenv install 3.2.0 \ - && rbenv global 3.2.0 \ - && gem install shopify-cli -N - -### -# Chrome in Docker fix -# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others) -# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer installs, work. -RUN apt-get update \ - && apt-get install -y wget gnupg \ - && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ - && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ - && apt-get update \ - && apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \ - --no-install-recommends \ - && rm -rf /var/lib/apt/lists/* - -ENV npm_config_prefix="$GITHUB_WORKSPACE/.node" -ENV PATH="$npm_config_prefix:${PATH}" -RUN mkdir -p "$npm_config_prefix" \ - && chmod -R 777 "$npm_config_prefix" \ - && umask 000 \ - && npm install -g @lhci/cli@0.8.x puppeteer +FROM cpclermont/lighthouse-ci-action:1.0.0 +RUN gem uninstall shopify-cli +RUN gem install shopify-cli -N -n /usr/local/bin +COPY entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] From 4d8adde89fbae3550a77150be4804d5c3688d5b3 Mon Sep 17 00:00:00 2001 From: "Charles-P. Clermont" Date: Fri, 5 Jan 2024 10:59:55 -0500 Subject: [PATCH 05/10] Test with npm installation and 3.2 --- Dockerfile | 38 +++++++++++++++++++++++++++++++++++--- entrypoint.sh | 18 ------------------ 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/Dockerfile b/Dockerfile index cf1e893..9c76ff7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,37 @@ -FROM cpclermont/lighthouse-ci-action:1.0.0 -RUN gem uninstall shopify-cli -RUN gem install shopify-cli -N -n /usr/local/bin +FROM node:20-buster + +ENV PATH="/root/.rbenv/shims:${PATH}" + +# Install dependencies +RUN apt-get update \ + && apt-get -y install sudo jq rbenv \ + && mkdir -p "$(rbenv root)"/plugins \ + && git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build \ + && git -C "$(rbenv root)"/plugins/ruby-build pull \ + && rbenv install 3.2.0 \ + && rbenv global 3.2.0 + +### +# Chrome in Docker fix +# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others) +# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer installs, work. +RUN apt-get update \ + && apt-get install -y wget gnupg \ + && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ + && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ + && apt-get update \ + && apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \ + --no-install-recommends \ + && rm -rf /var/lib/apt/lists/* + +ENV npm_config_prefix="$GITHUB_WORKSPACE/.node" +ENV PATH="$npm_config_prefix:${PATH}" +RUN mkdir -p "$npm_config_prefix" \ + && chmod -R 777 "$npm_config_prefix" \ + && umask 000 \ + && npm install -g @lhci/cli@0.8.x puppeteer + +# every time +RUN npm install -g @shopify/cli @shopify/theme COPY entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh index 4adf549..ab637f0 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -54,12 +54,6 @@ step() { EOF } -is_installed() { - # This works with scripts and programs. For more info, check - # http://goo.gl/B9683D - type $1 &> /dev/null 2>&1 -} - api_request() { local url="$1" local err="$(mktemp)" @@ -119,18 +113,6 @@ cleanup() { trap 'cleanup $?' EXIT -if ! is_installed lhci; then - step "Installing Lighthouse CI" - log npm install -g @lhci/cli@0.7.x puppeteer - npm install -g @lhci/cli@0.7.x puppeteer -fi - -if ! is_installed shopify; then - step "Installing Shopify CLI" - log "gem install shopify" - gem install shopify -fi - step "Configuring shopify CLI" # Disable analytics From 957eccda36f1f6a66c321033dd1bdb43d51a2d76 Mon Sep 17 00:00:00 2001 From: "Charles-P. Clermont" Date: Fri, 5 Jan 2024 11:11:31 -0500 Subject: [PATCH 06/10] Entrypoint update for shopify CLI 3 auth flow --- entrypoint.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index ab637f0..225790c 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -131,7 +131,10 @@ else export SHOPIFY_PASSWORD="$SHOP_APP_PASSWORD" fi -shopify login +export SHOPIFY_FLAG_STORE="$SHOPIFY_SHOP" +export SHOPIFY_CLI_THEME_TOKEN="$SHOPIFY_PASSWORD" +export SHOPIFY_CLI_TTY=0 +# shopify auth login host="https://${SHOP_STORE#*(https://|http://)}" theme_root="${THEME_ROOT:-.}" @@ -149,9 +152,9 @@ if [[ -n "${SHOP_PULL_THEME+x}" ]]; then fi theme_push_log="$(mktemp)" -shopify theme push --development --json $theme_root > "$theme_push_log" && cat "$theme_push_log" -preview_url="$(cat "$theme_push_log" | tail -n 1 | jq -r '.theme.preview_url')" -preview_id="$(cat "$theme_push_log" | tail -n 1 | jq -r '.theme.id')" +shopify theme push --development --json --path $theme_root > "$theme_push_log" && cat "$theme_push_log" +preview_url="$(cat "$theme_push_log" | jq -r '.theme.preview_url')" +preview_id="$(cat "$theme_push_log" | jq -r '.theme.id')" step "Configuring Lighthouse CI" From b06c2b53d739ee72b89b3422c303100c2b47d21c Mon Sep 17 00:00:00 2001 From: "Charles-P. Clermont" Date: Fri, 5 Jan 2024 11:37:22 -0500 Subject: [PATCH 07/10] Remove support for deprecated login --- .github/workflows/ci.yml | 20 -------------------- README.md | 7 ------- action.yml | 8 -------- 3 files changed, 35 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 688f31f..450d191 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,32 +11,14 @@ jobs: include: - job_name: 'staff store, custom app login' store: shimmering-islands.myshopify.com - app_id: '' - app_password: '' access_token: SHOP_ACCESS_TOKEN password: '' - - job_name: 'staff store, private app login' - store: shimmering-islands.myshopify.com - app_id: SHOP_APP_ID - app_password: SHOP_APP_PASSWORD - access_token: '' - password: '' - - job_name: 'dev store, custom app login' store: cpclermont-dev-store.myshopify.com - app_id: '' - app_password: DEV_APP_PASSWORD access_token: DEV_ACCESS_TOKEN password: DEV_PASSWORD - - job_name: 'dev store, private app login' - store: cpclermont-dev-store.myshopify.com - app_id: DEV_APP_ID - app_password: DEV_APP_PASSWORD - access_token: '' - password: DEV_PASSWORD - name: ${{ matrix.job_name }} steps: @@ -50,8 +32,6 @@ jobs: uses: ./ id: lighthouse-ci-action with: - app_id: ${{ secrets[matrix.app_id] }} - app_password: ${{ secrets[matrix.app_password] }} access_token: ${{ secrets[matrix.access_token] }} store: ${{ matrix.store }} password: ${{ secrets[matrix.password] }} diff --git a/README.md b/README.md index 5be50af..73ebc38 100644 --- a/README.md +++ b/README.md @@ -66,10 +66,3 @@ For the GitHub Status Checks on PR. One of the two arguments is required: * `lhci_github_token` - (optional) GitHub personal access token For more details on the implications of choosing one over the other, refer to the [Lighthouse CI Getting Started Page](https://github.com/GoogleChrome/lighthouse-ci/blob/main/docs/getting-started.md#github-status-checks) - -### Deprecated authentication configuration - -The following were used to authenticate with private apps. - -* `app_id` - (deprecated) Shopify store private app ID. -* `app_password` - (deprecated) Shopify store private app password. diff --git a/action.yml b/action.yml index 1f56e2e..8f4ce44 100644 --- a/action.yml +++ b/action.yml @@ -43,14 +43,6 @@ inputs: description: 'Minimum accessibility score' required: false default: 0.9 - app_id: - description: '(deprecated) Shopify private app ID' - depreciationMessage: Shopify private apps are deprecated. Use a Custom App `access_token` instead. - required: false - app_password: - description: '(deprecated) Shopify private app password' - depreciationMessage: Shopify private apps are deprecated. Use a Custom App `access_token` instead. - required: false runs: using: 'docker' image: 'Dockerfile' From eeb22da4c9f4b774db820a04dfc972afec7db2e5 Mon Sep 17 00:00:00 2001 From: "Charles-P. Clermont" Date: Fri, 5 Jan 2024 12:02:01 -0500 Subject: [PATCH 08/10] Try puppeteer install of browser? --- Dockerfile | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9c76ff7..3da3e42 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:20-buster +FROM node:18-buster ENV PATH="/root/.rbenv/shims:${PATH}" @@ -11,25 +11,13 @@ RUN apt-get update \ && rbenv install 3.2.0 \ && rbenv global 3.2.0 -### -# Chrome in Docker fix -# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others) -# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer installs, work. -RUN apt-get update \ - && apt-get install -y wget gnupg \ - && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ - && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ - && apt-get update \ - && apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \ - --no-install-recommends \ - && rm -rf /var/lib/apt/lists/* - ENV npm_config_prefix="$GITHUB_WORKSPACE/.node" ENV PATH="$npm_config_prefix:${PATH}" RUN mkdir -p "$npm_config_prefix" \ && chmod -R 777 "$npm_config_prefix" \ && umask 000 \ - && npm install -g @lhci/cli@0.8.x puppeteer + && npm install -g @lhci/cli@0.13.x puppeteer \ + && npx puppeteer browsers install chrome # every time RUN npm install -g @shopify/cli @shopify/theme From 5418e27420788a08801b0d818bb4e48b04a343e6 Mon Sep 17 00:00:00 2001 From: "Charles-P. Clermont" Date: Fri, 5 Jan 2024 12:13:47 -0500 Subject: [PATCH 09/10] Try the troubleshooting steps from puppeteer --- Dockerfile | 13 +++++++++++-- entrypoint.sh | 4 ++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3da3e42..d4d82d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,13 +11,22 @@ RUN apt-get update \ && rbenv install 3.2.0 \ && rbenv global 3.2.0 +# Install latest chrome stable package. +RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - +RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' +RUN apt-get update \ + && apt-get install -y google-chrome-stable --no-install-recommends \ + && apt-get clean + +# install puppeteer and stuff ENV npm_config_prefix="$GITHUB_WORKSPACE/.node" ENV PATH="$npm_config_prefix:${PATH}" RUN mkdir -p "$npm_config_prefix" \ && chmod -R 777 "$npm_config_prefix" \ && umask 000 \ - && npm install -g @lhci/cli@0.13.x puppeteer \ - && npx puppeteer browsers install chrome + && npm install -g @lhci/cli@0.13.x lighthouse puppeteer + +# RUN npx puppeteer browsers install chrome # every time RUN npm install -g @shopify/cli @shopify/theme diff --git a/entrypoint.sh b/entrypoint.sh index 225790c..8885145 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -181,6 +181,10 @@ query_string="?preview_theme_id=${preview_id}&_fd=0&pb=0" min_score_performance="${LHCI_MIN_SCORE_PERFORMANCE:-0.6}" min_score_accessibility="${LHCI_MIN_SCORE_ACCESSIBILITY:-0.9}" +# that's where the browser is installed +# export PUPPETEER_CACHE_DIR=/root/.cache/puppeteer +export PUPPETEER_EXECUTABLE_PATH='/usr/bin/google-chrome-stable' + cat <<- EOF > lighthouserc.yml ci: collect: From bca6be2bb1c6974477b3f46c35c4cc1647b763b0 Mon Sep 17 00:00:00 2001 From: "Charles-P. Clermont" Date: Fri, 5 Jan 2024 14:15:38 -0500 Subject: [PATCH 10/10] Clean up Dockerfile for real prod use --- Dockerfile | 32 +------------------------------- Dockerfile.base | 24 +++++++++--------------- Makefile | 2 +- entrypoint.sh | 4 +++- 4 files changed, 14 insertions(+), 48 deletions(-) diff --git a/Dockerfile b/Dockerfile index d4d82d5..2c710c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,34 +1,4 @@ -FROM node:18-buster - -ENV PATH="/root/.rbenv/shims:${PATH}" - -# Install dependencies -RUN apt-get update \ - && apt-get -y install sudo jq rbenv \ - && mkdir -p "$(rbenv root)"/plugins \ - && git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build \ - && git -C "$(rbenv root)"/plugins/ruby-build pull \ - && rbenv install 3.2.0 \ - && rbenv global 3.2.0 - -# Install latest chrome stable package. -RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - -RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' -RUN apt-get update \ - && apt-get install -y google-chrome-stable --no-install-recommends \ - && apt-get clean - -# install puppeteer and stuff -ENV npm_config_prefix="$GITHUB_WORKSPACE/.node" -ENV PATH="$npm_config_prefix:${PATH}" -RUN mkdir -p "$npm_config_prefix" \ - && chmod -R 777 "$npm_config_prefix" \ - && umask 000 \ - && npm install -g @lhci/cli@0.13.x lighthouse puppeteer - -# RUN npx puppeteer browsers install chrome - -# every time +FROM cpclermont/lighthouse-ci-action:2.0.0 RUN npm install -g @shopify/cli @shopify/theme COPY entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] diff --git a/Dockerfile.base b/Dockerfile.base index 94ddf5c..0af7c4a 100644 --- a/Dockerfile.base +++ b/Dockerfile.base @@ -1,4 +1,4 @@ -FROM node:14-buster +FROM node:18-buster ENV PATH="/root/.rbenv/shims:${PATH}" @@ -9,25 +9,19 @@ RUN apt-get update \ && git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build \ && git -C "$(rbenv root)"/plugins/ruby-build pull \ && rbenv install 3.2.0 \ - && rbenv global 3.2.0 \ - && gem install shopify-cli -N + && rbenv global 3.2.0 -### -# Chrome in Docker fix -# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others) -# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer installs, work. +# Install latest chrome stable package. +RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - +RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' RUN apt-get update \ - && apt-get install -y wget gnupg \ - && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ - && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ - && apt-get update \ - && apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \ - --no-install-recommends \ - && rm -rf /var/lib/apt/lists/* + && apt-get install -y google-chrome-stable --no-install-recommends \ + && apt-get clean +# install puppeteer and stuff ENV npm_config_prefix="$GITHUB_WORKSPACE/.node" ENV PATH="$npm_config_prefix:${PATH}" RUN mkdir -p "$npm_config_prefix" \ && chmod -R 777 "$npm_config_prefix" \ && umask 000 \ - && npm install -g @lhci/cli@0.8.x puppeteer + && npm install -g @lhci/cli@0.13.x lighthouse puppeteer diff --git a/Makefile b/Makefile index be3361a..7da3122 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ PROJECT_NAME := cpclermont/lighthouse-ci-action -VERSION := 1.0.0 +VERSION := 2.0.0 GITSHA:= $(shell echo $$(git describe --always --long --dirty)) export GITSHA diff --git a/entrypoint.sh b/entrypoint.sh index 8885145..4d190bd 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -181,9 +181,11 @@ query_string="?preview_theme_id=${preview_id}&_fd=0&pb=0" min_score_performance="${LHCI_MIN_SCORE_PERFORMANCE:-0.6}" min_score_accessibility="${LHCI_MIN_SCORE_ACCESSIBILITY:-0.9}" -# that's where the browser is installed +# Env vars for puppeteer to work with our chrome install +# See https://pptr.dev/api/puppeteer.configuration # export PUPPETEER_CACHE_DIR=/root/.cache/puppeteer export PUPPETEER_EXECUTABLE_PATH='/usr/bin/google-chrome-stable' +export LHCI_BUILD_CONTEXT__CURRENT_HASH="$GITHUB_SHA" cat <<- EOF > lighthouserc.yml ci: