Skip to content

Commit 86994e3

Browse files
committed
Build web app and deploy to netlify
1 parent 5f083b7 commit 86994e3

File tree

14 files changed

+171
-94
lines changed

14 files changed

+171
-94
lines changed

.github/actions/dart_analysis_and_tests/action.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ inputs:
44
working-directory:
55
description: "Directory to run validation in"
66
required: true
7-
run-integration-tests:
8-
description: "Run integration tests"
9-
required: false
10-
default: "true"
117

128
runs:
139
using: "composite"

.github/actions/flutter_analysis_and_tests/action.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,16 @@ inputs:
88
description: "Run integration tests"
99
required: false
1010
default: "true"
11-
11+
deploy-to-netlify:
12+
description: "Deploy to Netlify"
13+
required: true
14+
default: "false"
15+
netlify-auth-token:
16+
description: "Netlify auth token"
17+
required: true
18+
netlify-site-id:
19+
description: "Netlify site id"
20+
required: true
1221
runs:
1322
using: "composite"
1423
steps:
@@ -64,3 +73,21 @@ runs:
6473
export DISPLAY=:99 # Set display for Xvfb
6574
xvfb-run -a flutter test integration_test/app_test.dart -d linux
6675
working-directory: ${{ inputs.working-directory }}
76+
77+
- name: Build web app
78+
if: ${{ inputs.deploy-to-netlify != 'false' }}
79+
shell: bash
80+
run: |
81+
flutter build web --wasm
82+
working-directory: ${{ inputs.working-directory }}
83+
84+
- name: Deploy to Netlify
85+
if: ${{ inputs.deploy-to-netlify != 'false' }}
86+
uses: nwtgck/[email protected]
87+
with:
88+
publish-dir: ${{ inputs.working-directory }}/build/web
89+
production-deploy: true
90+
deploy-message: "Deploy from GitHub Actions"
91+
env:
92+
NETLIFY_AUTH_TOKEN: ${{ inputs.netlify-auth-token }}
93+
NETLIFY_SITE_ID: ${{ inputs.netlify-site-id }}

