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

No such file or directory #3

Closed
sschizas opened this issue May 9, 2022 · 8 comments
Closed

No such file or directory #3

sschizas opened this issue May 9, 2022 · 8 comments

Comments

@sschizas
Copy link

sschizas commented May 9, 2022

I have a project with SPM and Cocoapods dependencies and I have the action running in order to check for outdated SPM:

name: Xcode Dependencies

on:
  schedule:
    - cron: '0 6 * * 1' # Monday at 06:00 UTC

permissions:
  contents: write
  pull-requests: write

jobs:
  dependencies:
    runs-on: macos-latest

    steps:
      - uses: actions/checkout@v3
      
      - name: Disable cleaning old versions @ brew
        run: export HOMEBREW_NO_INSTALL_CLEANUP=true

      - name: Resolve Dependencies
        id: resolution
        uses: GetSidetrack/action-xcodeproj-spm-update@main
        with:
          forceResolution: true
          failWhenOutdated: false

      - name: Create Pull Request
        if: steps.resolution.outputs.dependenciesChanged == 'true'
        uses: peter-evans/create-pull-request@v4
        with:
          branch: 'dependencies/ios'
          delete-branch: true
          commit-message: 'Bump SPM dependencies versions'
          title: 'Bump SPM dependencies versions'

And I get the following error:

