bazel-ios/rules_ios

Document steps to use rosetta to replicate github actions project stubs

jerrymarino opened this issue ยท 7 comments

Unless we drop the Intel github actions - You'll need to use rosetta to replicate our transitions / outputs as the CI does. It's not obvious how to replicate but rosetta 2 does a good job:

arch -arch x86_64 -c ~/Library/Caches/bazelisk/bin/bazelbuild/bazel-5.0.0-darwin-x86_64    run    tests/ios/xcodeproj:Test-With-Host-App-With-AdditionalPrebuildScript

When the community is fully on M1 laptops - it'll be good to have a way to recreate the intel stubs while github actions still has it

Should we update the test scripts to do this, so the tests pass out of the box on both arm and x86 machines?

The presense of this issue will help people and it'd be nice to improve some of the kinks here ๐Ÿšข

If only running the tests is you're after - you can run the test scripts wholesale under it:

arch -arch x86_64 -c tests/xcodeproj-tests.sh

FWIW, this is what I'm doing for 6.0.0, for example:

  1. Download Bazel release for x86_64 (https://github.com/bazelbuild/bazel/releases/tag/6.0.0, bazel-6.0.0-darwin-x86_64) to avoid any bazelisk runaround.
  2. Mark it as safe: xattr -d com.apple.quarantine /path/to/bazel/bazel-6.0.0-darwin-x86_64
  3. Use it: arch -arch x86_64 -c /path/to/bazel/bazel-6.0.0-darwin-x86_64 query 'kind("xcodeproj rule", tests/ios/xcodeproj/...)'

And this is likely mostly for my reference. ๐Ÿ˜†

Is this still working for folks? How are you updating the checked-in Xcode shims? I tried all the above but I can't replicate this workflow locally on latest master:

name: .xcodeproj Tests on Xcode 14.2.0
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: Select Xcode 14.2.0
run: .github/workflows/xcode_select.sh
- name: Run tests
run: ./tests/xcodeproj-tests.sh --clean && ./tests/test-tests.sh

This one:

arch -arch x86_64 -c tests/xcodeproj-tests.sh

gives me bazelisk command not found. I also tried to replace all bazelisk invocations with:

arch -arch x86_64 -c /path/to/bazel/bazel-6.0.0-darwin-x86_64 

But still if I run:

./tests/xcodeproj-tests.sh --clean && ./tests/test-tests.sh

I get:

ld: building for iOS Simulator, but linking in object file built for iOS, file 'external/TensorFlowLiteC/Frameworks/TensorFlowLiteCCoreML.framework/TensorFlowLiteCCoreML' for architecture arm64

It's been a while since I last updated these shims and I remember being able to run things locally before. What am I missing?

@thiagohmcruz in the parent issue I'm running Bazel directly to avoid problems with any wrappers people installed

arch -arch x86_64 -c ~/Library/Caches/bazelisk/bin/bazelbuild/bazel-5.0.0-darwin-x86_64    run    tests/ios/xcodeproj:Test-With-Host-App-With-AdditionalPrebuildScript

Bazelisk ( on github ) now has a fat binary, so you can probably simply add that onto your path and run the updater.. You might have hit a different issue.

You're running a single proj tests/ios/xcodeproj:Test-With-Host-App-With-AdditionalPrebuildScript. Have you tried running the same GH workflow as CI? i.e.:

./tests/xcodeproj-tests.sh --clean && ./tests/test-tests.sh

at least for me that is not working as described above. Will double check my bazelisk installation to make sure it's not the culprit here (still, if the bazelisk installation is relevant we should also document that).

I was able to get it to fully run adding arch -arch x86_64 in a few places but the ST-hashs are still off. I think this issue of documenting steps to replicate GH actions is the point here. It's not clear how one update the shims without knowing in details how things are setup in the repo.

Yeah it looks like there are still some hiccups if you try to run the entire script - perhaps I just used Bazel to download it originally. Let me add a command to update these, it's a huge pain for anyone that looks at the transition hashes until we move this to XCHammer .