-
Notifications
You must be signed in to change notification settings - Fork 543
chore: add dev workshop #6263
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
base: main
Are you sure you want to change the base?
chore: add dev workshop #6263
Changes from all commits
8b00ae1
a7aaa8a
c1aa8e0
0e72e6c
8bfbf53
a537652
0831179
27a3709
c26e6c4
f1b8bd9
a4132a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -177,3 +177,6 @@ dmypy.json | |
| # .NET build artifacts | ||
| /tests/**/bin/ | ||
| /tests/**/obj/ | ||
|
|
||
| # Canonical workshop | ||
| /.workshop.lock | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| name: dev | ||
| base: ubuntu@24.04 | ||
| sdks: | ||
| - name: uv | ||
| channel: latest/stable | ||
| - name: copilot | ||
| channel: latest/stable | ||
| - name: project-starcraft | ||
| actions: | ||
| setup: make setup | ||
| lint: make lint | ||
| format: make format | ||
| test: make test | ||
| test-fast: make test-fast | ||
| test-coverage: make test-coverage | ||
| schema: make schema | ||
| clean: make clean | ||
| lock: | | ||
| uv lock "$@" | ||
| make setup | ||
| install-branch: | | ||
| set -euo pipefail | ||
| if [[ $# -lt 2 ]]; then | ||
| echo "Usage: install-branch <PACKAGE|URL> <BRANCH>" >&2 | ||
| echo "" >&2 | ||
| echo "Examples:" >&2 | ||
| echo " workshop run -- install-branch craft-parts main" >&2 | ||
| echo " workshop run -- install-branch https://github.com/user/repo.git main" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| REPO_OR_URL=$1 | ||
| BRANCH=$2 | ||
|
|
||
| # Check if it's a URL (contains :// or ends with .git) | ||
| if [[ $REPO_OR_URL =~ "://" ]] || [[ $REPO_OR_URL == *.git ]]; then | ||
| REPO_URL=$REPO_OR_URL | ||
| else | ||
| # Assume it's a package name, use canonical org by default | ||
| REPO_URL="https://github.com/canonical/${REPO_OR_URL}" | ||
| fi | ||
|
|
||
| uv pip install "git+${REPO_URL}@${BRANCH}" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| apt-get update | ||
| apt-get install make |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| uv tool install ruff | ||
| uv tool install ty | ||
| make setup |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # For details: https://canonical-workshop.readthedocs-hosted.com/latest/explanation/sdks/sdks/#sketch-sdk | ||
| name: starcraft | ||
| plugs: | ||
| # Use this configuration to mount a host directory to the workshop | ||
| # models: | ||
| # interface: mount | ||
| # workshop-target: /home/workshop/models | ||
| slots: | ||
| # Use this configuration to expose a port, then add a corresponding system SDK plug | ||
| # More details: https://canonical-workshop.readthedocs-hosted.com/latest/how-to/customize-workshops/forward-ports/ | ||
| # my-web-server: | ||
| # interface: tunnel | ||
| # endpoint: 8080 |
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -69,6 +69,59 @@ Inside the project directory, set up the development environment: | |||||||||||||||||||||||||||||||
| If these commands complete without error, your environment is ready. | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| Develop with Workshop | ||||||||||||||||||||||||||||||||
| --------------------- | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| .. admonition:: Work in progress | ||||||||||||||||||||||||||||||||
| :class: caution | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| Workshop integration for Snapcraft is under active development. Some | ||||||||||||||||||||||||||||||||
| features may be incomplete or subject to change. | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| Local development environments require periodic maintenance and debugging. You can | ||||||||||||||||||||||||||||||||
| instead develop inside a sandbox, where the required development software | ||||||||||||||||||||||||||||||||
| is pre-installed and immutable. Snapcraft provides a development image that's | ||||||||||||||||||||||||||||||||
| controlled with `Workshop <https://documentation.ubuntu.com/canonical-workshop/>`__. | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| With the `Workshop Snap <https://snapcraft.io/workshop>`__ installed, start the | ||||||||||||||||||||||||||||||||
| development environment by running ``workshop launch dev`` from within the Snapcraft | ||||||||||||||||||||||||||||||||
| directory. When the workshop starts, it automatically runs ``make setup`` inside the | ||||||||||||||||||||||||||||||||
| container. From there, use the pre-configured actions to carry out common | ||||||||||||||||||||||||||||||||
| development tasks: | ||||||||||||||||||||||||||||||||
|
Comment on lines
+86
to
+90
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the inline command is easy to skim over when the rest of the commands are code-blocked:
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this. 👍 |
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| .. code-block:: bash | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| workshop run -- setup # re-run the virtual environment setup | ||||||||||||||||||||||||||||||||
| workshop run -- lint # run all linters | ||||||||||||||||||||||||||||||||
| workshop run -- format # run the autoformatters | ||||||||||||||||||||||||||||||||
| workshop run -- test # run the full test suite | ||||||||||||||||||||||||||||||||
| workshop run -- test-fast # run the fast test suite | ||||||||||||||||||||||||||||||||
| workshop run -- test-coverage # run tests with a coverage report | ||||||||||||||||||||||||||||||||
| workshop run -- schema # regenerate the JSON schema | ||||||||||||||||||||||||||||||||
| workshop run -- clean # remove temporary build artifacts | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| Two additional actions support dependency work. | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| The ``lock`` action runs ``uv lock`` with any arguments you pass, then re-runs | ||||||||||||||||||||||||||||||||
| ``make setup``: | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| .. code-block:: bash | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| workshop run -- lock --upgrade-package craft-parts | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| The ``install-branch`` action installs a dependency directly from a Git branch. Pass a | ||||||||||||||||||||||||||||||||
| short package name (resolves to the canonical GitHub organization by default) | ||||||||||||||||||||||||||||||||
| or a full repository URL: | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| .. code-block:: bash | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| workshop run -- install-branch craft-parts main | ||||||||||||||||||||||||||||||||
| workshop run -- install-branch https://github.com/user/craft-parts.git feat/my-fix | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| Workshop provides most of the features needed for developing Snapcraft. Read the | ||||||||||||||||||||||||||||||||
| `Workshop tutorial <https://documentation.ubuntu.com/canonical-workshop/latest/tutorial/>`__ | ||||||||||||||||||||||||||||||||
| to learn what else Workshop can do. | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| Choose a task | ||||||||||||||||||||||||||||||||
| ------------- | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My puter 'splodes whenever I try to run either of these:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!