I have a Unity project which could have one of three “workflows”:
mobile
: Should build the app for both Android and iOS
content
: Should build the same app with a different “start scene” (Unity jargon) for testers for Android only
web
: Should build the app for, well, web.
My goal is to re-use the android jobs in the mobile
workflow for the content
workflow since the build process is pretty much the same (with some exceptions that can be easily changed based on environment variables that differ per-branch) and have the web
workflow with its separate jobs.
The way I thought this would work (but isn’t) is to have every job in the mobile
workflow only execute on the build
branch. Similarly, every job in the content
workflow execute only on the build-content
branch. The same goes for the web
workflow with the build-web
branch.
What’s actually happening is that the first job in every workflow always runs. For example, when pushing to the build-web
branch, the following jobs are running:
run-web
-> test-web
-> upload-web
in the web
workflow (as desired),
run-android
and run-ios
only in the mobile
workflow (unexpected), and
run-android
only in the content
workflow (unexpected).
Here’s how the workflow section of my config.yml
looks like:
version: 2.1
executors:
# omitted for brevity
jobs:
run-android:
executor: docker-executor
steps:
- checkout
# the rest of the steps are omitted for brevity in every job
test-android:
executor: docker-executor
steps:
- checkout
upload-android:
executor: docker-executor
steps:
- checkout
run-ios:
executor: macos-executor
steps:
- checkout
test-ios:
executor: docker-executor
steps:
- checkout
upload-ios:
executor: docker-executor
steps:
- checkout
run-web:
executor: docker-executor
steps:
- checkout
test-web:
executor: docker-executor
steps:
- checkout
upload-web:
executor: docker-executor
steps:
- checkout
workflows:
version: 2
mobile:
jobs:
- run-android:
filters:
branches:
only: build
- run-ios:
filters:
branches:
only: build
- test-android:
filters:
branches:
only: build
requires:
- run-android
- test-ios:
filters:
branches:
only: build
requires:
- run-ios
- upload-android:
filters:
branches:
only: build
requires:
- test-android
- test-ios
# - upload-ios:
# filters:
# branches:
# only: build
# requires:
# - test-android
# - test-ios
content:
jobs:
- run-android:
filters:
branches:
only: build-content
- test-android:
filters:
branches:
only: build-content
requires:
- run-android
- upload-android:
filters:
branches:
only: build-content
requires:
- test-android
web:
jobs:
- run-web:
filters:
branches:
only: build-web
- test-web:
filters:
branches:
only: build-web
requires:
- run-web
- upload-web:
filters:
branches:
only: build-web
requires:
- test-web
Am I doing something wrong, or is this a bug?