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

refactor: migrate to starflow #5225

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open

refactor: migrate to starflow #5225

wants to merge 35 commits into from

Conversation

bepri
Copy link
Contributor

@bepri bepri commented Jan 29, 2025

  • Have you followed the guidelines for contributing?
  • Have you signed the CLA?
  • Have you successfully run tox run -m lint?
  • Have you successfully run tox run -e test-py310? (supported versions: py39, py310, py311, py312)

Should be reviewable on a commit-by-commit basis. Comments will be left on individual files explaining why some changes were necessary. As some words of encouragement: about 250 of the file changes were purely from make format!

@bepri bepri self-assigned this Jan 29, 2025
.shellcheckrc Outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was meant to be temporary, was almost accidentally forever

TESTING.md Outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Superceded by changes to HACKING.md

manual-tests.md Outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was more or less all outdated information and references to files that were no longer there

runtests.sh Outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Outdated - referenced files that were no longer there

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file (along with many of the other tools) were either outdated or superceded by the starbase makefile

units.py Outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file was outdated, from a time before pytest

@bepri bepri force-pushed the work/starflow-migration branch 3 times, most recently from 43fe672 to 0b7568b Compare January 30, 2025 14:55
appveyor.yml Outdated Show resolved Hide resolved
requirements-noble.txt Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Show resolved Hide resolved
@bepri bepri force-pushed the work/starflow-migration branch 5 times, most recently from c87752f to 4df5913 Compare January 30, 2025 22:59
@bepri bepri marked this pull request as ready for review January 30, 2025 23:11
@mr-cal
Copy link
Collaborator

mr-cal commented Jan 31, 2025

The spread test failures look like inconsequential changes to yaml formatting, so those should be quick fixes.

Copy link
Collaborator

@mr-cal mr-cal left a comment

Choose a reason for hiding this comment

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

This is spooky (in a good way). I ran make setup and make test-fast and within a few seconds I was running unit tests.

I have a few nitpicks but overall everything looks great! This will significantly improve developing and lower the barrier to entry for community contributions.

I'm wondering if this PR is a good time to merge starbase's git history into Snapcraft. The advantage of doing this is that subsequent starbase commits can be brought into Snapcraft with small and easy git merges.

@@ -35,7 +35,7 @@ append_dir QML2_IMPORT_PATH "$SNAP_DESKTOP_RUNTIME/lib/$ARCH"
# Fix locating the QtWebEngineProcess executable
export QTWEBENGINEPROCESS_PATH="$SNAP_DESKTOP_RUNTIME/usr/lib/qt6/libexec/QtWebEngineProcess"
# And QtWebEngine's path to resources
QTWEBENGINE_RESOURCES_PATH="$SNAP_DESKTOP_RUNTIME/usr/share/qt6/resources"
export QTWEBENGINE_RESOURCES_PATH="$SNAP_DESKTOP_RUNTIME/usr/share/qt6/resources"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did shellcheck pick this up?

It seems safe and the correct thing to do. I just need to add this to the next release notes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, Shellcheck found this and I'm pretty sure this change fixes a bunch of Qt related snap issues

common.mk Show resolved Hide resolved
common.mk Outdated Show resolved Hide resolved
requirements-noble.txt Show resolved Hide resolved
schema/snapcraft.json Outdated Show resolved Hide resolved
snap/snapcraft.yaml Outdated Show resolved Hide resolved
snapcraft_legacy/internal/mountinfo.py Show resolved Hide resolved
tests/spread/core24/set-version-twice/task.yaml Outdated Show resolved Hide resolved
@bepri
Copy link
Contributor Author

bepri commented Feb 3, 2025

I'm wondering if this PR is a good time to merge starbase's git history into Snapcraft. The advantage of doing this is that subsequent starbase commits can be brought into Snapcraft with small and easy git merges.

That's the plan! I'm leaving that rebase out of this PR until it's time to merge so that the commit history is easier on reviewers.

@medubelko medubelko mentioned this pull request Feb 5, 2025
4 tasks
@bepri bepri force-pushed the work/starflow-migration branch from 4df5913 to 772dc69 Compare February 6, 2025 22:32
@bepri
Copy link
Contributor Author

bepri commented Feb 6, 2025

