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
15 changes: 0 additions & 15 deletions .devcontainer/Dockerfile

This file was deleted.

33 changes: 0 additions & 33 deletions .devcontainer/devcontainer.json

This file was deleted.

51 changes: 36 additions & 15 deletions .github/workflows/build-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,65 @@ name: Build Test App

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]

permissions:
contents: read
env:
FLUTTER_VERSION: 3.38.4

jobs:
build:
name: Build Flutter-Pi Bundle (${{ matrix.arch }}, ${{ matrix.cpu}})
runs-on: ubuntu-latest
name: Build Flutter-Pi Bundle (${{ matrix.runner}}, ${{ matrix.arch }}, ${{ matrix.cpu}})
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner:
- windows-latest
- ubuntu-latest
arch:
- arm
- arm64
- x64
- riscv64
cpu:
- generic

# TODO: Maybe find a better way to do this.
include:
- arch: arm
- runner: windows-latest
arch: arm
cpu: pi3
- runner: ubuntu-latest
arch: arm
cpu: pi3
- arch: arm
- runner: windows-latest
arch: arm
cpu: pi4
- arch: arm64
- runner: ubuntu-latest
arch: arm
cpu: pi4
- runner: windows-latest
arch: arm64
cpu: pi3
- runner: ubuntu-latest
arch: arm64
cpu: pi3
- arch: arm64
- runner: windows-latest
arch: arm64
cpu: pi4
- runner: ubuntu-latest
arch: arm64
cpu: pi4
steps:
- uses: actions/checkout@v4

- uses: subosito/flutter-action@v2
with:
cache: true
channel: stable
flutter-version: 3.38.4
flutter-version: ${{ env.FLUTTER_VERSION }}

- name: Install dependencies & Activate as global executable
run: |
flutter pub get
Expand All @@ -51,7 +72,7 @@ jobs:
- name: Run flutterpi_tool build
working-directory: test_app
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
GITHUB_TOKEN: ${{ secrets.PUBLIC_ONLY_PAT }}
run: |
echo '::group::flutterpi_tool build ... --debug-unoptimized'
flutterpi_tool build --arch=${{ matrix.arch }} --cpu=${{ matrix.cpu }} --debug-unoptimized --debug-symbols --verbose
Expand All @@ -60,7 +81,7 @@ jobs:
echo '::group::flutterpi_tool build ... --debug'
flutterpi_tool build --arch=${{ matrix.arch }} --cpu=${{ matrix.cpu }} --debug --debug-symbols --verbose
echo '::endgroup::'

echo '::group::flutterpi_tool build ... --profile'
flutterpi_tool build --arch=${{ matrix.arch }} --cpu=${{ matrix.cpu }} --profile --debug-symbols --verbose
echo '::endgroup::'
Expand Down
43 changes: 32 additions & 11 deletions .github/workflows/flutter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,60 @@ name: Flutter

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]

permissions:
contents: read

env:
FLUTTER_VERSION: 3.38.4

jobs:
build:
analyze:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
steps:
- uses: actions/checkout@v4

- uses: subosito/flutter-action@v2
with:
cache: true
channel: stable
flutter-version: 3.38.4
flutter-version: ${{ env.FLUTTER_VERSION }}

- name: Install dependencies
run: flutter pub get

- name: Verify formatting
run: dart format --output=none --set-exit-if-changed .

# Consider passing '--fatal-infos' for slightly stricter analysis.
- name: Analyze project source
run: flutter analyze

# Your project will need to have tests in test/ and a dependency on
# package:test for this step to succeed. Note that Flutter projects will
# want to change this to 'flutter test'.
test:
runs-on: ${{ matrix.runner }}
env:
GITHUB_TOKEN: ${{ secrets.token }}
strategy:
matrix:
runner:
- windows-latest
- ubuntu-latest
- macos-latest
steps:
- uses: actions/checkout@v4

- uses: subosito/flutter-action@v2
with:
cache: true
channel: stable
flutter-version: ${{ env.FLUTTER_VERSION }}

- name: Install dependencies
run: flutter pub get

- name: Run tests
run: flutter test
33 changes: 21 additions & 12 deletions lib/src/context.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:flutterpi_tool/src/build_system/build_app.dart';
import 'package:flutterpi_tool/src/config.dart';
import 'package:flutterpi_tool/src/devices/device_manager.dart';
import 'package:flutterpi_tool/src/devices/flutterpi_ssh/ssh_utils.dart';
import 'package:github/github.dart' as gh;
import 'package:unified_analytics/unified_analytics.dart';
import 'package:http/io_client.dart' as http;

