Open andr3a88 opened 3 years ago
I'd recommend using SwiftPM and caching your build dir probably
☝️ Yeah, it takes ~16 seconds here using SPM (also on Bitrise)
@rogerluan do you use a specific step on bitrise?
Nope, just a script directly:
swift run danger-swift ci --id 'Danger: Static Analysis' --dangerfile ./Dangerfile.swift
@rogerluan Is it possible to use SPM even if I don't use it in my main project? I don't want to create confusion in the root folder, do you have an example of a basic configuration?
Yes it is, I used to not use SPM in the main project either. I don't mean to be rude but you can check installation steps here https://danger.systems/swift/guides/getting_started.html#installation 🙈 It's pretty much creating a fake file in the project, and a Package.swift file in the root folder. Do notice, however that you'll have to open your project by clicking the .xcworkspace file and not the package.swift, to launch your main project. :)
@rogerluan thanks for the information.
I tried with this simple Package.swift
:
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "DangerSwiftBitriseStep",
dependencies: [
.package(name: "danger-swift", url: "https://github.com/danger/swift.git", from: "3.0.0")
],
targets: [
.target(name: "DangerSwiftBitriseStep", dependencies: ["danger-swift"], path: "Sources", sources: ["Fake.swift"]),
]
)
Locally works fine, when i run on Bitrise i have this error during git-clone step
fatal: No url found for submodule path 'DangerSwift/.build/checkouts/Logger' in .gitmodules
ERROR: submodule update: fatal: No url found for submodule path 'DangerSwift/.build/checkouts/Logger' in .gitmodules
I will see next week if I continue on this path, Bitrise many times makes me lose more time than necessary
Try this:
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "your-main-target-name",
dependencies: [
.package(name: "danger-swift", url: "https://github.com/danger/swift", from: "3.7.2"),
],
targets: [
// This is just an arbitrary Swift file in our app, that has
// no dependencies outside of Foundation, the dependencies section
// ensures that the library for Danger gets build also.
.target(name: "your-main-target-name", dependencies: [
.product(name: "Danger", package: "danger-swift"),
], path: "your-main-target-name", sources: [ "Fake.swift" ]),
]
)
FYI: Danger is pre-installed on Bitrise. If you cache the .build
directory it should actually be super fast
fatal: No url found for submodule path 'DangerSwift/.build/checkouts/Logger' in .gitmodules ERROR: submodule update: fatal: No url found for submodule path 'DangerSwift/.build/checkouts/Logger' in .gitmodules
I've run into this error as well. I'm not sure if I'm caching the .build
directory correctly. When I include it in our repo I get a git warning:
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint:
hint: git submodule add <url> .build/checkouts/Logger
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint: git rm --cached .build/checkouts/Logger
hint:
hint: See "git help submodule" for more information.
I'm sure I'm just missing something really basic or misunderstanding where things should be cached 😅
Oh nevermind. I was caching in the repo, not on the CI machine itself. 🤦🏼♂️
Hi, do you know a way to speed up the installation of danger-swift on Bitrise? Currently it takes me 4 minutes for the step
Step detail: