tuist icon indicating copy to clipboard operation
tuist copied to clipboard

`tuist test` fails with certain post-build scripts

Open TheInkedEngineer opened this issue 2 years ago • 1 comments

Describe the bug and the expected behavior

Running tuist test fails when it contains swiftlint post build script

Reproduction steps

  • Add the following post build script to any project
/opt/homebrew/bin/swiftlint --config $(SRCROOT)/../.swiftlint.yml --fix
  • run tuist test

Error log

Testing failed:
	SwiftLint Configuration Error: Could not read file at path: /../.swiftlint.yml
	Testing cancelled because the build failed.

** TEST FAILED **

The following build commands failed:
	PhaseScriptExecution SwiftLint /Users/theinkedengineer/Library/Developer/Xcode/DerivedData/TrueLayerWorkspace-ewhtmuosfzuvrqbpnxnwjsridvzb/Build/Intermediates.noindex/SDK.build/Debug-iphonesimulator/TrueLayerLogger.build/Script-270212A678DE09FBD23F7A7E.sh (in target 'TrueLayerLogger' from project 'SDK')
(1 failure)
Resolve Package Graph
Resolved source packages
                 ^
[TrueLayerTestHelpers] Compiling Bundle+TrueLayerTestHelpers.swift
[TrueLayerLogger] Processing TrueLayerLogger.plist
[TrueLayerLogger] Running script SwiftLint
❌ error: SwiftLint Configuration Error: Could not read file at path: /../.swiftlint.yml
❌ error: SwiftLint Configuration Error: Could not read file at path: /../.swiftlint.yml
The 'xcodebuild' command exited with error code 65

Error screenshots

If applicable, add screenshots to help explain your problem.

Additional context

  • macOS version: 12.4
  • Tuist version: 3.4
  • Xcode version: 13.2, 13.3, 13.4

TheInkedEngineer avatar May 19 '22 11:05 TheInkedEngineer

More info on this slack thread

TheInkedEngineer avatar May 19 '22 12:05 TheInkedEngineer

I'm facing the same issue. Have you found any solution?

ladislas avatar Apr 02 '23 21:04 ladislas

Alright, I fixed it using the following:

# Leka - iOS Monorepo
# Copyright 2023 APF Frdance handicap
# SPDX-License-Identifier: Apache-2.0

if test -d "/opt/homebrew/bin"; then
    PATH="/opt/homebrew/bin:${PATH}"
elif test -d "/usr/local/bin"; then
    PATH="/usr/local/bin:${PATH}"
fi

export PATH

SCRIPT_PATH=$(realpath "$0")
SCRIPT_DIR=$(dirname "$SCRIPT_PATH")
ROOT_DIR=$(realpath "$SCRIPT_DIR/..")

if which swiftlint > /dev/null; then
	echo "ROOT_DIR: $ROOT_DIR"
	echo "SCRIPT_DIR: $SCRIPT_DIR"
    swiftlint --config $ROOT_DIR/.swiftlint.yml --reporter xcode $ROOT_DIR
else
    echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi

ladislas avatar Apr 03 '23 09:04 ladislas

Hola 👋,

We want to inform you that the issue has been marked as stale. This means that there hasn't been any activity or updates on it for quite some time, and it's possible that it may no longer be relevant or actionable. If you still believe that this issue is valid and requires attention, please provide an update or any additional information that can help us address it. Otherwise, we may consider closing it in the near future. Thank you for your understanding.

github-actions[bot] avatar Jul 20 '23 01:07 github-actions[bot]

Hola 👋,

We want to inform you that we have decided to close this stale issue as there hasn't been any activity or response regarding it after marking it as stale.

We understand that circumstances may have changed or priorities may have shifted, and that's completely understandable. If you still believe that this issue needs to be addressed, please feel free to reopen it and provide any necessary updates or additional information.

We appreciate your understanding and look forward to your continued contributions to the project.

Thank you.

github-actions[bot] avatar Jul 25 '23 02:07 github-actions[bot]