Package config provides data structures and functions to configure Device Farm testing.
Repositories using the devicefarm tool will provide a devicefarm.yml file in the repository root. The config.New() function parses this config from a file into a config.Config struct:
config, err := config.New("path/to/config.yml")
Here is an annotated example of what a config file should look like:
# Project ARN. This property is REQUIRED. project_arn: arn:aws:devicefarm:us-west-2:026109802893:project:1124416c-bfb2-4334-817c-e211ecef7dc0 # Device Pool definitions. this block defines three Device Pools: # samsung_s4, samsung_s5, and everything. The everything pool # simply includes both the other pools. # # This property is REQUIRED, must have at least one pool defined, # and each pool must have at least one device. devicepool_definitions: samsung_s4: - (arn=device:D1C28D6B913C479399C0F594E1EBCAE4) Samsung Galaxy S4 (AT&T) - (arn=device:33F66BE404B543669978079E905F8637) Samsung Galaxy S4 (Sprint) - (arn=device:D45C750161314335924CE0B9B7D2558E) Samsung Galaxy S4 (T-Mobile) samsung_s5: - (arn=device:5CC0164714304CBF81BB7B7C03DFC1A1) Samsung Galaxy S5 (AT&T) - (arn=device:18E28478F1D54525A15C2A821B6132FA) Samsung Galaxy S5 (Sprint) - (arn=device:5931A012CB1C4E68BD3434DF722ADBC8) Samsung Galaxy S5 (T-Mobile) everything: - +samsung_s4 - +samsung_s5 # Defaults defines the build config that will be used for all branches, # unless overrides are specified in the branches section. # # This property is OPTIONAL, but building will fail on a particular branch # unless a full definition is available for that branch. defaults: # The bash commands to run for this build. build: - echo "Foo" - echo "Bar" # The location of APK files, after build commands have been run. android: apk: ./path/to/build.apk apk_instrumentation: ./path/to/instrumentation.apk # The device pool name that tests should be run on. devicepool: samsung_s4 # Branches defines overrides for particular branches. For each branch, # it accepts the same properties as `defaults`. Branch configs will be # merged with `defaults` so that the specified properties override the # same properties from `defaults`. In this example, only the `devicepools` # property will be overridden for the `master` branch. # # This property is OPTIONAL, but building will fail on a particular branch # unless a full definition is available for that branch. branches: master: devicepool: everything