Skip to content

Commit

Permalink
Merge pull request #77 from Shopify/bump_ruby_version
Browse files Browse the repository at this point in the history
Update action to Shopify CLI 3, lhci 0.13 and ruby 3.2
  • Loading branch information
charlespwd authored Jan 5, 2024
2 parents 794c232 + bca6be2 commit c47b681
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 77 deletions.
20 changes: 0 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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] }}
Expand Down
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM cpclermont/lighthouse-ci-action:1.0.0
RUN gem uninstall shopify-cli
RUN gem install shopify-cli -N -n /usr/local/bin
FROM cpclermont/lighthouse-ci-action:2.0.0
RUN npm install -g @shopify/cli @shopify/theme
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
26 changes: 10 additions & 16 deletions Dockerfile.base
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14-buster
FROM node:18-buster

ENV PATH="/root/.rbenv/shims:${PATH}"

Expand All @@ -8,26 +8,20 @@ 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 \
&& gem install shopify-cli -N
&& 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.
# 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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
8 changes: 0 additions & 8 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
35 changes: 13 additions & 22 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down Expand Up @@ -119,18 +113,6 @@ cleanup() {

trap 'cleanup $?' EXIT

if ! is_installed lhci; then
step "Installing Lighthouse CI"
log npm install -g @lhci/[email protected] puppeteer
npm install -g @lhci/[email protected] 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
Expand All @@ -149,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:-.}"
Expand All @@ -167,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"

Expand All @@ -196,6 +181,12 @@ 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}"

# 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:
collect:
Expand Down

0 comments on commit c47b681

Please sign in to comment.