.github/workflows/static_analysis_and_tests.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ jobs:
1919
uses: ./.github/actions/flutter_analysis_and_tests
2020
with:
2121
working-directory: ./bloc_flutter
22+
deploy-to-netlify: ${{ github.ref_name == 'refresh' }}
23+
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
24+
netlify-site-id: ${{ secrets.BLOC_FLUTTER_NETLIFY_SITE_ID }}
2225
bloc_library:
2326
name: bloc_library
2427
runs-on: ubuntu-latest
@@ -30,6 +33,9 @@ jobs:
3033
uses: ./.github/actions/flutter_analysis_and_tests
3134
with:
3235
working-directory: ./bloc_library
36+
deploy-to-netlify: ${{ github.ref_name == 'refresh' }}
37+
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
38+
netlify-site-id: ${{ secrets.BLOC_LIBRARY_NETLIFY_SITE_ID }}
3339
blocs:
3440
name: blocs
3541
runs-on: ubuntu-latest
@@ -52,6 +58,9 @@ jobs:
5258
uses: ./.github/actions/flutter_analysis_and_tests
5359
with:
5460
working-directory: ./change_notifier_provider
61+
deploy-to-netlify: ${{ github.ref_name == 'refresh' }}
62+
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
63+
netlify-site-id: ${{ secrets.CHANGE_NOTIFIER_PROVIDER_NETLIFY_SITE_ID }}
5564
freezed_provider_value_notifier:
5665
name: freezed_provider_value_notifier
5766
runs-on: ubuntu-latest
@@ -63,6 +72,9 @@ jobs:
6372
uses: ./.github/actions/flutter_analysis_and_tests
6473
with:
6574
working-directory: ./freezed_provider_value_notifier
75+
deploy-to-netlify: ${{ github.ref_name == 'refresh' }}
76+
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
77+
netlify-site-id: ${{ secrets.FREEZED_PROVIDER_VALUE_NOTIFIER_NETLIFY_SITE_ID }}
6678
inherited_widget:
6779
name: inherited_widget
6880
runs-on: ubuntu-latest
@@ -74,6 +86,9 @@ jobs:
7486
uses: ./.github/actions/flutter_analysis_and_tests
7587
with:
7688
working-directory: ./inherited_widget
89+
deploy-to-netlify: ${{ github.ref_name == 'refresh' }}
90+
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
91+
netlify-site-id: ${{ secrets.INHERITED_WIDGET_NETLIFY_SITE_ID }}
7792
mobx:
7893
name: mobx
7994
runs-on: ubuntu-latest
@@ -85,6 +100,9 @@ jobs:
85100
uses: ./.github/actions/flutter_analysis_and_tests
86101
with:
87102
working-directory: ./mobx
103+
deploy-to-netlify: ${{ github.ref_name == 'refresh' }}
104+
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
105+
netlify-site-id: ${{ secrets.MOBX_NETLIFY_SITE_ID }}
88106
mvi_base:
89107
name: mvi_base
90108
runs-on: ubuntu-latest
@@ -107,6 +125,9 @@ jobs:
107125
uses: ./.github/actions/flutter_analysis_and_tests
108126
with:
109127
working-directory: ./mvi_flutter
128+
deploy-to-netlify: ${{ github.ref_name == 'refresh' }}
129+
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
130+
netlify-site-id: ${{ secrets.MVI_NETLIFY_SITE_ID }}
110131
redux:
111132
name: redux
112133
runs-on: ubuntu-latest
@@ -118,6 +139,9 @@ jobs:
118139
uses: ./.github/actions/flutter_analysis_and_tests
119140
with:
120141
working-directory: ./redux
142+
deploy-to-netlify: ${{ github.ref_name == 'refresh' }}
143+
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
144+
netlify-site-id: ${{ secrets.REDUX_NETLIFY_SITE_ID }}
121145
scoped_model:
122146
name: scoped_model
123147
runs-on: ubuntu-latest
@@ -129,6 +153,9 @@ jobs:
129153
uses: ./.github/actions/flutter_analysis_and_tests
130154
with:
131155
working-directory: ./scoped_model
156+
deploy-to-netlify: ${{ github.ref_name == 'refresh' }}
157+
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
158+
netlify-site-id: ${{ secrets.SCOPED_MODEL_NETLIFY_SITE_IT }}
132159
signals:
133160
name: signals
134161
runs-on: ubuntu-latest
@@ -140,6 +167,9 @@ jobs:
140167
uses: ./.github/actions/flutter_analysis_and_tests
141168
with:
142169
working-directory: ./signals
170+
deploy-to-netlify: ${{ github.ref_name == 'refresh' }}
171+
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
172+
netlify-site-id: ${{ secrets.SIGNALS_NETLIFY_SITE_ID }}
143173
simple_bloc_flutter:
144174
name: simple_bloc_flutter
145175
runs-on: ubuntu-latest
@@ -151,6 +181,9 @@ jobs:
151181
uses: ./.github/actions/flutter_analysis_and_tests
152182
with:
153183
working-directory: ./simple_bloc_flutter
184+
deploy-to-netlify: ${{ github.ref_name == 'refresh' }}
185+
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
186+
netlify-site-id: ${{ secrets.SIMPLE_BLOC_NETLIFY_SITE_ID }}
154187
simple_blocs:
155188
name: simple_blocs
156189
runs-on: ubuntu-latest
@@ -185,6 +218,9 @@ jobs:
185218
uses: ./.github/actions/flutter_analysis_and_tests
186219
with:
187220
working-directory: ./vanilla
221+
deploy-to-netlify: ${{ github.ref_name == 'refresh' }}
222+
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
223+
netlify-site-id: ${{ secrets.VANILLA_NETLIFY_SITE_ID }}
188224
combine_and_upload_coverage:
189225
name: Combine and Upload Coverage
190226
runs-on: ubuntu-latest

vanilla/.metadata

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: "fcf2c11572af6f390246c056bc905eca609533a0"
7+
revision: "05db9689081f091050f01aed79f04dce0c750154"
88
channel: "stable"
99