@medubelko If you'd like, the documentation changes on this PR worth reviewing are as follows:

  • Deleted manual-tests.md, it had a lot of outdated information.
  • Migrated the little bit of useful information remaining in TESTING.md into HACKING.md and then deleted the former.
  • Changed the "Code style" listed in the README to "ruff" (very minor, haha)
  • Created new environment setup instructions to HACKING.md.

Points #2 and #4 are probably the most important to get right here. Let me know if you get any questions!

bepri added 23 commits February 7, 2025 14:01
This commit doesn't remove any entries, it only organizes them into nice categories
The only part of TESTING.md that remained relevant to modern Snapcraft was the information on Spread, which itself was slightly out of date. This migrates that Spread info to HACKING.MD and deletes the rest.
requirements-noble.txt cannot be built by Trivy and there's
no reason for us to scan spread tests
@bepri bepri force-pushed the work/starflow-migration branch from 46706b0 to 2625d63 Compare February 7, 2025 20:23
Makefile Show resolved Hide resolved
HACKING.md Outdated Show resolved Hide resolved
### Tooling

We use a large number of tools for our project. Most of these are installed for
you with `make setup`, but you'll need to install Python 3.12 separately.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we specify APT here, too?

If make setup throws without it, it feels safe to say that it's a requirement, and anyone who wants to develop without it must replicate the installation on their own.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think calling apt a "requirement" feels a bit weird to me. I suppose, strictly speaking, it is a requirement to use our automated "setup" step, but it isn't strictly a requirement to (for example) run any of the tests as once your environment is already set up, you'll never touch it.

It's also worth noting that this PR doesn't introduce anything new for apt to install. There were always "ghost" system package dependencies that you just had to trial & error your way through installing in order to get all of the tests to run.

Curious what others think, though.

Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need apt, it's just that if you don't have apt you have to install the packages for your development environment yourself. So not a requirement, but a convenience. That's also why we use the warning function (not error) if we don't detect certain packages but you don't have apt.

HACKING.md Outdated Show resolved Hide resolved
HACKING.md Outdated Show resolved Hide resolved
HACKING.md Show resolved Hide resolved
HACKING.md Outdated Show resolved Hide resolved
HACKING.md Outdated Show resolved Hide resolved
HACKING.md Outdated Show resolved Hide resolved
HACKING.md Outdated Show resolved Hide resolved
bepri and others added 4 commits February 7, 2025 15:55
Co-authored-by: Michael DuBelko <[email protected]>
…ugin

This commit fixes an issue where the crystal plugin would fork without snap-related environment variables, which messed up the code path for detecting legacy snapcraft's data files.
env = dict(LANG="C.UTF-8", LC_ALL="C.UTF-8", SNAP=os.getenv("SNAP"), SNAP_NAME=os.getenv("SNAP_NAME"))
# Make sure snap-related environment variables survive through the shell call
snap_dict = {}
for key in ["SNAP", "SNAP_NAME"]:
Copy link
Collaborator

@mr-cal mr-cal Feb 7, 2025

Choose a reason for hiding this comment

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

> snap run --shell snapcraft
> env | sort | grep "SNAP"
SNAP_ARCH=amd64
SNAP_COMMON=/var/snap/snapcraft/common
SNAP_CONTEXT=dbaQtG7ZJyq_4g-xsNR4-ISbCA2g_cyukr1Y_lMObylQD1nyqEU9
SNAP_COOKIE=dbaQtG7ZJyq_4g-xsNR4-ISbCA2g_cyukr1Y_lMObylQD1nyqEU9
SNAP_DATA=/var/snap/snapcraft/x1
SNAP_EUID=1000
SNAP_INSTANCE_KEY=
SNAP_INSTANCE_NAME=snapcraft
SNAP_LIBRARY_PATH=/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void
SNAP_NAME=snapcraft
SNAP_REAL_HOME=/home/developer
SNAP_REEXEC=
SNAP_REVISION=x1
SNAP=/snap/snapcraft/x1
SNAP_UID=1000
SNAP_USER_COMMON=/home/developer/snap/snapcraft/common
SNAP_USER_DATA=/home/developer/snap/snapcraft/x1
SNAP_VERSION=8.6.0.post1+git664560802

Looking at the latest failure, this may be more robust if you grab everything that begins with SNAP, rather than the slippery slope of adding one envvar at a time.

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