Search code examples
cicdcodemagic

Is it with Codemagic possible to have multiple codemagic.yaml files?


I'm using Codemagic for my Flutter CI. For my repo, I'm using a monorepo structure. So I split my repository into +20 local packages. For every package, I'm running an own workflow (analyze, test, format, etc.).

Because of the high number of packages, becomes the codemagic.yaml to a massive file and the readability decreases.

With GitHub Actions, I'm able to split my workflows into multiple files, which increases the readability a lot (for every package a single file).


Solution

  • I asked the Codemagic Team an got this answer:

    Unfortunately we do not plan on introducing the feature to split configurations into multiple different files at this point.

    [But] there’s a couple of things you could look at doing. Firstly, take a look into using YAML anchors and aliases so you don’t repeat scripts. Here’s a guide and a sample codemagic.yaml. The other option is to use the Codemagic REST API to trigger your builds and pass app specific environment variables for the build. In this was you can has a single workflow which you pass the variables too. See more about the API here. There’s a few script samples here that show how to call it, and this yaml shows where the environment variables are overwritten.

    Source: https://codemagicio.slack.com/archives/CEKE2KZ37/p1645538193515549?thread_ts=1645537597.216489&cid=CEKE2KZ37