1010
project_type: app
@@ -13,26 +13,26 @@ project_type: app
1313
migration:
1414
platforms:
1515
- platform: root
16-
create_revision: fcf2c11572af6f390246c056bc905eca609533a0
17-
base_revision: fcf2c11572af6f390246c056bc905eca609533a0
16+
create_revision: 05db9689081f091050f01aed79f04dce0c750154
17+
base_revision: 05db9689081f091050f01aed79f04dce0c750154
1818
- platform: android
19-
create_revision: fcf2c11572af6f390246c056bc905eca609533a0
20-
base_revision: fcf2c11572af6f390246c056bc905eca609533a0
19+
create_revision: 05db9689081f091050f01aed79f04dce0c750154
20+
base_revision: 05db9689081f091050f01aed79f04dce0c750154
2121
- platform: ios
22-
create_revision: fcf2c11572af6f390246c056bc905eca609533a0
23-
base_revision: fcf2c11572af6f390246c056bc905eca609533a0
22+
create_revision: 05db9689081f091050f01aed79f04dce0c750154
23+
base_revision: 05db9689081f091050f01aed79f04dce0c750154
2424
- platform: linux
25-
create_revision: fcf2c11572af6f390246c056bc905eca609533a0
26-
base_revision: fcf2c11572af6f390246c056bc905eca609533a0
25+
create_revision: 05db9689081f091050f01aed79f04dce0c750154
26+
base_revision: 05db9689081f091050f01aed79f04dce0c750154
2727
- platform: macos
28-
create_revision: fcf2c11572af6f390246c056bc905eca609533a0
29-
base_revision: fcf2c11572af6f390246c056bc905eca609533a0
28+
create_revision: 05db9689081f091050f01aed79f04dce0c750154
29+
base_revision: 05db9689081f091050f01aed79f04dce0c750154
3030
- platform: web
31-
create_revision: fcf2c11572af6f390246c056bc905eca609533a0
32-
base_revision: fcf2c11572af6f390246c056bc905eca609533a0
31+
create_revision: 05db9689081f091050f01aed79f04dce0c750154
32+
base_revision: 05db9689081f091050f01aed79f04dce0c750154
3333
- platform: windows
34-
create_revision: fcf2c11572af6f390246c056bc905eca609533a0
35-
base_revision: fcf2c11572af6f390246c056bc905eca609533a0
34+
create_revision: 05db9689081f091050f01aed79f04dce0c750154
35+
base_revision: 05db9689081f091050f01aed79f04dce0c750154
3636

3737
# User provided section
3838

vanilla/android/build.gradle.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ allprojects {
55
}
66
}
77

8-
val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get()
8+
val newBuildDir: Directory =
9+
rootProject.layout.buildDirectory
10+
.dir("../../build")
11+
.get()
912
rootProject.layout.buildDirectory.value(newBuildDir)
1013

