Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added override of flutter version #114

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ To enable testing on a flavor add the following to your sylph.yaml:
flavor: <name of flavor>
```

## Flutter version

Sylph will default to flutter version `v1.12.13+hotfix.8-stable` to execute the tests in AWS but this can be overriden by setting the `FLUTTER_VERSION` environment variable to the version of your choice.

# Configuring a CI Environment for _Sylph_
In addition to running from the command line, _Sylph_ also runs in a CI environment.

Expand Down
1 change: 0 additions & 1 deletion lib/resources/test_spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ phases:

# install flutter
- echo "Install flutter"
- FLUTTER_VERSION='v1.12.13+hotfix.8-stable'
- >-
if [ $DEVICEFARM_DEVICE_PLATFORM_NAME = "Android" ];
then
Expand Down
10 changes: 9 additions & 1 deletion lib/src/resources.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const kAWSCredentialsEnvVars = ['AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY'];

// substitute names
const kAppIdentifier = 'APP_IDENTIFIER';
const kFlutterVersion = 'FLUTTER_VERSION';

/// Unpacks resources found in package into [tmpDir].
/// Appium template is used to deliver tests.
Expand All @@ -43,7 +44,8 @@ Future<void> unpackResources(String tmpDir, bool isIosPoolTypeActive,
'$tmpDir/$kAppiumTemplateZip');

// unpack Appium test spec
await unpackFile(kAppiumTestSpecName, tmpDir);
final testSpecNameVals = { 'FLUTTER_VERSION': getFlutterVersion() };
await unpackFile(kAppiumTestSpecName, tmpDir, nameVals: testSpecNameVals);

// unpack scripts
await unpackScripts(tmpDir);
Expand Down Expand Up @@ -138,3 +140,9 @@ String getIosAppIdentifier(String appDir) {
final iOSConfigStr = fs.file(kIosConfigPath).readAsStringSync();
return RegExp(regExp).firstMatch(iOSConfigStr)[1];
}

/// Gets the predefined or overriden flutter version to use
String getFlutterVersion() {
const defaultVersion = 'v1.12.13+hotfix.8-stable';
return platform.environment[kFlutterVersion] ?? defaultVersion;
}