Run GetSidetrack/action-xcodeproj-spm-update@main
[6](https://github.com/bluegroundltd/guest-app-ios/runs/6346686732?check_suite_focus=true#step:4:6)
Run brew install md5sha1sum
[9](https://github.com/bluegroundltd/guest-app-ios/runs/6346686732?check_suite_focus=true#step:4:9)
==> Downloading https://ghcr.io/v2/homebrew/core/md5sha1sum/manifests/0.9.5_1
[10](https://github.com/bluegroundltd/guest-app-ios/runs/6346686732?check_suite_focus=true#step:4:10)
==> Downloading https://ghcr.io/v2/homebrew/core/md5sha1sum/blobs/sha256:c3ce2a7048d5e035493c2f637249da99f726109a9a643498576441c4c9ec7d58
[11](https://github.com/bluegroundltd/guest-app-ios/runs/6346686732?check_suite_focus=true#step:4:11)
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:c3ce2a7048d5e035493c2f637249da99f726109a9a643498576441c4c9ec7d58?se=2022-05-09T06%3A15%3A00Z&sig=SGX47H8hyDKyGVXVatxJckMzuvU8e2DeqiUGCZpWo0U%3D&sp=r&spr=https&sr=b&sv=2019-12-12
[12](https://github.com/bluegroundltd/guest-app-ios/runs/6346686732?check_suite_focus=true#step:4:12)
==> Pouring md5sha1sum--0.9.5_1.big_sur.bottle.tar.gz
[13](https://github.com/bluegroundltd/guest-app-ios/runs/6346686732?check_suite_focus=true#step:4:13)
🍺  /usr/local/Cellar/md5sha1sum/0.9.5_1: 8 files, 74.6KB
[14](https://github.com/bluegroundltd/guest-app-ios/runs/6346686732?check_suite_focus=true#step:4:14)
==> Running `brew cleanup md5sha1sum`...
[15](https://github.com/bluegroundltd/guest-app-ios/runs/6346686732?check_suite_focus=true#step:4:15)
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
[16](https://github.com/bluegroundltd/guest-app-ios/runs/6346686732?check_suite_focus=true#step:4:16)
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
[17](https://github.com/bluegroundltd/guest-app-ios/runs/6346686732?check_suite_focus=true#step:4:17)
Run echo "/Users/runner/work/_actions/GetSidetrack/action-xcodeproj-spm-update/main" >> $GITHUB_PATH
[20](https://github.com/bluegroundltd/guest-app-ios/runs/6346686732?check_suite_focus=true#step:4:20)
Run entrypoint.sh -a "." -b "true" -c "false"
[23](https://github.com/bluegroundltd/guest-app-ios/runs/6346686732?check_suite_focus=true#step:4:23)
shasum: ./SwiftPackages/Sourcery/Package.resolved
[24](https://github.com/bluegroundltd/guest-app-ios/runs/6346686732?check_suite_focus=true#step:4:24)
./Blueground.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
[25](https://github.com/bluegroundltd/guest-app-ios/runs/6346686732?check_suite_focus=true#step:4:25)
./Blueground.xcworkspace/xcshareddata/swiftpm/Package.resolved
[26](https://github.com/bluegroundltd/guest-app-ios/runs/6346686732?check_suite_focus=true#step:4:26)
./Danger-Swift/Package.resolved: No such file or directory
[27](https://github.com/bluegroundltd/guest-app-ios/runs/6346686732?check_suite_focus=true#step:4:27)
Error: Process completed with exit code 1.

But the file ./Danger-Swift/Package.resolved exists.

@alexandersandberg
Copy link

@sschizas Did you manage to fix this? We're having the same problem.

@ghost
Copy link

ghost commented Aug 24, 2022

@Sherlouk : Can we please resolve this issue?

@Sherlouk
Copy link
Contributor

Thank you @thapli9A for tagging me, I can only apologise but it looks like I forgot to watch this repository so I haven't been receiving notifications for bugs like this one here. I haven't intentionally been ignoring it.

I believe what's happening here is that the project is expecting just one Package.resolved file to exist in the directory specified (or root, by default). In your case it looks to be picking up on three different files.

I believe it's then trying to generate a checksum based on a string of all paths combined. So it's not looking for ./Danger-Swift/Package.resolved but instead essentially doing this:

shasum "./Blueground.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved ./Blueground.xcworkspace/xcshareddata/swiftpm/Package.resolved ./Danger-Swift/Package.resolved"

Which in turn is then failing. What I think we need to do to resolve this is handle the situation where multiple are found and hash them all individually and combine the hash so that if any change then the script works as expected.

I've added this to my TODO and can only apologise once again for the delay in getting back to you.

@ghost
Copy link

ghost commented Aug 24, 2022

@Sherlouk : No worries. But it's a matter of urgency that we needed this package. The dependent bot doesn't support SPM as of now. And this very interesting alternative we have. Thanks for replying :)

Sherlouk added a commit that referenced this issue Aug 24, 2022
Allow users to provide a workspace path (and accompanying scheme) to the xcodebuild commands as opposed to inferring the Xcode project which it has done until now.

This will hopefully address a few users concerns and may contribute towards a solution for issue #3 which appears to contain a workspace.
Sherlouk added a commit that referenced this issue Aug 24, 2022
Allow users to provide a workspace path (and accompanying scheme) to the xcodebuild commands as opposed to inferring the Xcode project which it has done until now.

This will hopefully address a few users concerns and may contribute towards a solution for issue #3 which appears to contain a workspace.
@Sherlouk
Copy link
Contributor

This should now be fixed with version 0.2.0.

It appears this was more of an issue of not supporting workspaces (which I can see from your debug code you're using!). This is now supported and documented in the README.

There is definitely an issue around multiple files being returned by the find command, this may still happen if you have multiple Xcode projects in a single directory and aren't using a workspace. I believe this use-case is rather limited and so haven't addressed it with 0.2.0 - if folks do run into this though please do raise a new issue and we can look into it.

Apologies for the delay once again!

@alexandersandberg
Copy link

@Sherlouk Thanks for fixing this!

There is definitely an issue around multiple files being returned by the find command, this may still happen if you have multiple Xcode projects in a single directory and aren't using a workspace. I believe this use-case is rather limited and so haven't addressed it with 0.2.0 - if folks do run into this though please do raise a new issue and we can look into it.

We have broken up parts of our project into smaller local SPM packages (e.g. Core, Business, Component) that live in the root folder.

The action works if we provide a workspace argument, as it finds a Package.resolved file:

Identified Package.resolved at '{Project}.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved'.

However, it ignores the other packages. I'm guessing this case is not supported yet? Are there any workarounds?

@Sherlouk
Copy link
Contributor

Hey @alexandersandberg, feel free to raise a new issue to explore this further but I'd love to better understand your architecture here.

One thing to note is that this action is specifically for Xcode projects (and now I suppose workspaces) as opposed to dependencies in Swift Packages themselves. For updating the dependencies listed in a Swift Package itself, you should likely explore this action which is also linked in the README and was the inspiration for this project 😄

So from the screenshot, it may make sense to have both of these actions in a single pipeline. One would update the dependencies listed in your Xcode project (or workspace), and the other would update the dependencies in each of your local packages (CoreKit, BusinessKit, ComponentKit, etc). Does this make sense? - and for the record, this pattern is something I'm doing in my own project 👍

Again, feel free to raise another issue (I'm following the repo now so I'll see it 😂) and especially if you can generate a quick example project just showing where you define your dependencies that would be awesome.

@alexandersandberg
Copy link

So from the screenshot, it may make sense to have both of these actions in a single pipeline. One would update the dependencies listed in your Xcode project (or workspace), and the other would update the dependencies in each of your local packages (CoreKit, BusinessKit, ComponentKit, etc). Does this make sense? - and for the record, this pattern is something I'm doing in my own project 👍

This sounds like the way to go—I will give it a try. Thanks! 🙂

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

No branches or pull requests

3 participants