Expand All @@ -28,20 +29,28 @@ Future<V> runInContext<V>(
overrides: {
Analytics: () => const NoOpAnalytics(),
fl.TemplateRenderer: () => const fl.MustacheTemplateRenderer(),
fl.Cache: () => FlutterpiCache(
hooks: globals.shutdownHooks,
logger: globals.logger,
fileSystem: globals.fs,
platform: globals.platform,
osUtils: globals.os as MoreOperatingSystemUtils,
projectFactory: globals.projectFactory,
processManager: globals.processManager,
github: MyGithub.caching(
httpClient: http.IOClient(
globals.httpClientFactory?.call() ?? io.HttpClient(),
),
fl.Cache: () {
final auth = switch (globals.platform.environment['GITHUB_TOKEN']) {
final token? => gh.Authentication.bearerToken(token),
_ => null,
};

return FlutterpiCache(
hooks: globals.shutdownHooks,
logger: globals.logger,
fileSystem: globals.fs,
platform: globals.platform,
osUtils: globals.os as MoreOperatingSystemUtils,
projectFactory: globals.projectFactory,
processManager: globals.processManager,
github: MyGithub.caching(
httpClient: http.IOClient(
globals.httpClientFactory?.call() ?? io.HttpClient(),
),
auth: auth,
),
);
},
fl.OperatingSystemUtils: () => MoreOperatingSystemUtils(
fileSystem: globals.fs,
logger: globals.logger,
Expand Down
38 changes: 22 additions & 16 deletions test/app_builder_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ void main() {
}) async {
expect(
environment.defines[fl.kTargetFile],
equals('lib/main_flutterpi.dart'),
equals(p.join('lib', 'main_flutterpi.dart')),
);

buildWasCalled = true;
Expand All @@ -136,7 +136,7 @@ void main() {
target: FlutterpiTargetPlatform.genericRiscv64,
buildInfo: fl.BuildInfo.debug,
fsLayout: FilesystemLayout.flutterPi,
mainPath: 'lib/main_flutterpi.dart',
mainPath: p.join('lib', 'main_flutterpi.dart'),
),
);

Expand Down Expand Up @@ -268,7 +268,9 @@ void main() {
}) async {
expect(
environment.outputDir.path,
equals('build/flutter-pi/meta-flutter-riscv64-generic'),
equals(
p.join('build', 'flutter-pi', 'meta-flutter-riscv64-generic'),
),
);

buildWasCalled = true;
Expand Down Expand Up @@ -375,7 +377,7 @@ void main() {
}) async {
expect(
environment.outputDir.path,
equals('build/flutter-pi/riscv64-generic'),
equals(p.join('build', 'flutter-pi', 'riscv64-generic')),
);

buildWasCalled = true;
Expand Down Expand Up @@ -491,8 +493,10 @@ void main() {

expect(
bundle.binaries.map(
(file) =>
p.relative(file.path, from: 'build/flutter-pi/riscv64-generic'),
(file) => p.relative(
file.path,
from: p.join('build', 'flutter-pi', 'riscv64-generic'),
),
),
unorderedEquals([
'flutter-pi',
Expand Down Expand Up @@ -525,8 +529,10 @@ void main() {

expect(
bundle.binaries.map(
(file) =>
p.relative(file.path, from: 'build/flutter-pi/riscv64-generic'),
(file) => p.relative(
file.path,
from: p.join('build', 'flutter-pi', 'riscv64-generic'),
),
),
unorderedEquals([
'flutter-pi',
Expand Down Expand Up @@ -560,11 +566,11 @@ void main() {
bundle.binaries.map(
(file) => p.relative(
file.path,
from: 'build/flutter-pi/meta-flutter-riscv64-generic',
from: p.join('build', 'flutter-pi', 'meta-flutter-riscv64-generic'),
),
),
unorderedEquals([
'lib/libflutter_engine.so',
p.join('lib', 'libflutter_engine.so'),
]),
);
});
Expand Down Expand Up @@ -595,12 +601,12 @@ void main() {
bundle.binaries.map(
(file) => p.relative(
file.path,
from: 'build/flutter-pi/meta-flutter-riscv64-generic',
from: p.join('build', 'flutter-pi', 'meta-flutter-riscv64-generic'),
),
),
unorderedEquals([
'bin/flutter-pi',
'lib/libflutter_engine.so',
p.join('bin', 'flutter-pi'),
p.join('lib', 'libflutter_engine.so'),
]),
);
});
Expand Down Expand Up @@ -631,12 +637,12 @@ void main() {
bundle.binaries.map(
(file) => p.relative(
file.path,
from: 'build/flutter-pi/meta-flutter-riscv64-generic',
from: p.join('build', 'flutter-pi', 'meta-flutter-riscv64-generic'),
),
),
unorderedEquals([
'lib/libflutter_engine.dbgsyms',
'lib/libflutter_engine.so',
p.join('lib', 'libflutter_engine.dbgsyms'),
p.join('lib', 'libflutter_engine.so'),
]),
);
});
Expand Down
Loading