1114
subprojects {

vanilla/android/settings.gradle.kts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
pluginManagement {
2-
val flutterSdkPath = run {
3-
val properties = java.util.Properties()
4-
file("local.properties").inputStream().use { properties.load(it) }
5-
val flutterSdkPath = properties.getProperty("flutter.sdk")
6-
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
7-
flutterSdkPath
8-
}
2+
val flutterSdkPath =
3+
run {
4+
val properties = java.util.Properties()
5+
file("local.properties").inputStream().use { properties.load(it) }
6+
val flutterSdkPath = properties.getProperty("flutter.sdk")
7+
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
8+
flutterSdkPath
9+
}
910

1011
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
1112

@@ -18,7 +19,7 @@ pluginManagement {
1819

1920
plugins {
2021
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
21-
id("com.android.application") version "8.7.3" apply false
22+
id("com.android.application") version "8.9.1" apply false
2223
id("org.jetbrains.kotlin.android") version "2.1.0" apply false
2324
}
2425

vanilla/ios/Flutter/AppFrameworkInfo.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
2323
<key>MinimumOSVersion</key>
24-
<string>12.0</string>
24+
<string>13.0</string>
2525
</dict>
2626
</plist>

vanilla/ios/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Uncomment this line to define a global platform for your project
2-
# platform :ios, '12.0'
2+
# platform :ios, '13.0'
33

44
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
55
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

vanilla/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@
346346
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
347347
GCC_WARN_UNUSED_FUNCTION = YES;
348348
GCC_WARN_UNUSED_VARIABLE = YES;
349-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
349+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
350350
MTL_ENABLE_DEBUG_INFO = NO;
351351
SDKROOT = iphoneos;
352352
SUPPORTED_PLATFORMS = iphoneos;
@@ -362,7 +362,7 @@
362362
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
363363
CLANG_ENABLE_MODULES = YES;
364364
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
365-
DEVELOPMENT_TEAM = H54QW28H73;
365+
DEVELOPMENT_TEAM = 8W92H589V9;
366366
ENABLE_BITCODE = NO;
367367
INFOPLIST_FILE = Runner/Info.plist;
368368
LD_RUNPATH_SEARCH_PATHS = (
@@ -473,7 +473,7 @@
473473
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
474474
GCC_WARN_UNUSED_FUNCTION = YES;
475475
GCC_WARN_UNUSED_VARIABLE = YES;
476-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
476+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
477477
MTL_ENABLE_DEBUG_INFO = YES;
478478
ONLY_ACTIVE_ARCH = YES;
479479
SDKROOT = iphoneos;
@@ -524,7 +524,7 @@
524524
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
525525
GCC_WARN_UNUSED_FUNCTION = YES;
526526
GCC_WARN_UNUSED_VARIABLE = YES;
527-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
527+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
528528
MTL_ENABLE_DEBUG_INFO = NO;
529529
SDKROOT = iphoneos;
530530
SUPPORTED_PLATFORMS = iphoneos;
@@ -542,7 +542,7 @@
542542
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
543543
CLANG_ENABLE_MODULES = YES;
544544
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
545-
DEVELOPMENT_TEAM = H54QW28H73;
545+
DEVELOPMENT_TEAM = 8W92H589V9;
546546
ENABLE_BITCODE = NO;
547547
INFOPLIST_FILE = Runner/Info.plist;
548548
LD_RUNPATH_SEARCH_PATHS = (
@@ -565,7 +565,7 @@
565565
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
566566
CLANG_ENABLE_MODULES = YES;
567567
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
568-
DEVELOPMENT_TEAM = H54QW28H73;
568+
DEVELOPMENT_TEAM = 8W92H589V9;
569569
ENABLE_BITCODE = NO;
570570
INFOPLIST_FILE = Runner/Info.plist;
571571
LD_RUNPATH_SEARCH_PATHS = (

vanilla/linux/runner/my_application.cc

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ struct _MyApplication {
1414

1515
G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
1616

17+
// Called when first Flutter frame received.
18+
static void first_frame_cb(MyApplication* self, FlView *view)
19+
{
20+
gtk_widget_show(gtk_widget_get_toplevel(GTK_WIDGET(view)));
21+
}
22+
1723
// Implements GApplication::activate.
1824
static void my_application_activate(GApplication* application) {
1925
MyApplication* self = MY_APPLICATION(application);
@@ -48,15 +54,23 @@ static void my_application_activate(GApplication* application) {
4854
}
4955

5056
gtk_window_set_default_size(window, 1280, 720);
51-
gtk_widget_show(GTK_WIDGET(window));
5257

5358
g_autoptr(FlDartProject) project = fl_dart_project_new();
5459
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
5560

5661
FlView* view = fl_view_new(project);
62+
GdkRGBA background_color;
63+
// Background defaults to black, override it here if necessary, e.g. #00000000 for transparent.
64+
gdk_rgba_parse(&background_color, "#000000");
65+
fl_view_set_background_color(view, &background_color);
5766
gtk_widget_show(GTK_WIDGET(view));
5867
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
5968

69+
// Show the window when Flutter renders.
70+
// Requires the view to be realized so we can start rendering.
71+
g_signal_connect_swapped(view, "first-frame", G_CALLBACK(first_frame_cb), self);
72+
gtk_widget_realize(GTK_WIDGET(view));
73+
6074
fl_register_plugins(FL_PLUGIN_REGISTRY(view));
6175

6276
gtk_widget_grab_focus(GTK_WIDGET(view));

0 commit comments

Comments
 (0)