Closed gsl-anthonymerle closed 9 months ago
Hello @gsl-anthonymerle Thank you for taking the time to report this issue I will take a look at it later
My pleasure, thanks @Nikoloutsos
@gsl-anthonymerle Your code helped reproduce the issue. At first, I tried running without any SPM dependencies and it was working but whenever I added at least one SPM dependency it was always failing.
The problem looks like is that swift test
tries to resolve the packages but Github refuses to provide it.
After some debugging I found this on swift forum which explains the problem.
Workaround: Change the Package.swift to use SSH authentication:
dependencies: [
.package(
- url: "https://github.com/approvals/ApprovalTests.Swift",
+ url: "git@github.com:approvals/ApprovalTests.Swift.git"
branch: "master"
),
],
In the future I will try to fix this so that muter is running seamlessly on SPM packages with dependencies.
🎁 Bonus tip: There is no need for you to exclude the Package.swift on the configuration since it is excluded by default. This was added in latest commit d44e78d
@rakaramos @ZevEisenberg A solution needs to be provided for this problem that will be happening on every muter run on SPM with at least one dependency. With that in mind, I want your opinion on implementing the following solution:
The developer will have the ability to provide environment variables through muter configuration. So in this Usecase the user would give the following env var and we would would set it like this which will solve the problem.
process.environment = ["PATH": "/usr/local/bin:/usr/bin:/bin"] // Found this from swift forums
That way not only will we solve this problem but we will also give the ability to developer to set env vars which may be needed.
What do you think about this?
Hi @Nikoloutsos,
Thank you for your answer 🙏 Unfortunately, changing the http url to a git one doesn't change much, and I now get the following error:
Fetching git@github.com:approvals/ApprovalTests.Swift.git from cache
warning: 'approvaltests.swift': skipping cache due to an error: Couldn’t fetch updates from remote repositories:
Fetching git@github.com:approvals/ApprovalTests.Swift.git from cache
warning: 'approvaltests.swift': skipping cache due to an error: Couldn’t fetch updates from remote repositories:
error: Failed to clone repository git@github.com:approvals/ApprovalTests.Swift.git:
Is it something you ran into as well ?
Side note: I was using the Homebrew version, but I think it doesn't ship the latest changes that you talked before (like automatically ignoring Package.swift etc.), so I have now installed muter from the git repository
Hello @gsl-anthonymerle 👋 Sorry for the late response, I just came back from holidays 😄
IIRC it was working fine for me, have you setup ssh for Github? Probably now if you run the following on your terminal it is going to fail.
git clone git@github.com:gsl-anthonymerle/MuterPackageFailure.git
Take a look here and here on how you can generate an SSH key and add it into Github.
@rakaramos @ZevEisenberg A solution needs to be provided for this problem that will be happening on every muter run on SPM with at least one dependency. With that in mind, I want your opinion on implementing the following solution:
The developer will have the ability to provide environment variables through muter configuration. So in this Usecase the user would give the following env var and we would would set it like this which will solve the problem.
process.environment = ["PATH": "/usr/local/bin:/usr/bin:/bin"] // Found this from swift forums
That way not only will we solve this problem but we will also give the ability to developer to set env vars which may be needed.
What do you think about this?
Thanks for the investigation! I think that a better approach is to copy all the env vars from the process info to the underlying muter process, I'll run a few tests and will issue a PR if it fixes it.
Hi,
I'm trying Muter and it works great when running against an application code. Unfortunately, I couldn't manage to run it for a standalone Swift Package.
When I run
muter
, it shows the following output:Here is a link to a Githup repo with the exact same Package, so that you may test on your end: https://github.com/gsl-anthonymerle/MuterPackageFailure
Do I do anything wrong ? Or is it something else ?
I have an M1 Macbook pro, MacOS Sonoma 14.1 (23B74) Xcode Version 15.0.1 (15A507)
Best regard, Anthony