touchlab / KMMBridge

KMMBridge is a set of Gradle tooling that facilitates publishing and consuming pre-built KMM (Kotlin Multiplatform Mobile) Xcode Framework binaries. See https://kmmbridge.touchlab.co/docs to get started.
https://kmmbridge.touchlab.co/
Apache License 2.0
339 stars 20 forks source link

Investigate running on self-hosted runners #208

Closed russhwolf closed 2 months ago

russhwolf commented 1 year ago

Some folks have asked about using self-hosted runners for the github action and mentioned running into issues. Naively there shouldn't be any difference, but we should give this a try internally and see if there's any changes we need to make to support it.

If you're trying this yourself and hit issues, feel free to leave details here.

mdivkovic-speech commented 1 year ago

Hi @russhwolf, my team needs this option. We have a Mac Mini build server in-house and want to use that as a runner. As you may know, building on a GitHub hosted Mac runner consumes 10x the credits that a Linux runner does, and we don't want to be limited by that.

My understanding is that you could modify your workflows to parametrize the runs-on statement, as described here.

on:
  workflow_call:
    inputs:
      runs-on:
        type: string
        default: '["windows-latest"]'
jobs:
  myjoba:
    runs-on: ${{fromJSON(inputs.runs-on)}}
    outputs:
      myout: myin
    steps:
    - run: echo Hello World

Calling it like this:

on: push
jobs:
  comp:
    name: comp-${{toJSON(strategy)}}
    uses: ChristopherHX/newcomposite-sample/.github/workflows/weirdworkflow.yml@reusable-workflows
    with:
      runs-on: '["self-hosted", "linux"]'

You could still keep macos-12 as the default, for those who want to use it with GitHub's runner.

Looking forward to your reply!

russhwolf commented 1 year ago

That sounds reasonable @mdivkovic-speech. I definitely would want to keep macos-12 as the default, but having the host as an optional parameter makes sense. Do you want to make a PR against KMMBridgeGithubWorkflow?

russhwolf commented 1 year ago

Did some testing here and I thought I had it working until I realized that github apparently limits self-hosted runners to only call reusable workflows from the same org. So I think there might actually not be anything that can be done here beyond just copying our workflow to your own repo and changing runs-on there.

I'm still going to add the parameter though because it might be useful for people who need to switch what macos version they run on.

mdivkovic-speech commented 1 year ago

@russhwolf sorry for the very late reply and thank you for the update!

To summarize:

That about right?

russhwolf commented 1 year ago

Yeah, that's the best solution I see at the moment. I don't love it though. Definitely open to other ideas if people have them.

kpgalligan commented 2 months ago

I'm going to close this for now. Future version will be a much simpler default workflow.