Skip to content
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
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,13 @@ Installing app on device...
```
$ flutterpi_tool run -d pi5 --profile
```

### 7. Building with artifacts pinned to a specific GitHub Actions run
```console
$ flutterpi_tool build --release \
--github-artifacts-runid=23382732417 \
--github-artifacts-engine-version=052f31d115eceda8cbff1b3481fcde4330c4ae12
```

This is useful when you want `build` to use workflow artifacts from a specific
run instead of the default release-based artifact lookup.
1 change: 1 addition & 0 deletions lib/src/cli/commands/build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class BuildCommand extends FlutterpiCommand {
usesDartDefineOption();
usesTargetOption();
usesLocalFlutterpiExecutableArg(verboseHelp: verboseHelp);
usesGithubWorkflowArtifactsArgs(verboseHelp: verboseHelp);
usesFilesystemLayoutArg(verboseHelp: verboseHelp);

argParser
Expand Down
32 changes: 32 additions & 0 deletions lib/src/cli/flutterpi_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,38 @@ mixin FlutterpiCommandMixin on fl.FlutterCommand {
);
}

void usesGithubWorkflowArtifactsArgs({bool verboseHelp = false}) {
argParser
..addOption(
'github-artifacts-repo',
help:
'Use workflow artifacts from the specified GitHub repository instead of release artifacts.',
valueHelp: 'owner/name',
hide: !verboseHelp,
)
..addOption(
'github-artifacts-runid',
help:
'Use workflow artifacts from the specified GitHub Actions run id.',
valueHelp: 'run id',
hide: !verboseHelp,
)
..addOption(
'github-artifacts-engine-version',
help:
'Restrict workflow artifact lookup to the specified engine version.',
valueHelp: 'engine version',
hide: !verboseHelp,
)
..addOption(
'github-artifacts-auth-token',
help:
'Use this GitHub token when querying private or rate-limited workflow artifacts.',
valueHelp: 'token',
hide: !verboseHelp,
);
}

void usesRotationArg() {
argParser.addOption(
'rotation',
Expand Down
41 changes: 41 additions & 0 deletions test/commands/build_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -671,4 +671,45 @@ void main() {
reason: "Expected BuildSystem.build to be called",
);
});

test('accepts github workflow artifact flags', () async {
var buildWasCalled = false;
appBuilder.buildFn = ({
required FlutterpiHostPlatform host,
required FlutterpiTargetPlatform target,
required fl.BuildInfo buildInfo,
required FilesystemLayout fsLayout,
fl.FlutterProject? project,
FlutterpiArtifacts? artifacts,
String? mainPath,
String manifestPath = fl.defaultManifestPath,
String? applicationKernelFilePath,
String? depfilePath,
Directory? outDir,
bool unoptimized = false,
bool includeDebugSymbols = false,
bool forceBundleFlutterpi = false,
}) async {
buildWasCalled = true;
};

await _runInTestContext(() async {
await runner.run([
'build',
'--release',
'--arch',
'arm64',
'--cpu',
'generic',
'--github-artifacts-runid=23382732417',
'--github-artifacts-engine-version=052f31d115eceda8cbff1b3481fcde4330c4ae12',
]);
});

expect(
buildWasCalled,
isTrue,
reason: "Expected BuildSystem.build to be called",
);
});
}
Loading