Skip to content

ci: re-enable macOS smoke tests without Homebrew libgit2 - #2907

Open
Omjaiswal26 wants to merge 5 commits into
canonical:mainfrom
Omjaiswal26:issue-2605-reenable-macos-smoke-tests
Open

Omjaiswal26 wants to merge 5 commits into
canonical:mainfrom
Omjaiswal26:issue-2605-reenable-macos-smoke-tests

Conversation

@Omjaiswal26

Copy link
Copy Markdown

Summary

  • Re-enable macos-smoke-test on macos-14 / macos-14-large without Homebrew libgit2@1.7, using the pygit2 wheel's vendored libgit2.
  • Stop installing Homebrew libgit2 in install-macos-build-deps.
  • Run uv lock after charmcraft init so the machine-profile (uv plugin) pack can succeed.

Fixes #2605

Test plan

  • Local: make setup on Apple Silicon (no Homebrew libgit2)
  • Local: pygit2 imports with vendored .dylibs
  • Local: Multipass init + uv lock + pack → *.charm
  • Local: pre-commit / prettier on changed files
  • Local: make test-fast (3 pre-existing platforms-multi-base failures on Apple Silicon; unrelated)
  • CI: macos-smoke-test passes on macos-14 and macos-14-large

  • I've followed the contribution guidelines.
  • I've signed the CLA.
  • I've successfully run make lint && make test. (N/A — CI/Makefile smoke re-enable; verified with local Multipass pack, pre-commit, and make test-fast)
  • I've added or updated any relevant documentation.
  • In documents I changed, I added a meta description if one was missing.
  • I've updated the relevant release notes.

@Omjaiswal26
Omjaiswal26 requested a review from lengau as a code owner October 1, 2026 10:02
Comment thread .github/workflows/tests.yaml Fixed
Comment thread .github/workflows/tests.yaml Fixed
Comment thread .github/workflows/tests.yaml Fixed
Comment thread .github/workflows/tests.yaml Fixed
Comment thread .github/workflows/tests.yaml Fixed
Comment thread .github/workflows/tests.yaml Fixed
Comment thread .github/workflows/tests.yaml Resolved
assert dylibs.is_dir(), 'expected vendored libgit2 from a pygit2 wheel'
print(f'pygit2 {pygit2.__version__} libgit2 {pygit2.LIBGIT2_VERSION}')
"
- name: Check for fully-configured multipass

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We actually have to do significantly more for multipass now. We debugged this at canonical/multipass#4588

The short version is to copy these bits: https://github.com/lengau/setup-multipass/blob/d7ac69cac08d7d82da2518868b1ffe742a607e33/action.yaml#L35-L46

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks — applied the setup-multipass workaround from the linked action (wait on multipass list, find --force-update, passphrase + sudo wrapper for canonical/multipass#4588). Also pinned the smoke-job Actions to SHAs for zizmor. Ready for another look / CI once workflows are approved.

@Omjaiswal26
Omjaiswal26 force-pushed the issue-2605-reenable-macos-smoke-tests branch from fafdf71 to 48a7338 Compare October 4, 2026 20:07
Comment on lines +105 to +106
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Comment thread .github/workflows/tests.yaml Resolved
charmcraft init --profile=machine
# Machine profile uses the uv plugin, which requires a lockfile to pack.
uv lock
charmcraft pack

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

2026-10-05 16:19:44.655 Project file found at /root/project/charmcraft.yaml
Traceback (most recent call last):
  File "/snap/charmcraft/8265/bin/charmcraft", line 12, in <module>
    sys.exit(main())
             ^^^^^^
  File "/snap/charmcraft/8265/lib/python3.12/site-packages/charmcraft/application/main.py", line 201, in main
    return app.run()
           ^^^^^^^^^
  File "/snap/charmcraft/8265/lib/python3.12/site-packages/craft_application/application.py", line 544, in run
    self._initialize_craft_parts()
  File "/snap/charmcraft/8265/lib/python3.12/site-packages/craft_application/application.py", line 643, in _initialize_craft_parts
    self._register_default_plugins()
  File "/snap/charmcraft/8265/lib/python3.12/site-packages/craft_application/application.py", line 460, in _register_default_plugins
    if plugins := self._get_app_plugins():
                  ^^^^^^^^^^^^^^^^^^^^^^^
  File "/snap/charmcraft/8265/lib/python3.12/site-packages/charmcraft/application/main.py", line 129, in _get_app_plugins
    full_build_plan = self.services.get("build_plan").create_build_plan(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/snap/charmcraft/8265/lib/python3.12/site-packages/craft_application/services/buildplan.py", line 143, in create_build_plan
    raw_project = project_service.get_raw()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/snap/charmcraft/8265/lib/python3.12/site-packages/craft_application/services/project.py", line 208, in get_raw
    return copy.deepcopy(self._load_raw_project())
                         ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/snap/charmcraft/8265/lib/python3.12/site-packages/craft_application/services/project.py", line 197, in _load_raw_project
    with project_path.open() as project_file:
         ^^^^^^^^^^^^^^^^^^^
  File "/snap/charmcraft/current/usr/lib/python3.12/pathlib.py", line 1015, in open
    return io.open(self, mode, buffering, encoding, errors, newline)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/root/project/charmcraft.yaml'

Interesting... I would guess this is some side-effect of the permissions stuff we did with multipass?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Agreed that this looks like a side-effect of the sudo multipass wrapper: mounts run as root while the project is owned by the runner user.

Would chmod -R a+rX . before pack be an acceptable smoke-test workaround, or do you prefer something else (e.g. UID maps in craft-providers)?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yeah I think the permissions stuff is fine. We're already deviating from what a macos desktop would look like. Thanks!

Comment thread Makefile Outdated
Comment on lines 141 to 143
# libgit2 is provided by the pygit2 macOS wheel; do not brew install libgit2@1.7
# (deprecated/unavailable). See https://github.com/canonical/charmcraft/issues/2605
endif

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# libgit2 is provided by the pygit2 macOS wheel; do not brew install libgit2@1.7
# (deprecated/unavailable). See https://github.com/canonical/charmcraft/issues/2605
endif
endif

Omjaiswal26 and others added 4 commits October 7, 2026 02:17
Use the pygit2 wheel's vendored libgit2 and run uv lock before pack
so the machine profile smoke test can succeed. Fixes canonical#2605.
Signed-off-by: Alex Lowe <alex.lowe@canonical.com>
@Omjaiswal26
Omjaiswal26 force-pushed the issue-2605-reenable-macos-smoke-tests branch from 218fcd8 to 88ac61c Compare October 6, 2026 20:48
@lengau
lengau self-requested a review October 6, 2026 22:21
Signed-off-by: Alex Lowe <alex.lowe@canonical.com>
@lengau

lengau commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

@Omjaiswal26 it looks like there's still a permissions issue with the macos smoke test :-/

@lengau lengau left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is still failing :/

@Omjaiswal26

Copy link
Copy Markdown
Author

yeah, chmod didn't fix it. ci still fails opening /root/project/charmcraft.yaml inside the vm.

i've found two possible ways to keep pack:

  1. pass a uid/gid map. multipass.py already supports --uid-map / --gid-map, but the project mount never passes them. we'd map the runner user to 0 so the files look like root's in the vm. that change is in craft-providers and craft-application.

  2. copy the project into the vm, pack there, and copy the .charm back. workaround only in this workflow.

i'd rather do (1). what do you think?

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.

Re-enable MacOS tests

3 participants