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

[Enhancement] Update action to rely on Shopify CLI 3.x + Theme Access app #52

Closed
wants to merge 12 commits into from

Conversation

Poitrin
Copy link
Contributor

@Poitrin Poitrin commented Nov 15, 2022

WHY are these changes introduced?

Fixes #51:

  1. Lighthouse CI Action is using Shopify CLI 2.x, instead of 3.x
  2. Action is depending on custom app, instead of Theme Access app

WHAT is this pull request doing?

If token for Theme Access app is set, uses CLI 3.x to push theme.
Else, continues to use CLI 2.x with custom app token to push theme.

How to test your changes?

  1. cd into repo dir that contains Dockerfile
  2. Check this repo's README → Authentication to set up custom app token
  3. In the script below, write it into INPUT_ACCESS_TOKEN
  4. Follow the steps in https://shopify.dev/themes/tools/theme-access to set up Theme Access App token
  5. In the script below, write it into INPUT_SHOPIFY_CLI_THEME_TOKEN
  6. Build an image with podman build --tag lighthouse . (or docker … if you prefer)
  7. Execute:
INPUT_STORE="....myshopify.com"
INPUT_PASSWORD="..." # for password-protected stores
INPUT_ACCESS_TOKEN="..." # for CLI 2.x
INPUT_SHOPIFY_CLI_THEME_TOKEN="..." # for CLI 3.x

podman run --name lighthouse --rm -i -t \
    --mount "type=bind,source=$(pwd)/entrypoint.sh,target=/entrypoint.sh" \
    --mount "type=bind,source=$(pwd)/draft,target=/draft" \
    -e "INPUT_STORE=$INPUT_STORE" \
    -e "INPUT_THEME_ROOT=./draft" \
    -e "INPUT_PASSWORD=$INPUT_PASSWORD" \
    -e "INPUT_ACCESS_TOKEN=$INPUT_ACCESS_TOKEN" \
    -e "INPUT_SHOPIFY_CLI_THEME_TOKEN=$INPUT_SHOPIFY_CLI_THEME_TOKEN" \
    lighthouse
  1. You should see 3 URLs pointing to storage.googleapis.com, in which you can see your Lighthouse performance tests.

Post-release steps

@@ -118,38 +119,27 @@ cleanup() {

trap 'cleanup $?' EXIT

if ! is_installed lhci; then
Copy link
Contributor Author

@Poitrin Poitrin Nov 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't imagine any case when lhci and shopify are not already installed, as this entrypoint.sh script is based on a Dockerfile, in which both tools are installed.

Moreover, if you take a look at the Dockerfile.base, @lhci/cli@0.8.x is installed, so the command here is even outdated.
As I was initially confused and changing the command in this entrypoint.sh file, I decided to remove these lines.

cat <<- EOF > lighthouserc.yml
ci:
collect:
chromePath: "$(which chromium)"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When puppeteerScript is given but no chromePath,
Lighthouse CI was shouting "Chrome not found".
Therefore, I set the path to chromium manually.

@Poitrin Poitrin changed the title Update shopify/lighthouse-ci-action to rely on Shopify CLI 3.x + Theme Access app [Enhancement] Update action to rely on Shopify CLI 3.x + Theme Access app Nov 17, 2022
@Poitrin
Copy link
Contributor Author

Poitrin commented Nov 18, 2022

Due to additional issues (regarding api_request method in entrypoint.sh using custom app token) appearing during development, it has been decided to pause work on this issue and create a design document to decide how to proceed (see Theme Dev Tools Drive folder → Early technical explorations)

There are still 2 open IT Helpdesk tickets to…

  1. make prebuilt docker image on GHCR.io public
  2. get access to Settings tab to update/add password/tokens

Depending on these tickets' outcomes, I might add changes to the branch, but PR is closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update shopify/lighthouse-ci-action to rely on Shopify CLI 3.x + Theme Access app
1 participant