Skip to content

chore: workshop setup - #2409

Open
M7mdisk wants to merge 3 commits into
mainfrom
workshop-setup
Open

chore: workshop setup#2409
M7mdisk wants to merge 3 commits into
mainfrom
workshop-setup

Conversation

@M7mdisk

@M7mdisk M7mdisk commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Done

  • setup workshop
  • remove cypress check (its always failing)

How to QA

Copilot AI lite review requested due to automatic review settings August 27, 2026 11:25
@webteam-app

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a Workshop configuration for charmhub.io to standardize local dev setup (Python via uv, Node via node SDK) and provide common run/build/test/lint actions matching the existing dotrun-based workflow.

Changes:

  • Introduces workshop.yaml with SDK definitions, tunnel wiring, and dev/build/test/lint actions.
  • Adds .workshop/charmhub-io scripts/hooks to install dependencies, set environment, and report health status.
  • Updates .gitignore to ignore the Workshop lock file.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
workshop.yaml Defines the Workshop environment, tunnels, and common actions (start/build/test/lint, etc.).
.workshop/charmhub-io/sdk.yaml Declares the repo-specific Workshop SDK name.
.workshop/charmhub-io/install.sh Installs Python deps into .venv via uv and runs yarn install.
.workshop/charmhub-io/hooks/setup-project Runs install and appends env sourcing to ~/.profile for interactive shells.
.workshop/charmhub-io/hooks/setup-base Installs base apt packages needed for builds and Cypress/headless runs.
.workshop/charmhub-io/hooks/check-health Marks Workshop health based on venv + node_modules presence.
.workshop/charmhub-io/env.sh Shared env loader (.env/.env.local) and PATH/corepack-yarn shim logic.
.gitignore Ignores .workshop.lock.
Suppressed comments (2)

workshop.yaml:63

  • These actions use source, which is not POSIX and may fail if workshop run executes actions under /bin/sh. Prefer . /project/.workshop/charmhub-io/env.sh for portability.
  test: |
    source /project/.workshop/charmhub-io/env.sh
    yarn test

  # Cypress needs a display; CI gets one from a container, here xvfb provides it.
  test-e2e: |
    source /project/.workshop/charmhub-io/env.sh
    cypress install
    xvfb-run -a yarn test-e2e

workshop.yaml:76

  • These actions also use source (bash-only). Switching to the POSIX . builtin avoids depending on the action runner shell being bash.
  lint: |
    source /project/.workshop/charmhub-io/env.sh
    yarn lint-python
    yarn lint-js
    yarn lint-scss

  # Escape hatch for any other package.json script:
  #   workshop run yarn test-js / test-python / format-python / serve
  yarn: |
    source /project/.workshop/charmhub-io/env.sh
    yarn "$@"

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread workshop.yaml
@edisile
edisile self-requested a review August 27, 2026 15:40
# Native build deps for the Python/Node dependency trees.
# Evidence: Dockerfile python-dependencies stage.
apt-get update
apt-get install --no-install-recommends --yes \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think we actually need these, they're not even real dependencies for the project... on snapcraft this step is empty and it works fine.

Also, why these are in the Dockerfile is a mystery to me

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

cool! I didn't know about this hook

Comment thread workshop.yaml Outdated
source /project/.workshop/charmhub-io/env.sh
yarn test

# One intent, three linters.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

absolute slop comment lmao

Comment thread workshop.yaml Outdated
actions:
# Equivalent of the old `dotrun`: Vite + gunicorn together on 8045/5045.
start: |
source /project/.workshop/charmhub-io/env.sh

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

there's no need to explicitly source the script here (or any of the following actions), it's sourced through ~/.profile

Comment thread workshop.yaml
yarn build
ENVIRONMENT=prod yarn serve

install: |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

good point, I forgot dotrun had clean and install commands, I should add them to the snapcraft workshop as well

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lots of noise in this file... it can be cleaned up a lot:

  • this script always runs in /project as the workshop user both during setup-project (confirmed by docs) and when called as an action, so all the explicit paths can be removed
  • no need for that ! -x guard on the venv python, just uv venv --allow-existing
  • sourcing the env does nothing in this step (unless we're doing stuff like override node, uv or python env vars and I don't think we are)

Comment thread workshop.yaml
Comment on lines +34 to +42
if ! command -v yarn >/dev/null 2>&1; then
CHARMHUB_IO_SHIM_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/charmhub-io-workshop/bin"
mkdir -p "$CHARMHUB_IO_SHIM_DIR"
if [ ! -x "$CHARMHUB_IO_SHIM_DIR/yarn" ]; then
printf '#!/bin/bash\nexec corepack yarn "$@"\n' > "$CHARMHUB_IO_SHIM_DIR/yarn"
chmod +x "$CHARMHUB_IO_SHIM_DIR/yarn"
fi
export PATH="$CHARMHUB_IO_SHIM_DIR:$PATH"
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why would the yarn shim not be in PATH?


# Sourced by the actions AND by ~/.profile, so guard against PATH entries
# piling up in nested shells.
for _charmhub_dir in "$PROJECT_DIR/.venv/bin" "$PROJECT_DIR/node_modules/.bin"; do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why not activate the .venv normally? also I thought adding node_modules/.bin to PATH was bad form?

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Demo

✅ Demo deployed: https://charmhub-io-pr2409.demos.canonical.com

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.

4 participants