Add input for custom command in firebase emulators:exec #81
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add option to run custom command right before fastlane in emulator execution.
♻️ Current situation & Problem
In the ENGAGE-HF project, when we seed the emulator using the
npm run serve:seeded
command, the following command executes under the hood:firebase emulators:exec --only auth,firestore,functions,storage --ui "npm run serve:seed && read -rd \"\""
. This spins up an emulator instance for the duration of the execution of the"npm run serve:seed && read -rd \"\""
calls.npm run serve:seed
executes the required functions to seed the emulator, and theread -rd \"\"
then causes the emulator to continue running until the user cancels the operation.However, when integrating the seeding functionality into the CI for ENGAGE, we need to be able to have a seeded instance of the emulator for the duration of the fastlane testing call. The
read -rd \"\"
won't work for the self-hosted runner, as there is no way to cancel the emulator without canceling the workflow. Instead, we can introduce an input to the build-and-test workflow that allows us to pass a custom command to execute right before thefastlane test
call. This custom command will then stay in effect throughout the lifespan of the emulator, which will shut down after the fastlane process finishes.⚙️ Release Notes
customfirebaseemulatorcommand
fastlanelane
argument is not empty, thesetupfirebaseemulator
argument is true, and thefirebaseemulatorimport
is empty.Currently, the workflow executes the following command to run the fastlane tests if there is no firebase import provided:
firebase emulators:exec 'fastlane ${{ inputs.fastlanelane }}'
Instead, we replace this with the following:
This allows the following emulator command to be run:
firebase emulators:exec 'npm run serve:seed && fastlane test'
📚 Documentation
See description of
customfirebaseemulatorcommand
inxcodebuild-or-fastland.yml
.✅ Testing
NA
Code of Conduct & Contributing Guidelines
By submitting creating this pull request, you agree to follow our Code of Conduct and Contributing Guidelines: