Compare commits

...

14 Commits

Author SHA1 Message Date
Ian VanSchooten 0046f6872b Rename workflow 2024-10-01 16:10:14 -04:00
Ian VanSchooten c98946c5ea Avoid incrementing version number 2024-10-01 15:58:48 -04:00
Ian VanSchooten 9071ce34c5 Use fastlane to build 2024-10-01 15:26:37 -04:00
Ian VanSchooten e0788799f7 Add fastlane match token 2024-10-01 15:05:42 -04:00
Ian VanSchooten d6f50319ef Add ios build step to ci 2024-10-01 13:41:02 -04:00
Ian VanSchooten 5be54c024f Specify androidapi for gomobile 2024-09-30 13:57:12 -04:00
Ian VanSchooten d4a5489be5 Add build workflow 2024-09-27 15:51:49 -04:00
Ian VanSchooten cf97068d7b Format main.dart 2024-09-27 14:27:13 -04:00
Ian VanSchooten 9d0c3640fe We don't have tests 2024-09-27 14:24:09 -04:00
Ian VanSchooten 13435757f5 Do not actually change files 2024-09-27 14:23:51 -04:00
Ian VanSchooten 0556ff612e Simplify/fix dart formatting in CI 2024-09-27 14:15:54 -04:00
Ian VanSchooten 4403fef32e Fix flutter format command
It was removed in 3.12: https://github.com/flutter/flutter/pull/129360
2024-09-27 14:02:25 -04:00
Ian VanSchooten 70b344bbbd Use java toolchain instead of explicit targets 2024-09-27 08:43:26 -04:00
Ian VanSchooten dc99ae2e65 Update java to 17 2024-09-27 08:06:59 -04:00
10 changed files with 199 additions and 60 deletions

View File

@ -1,10 +0,0 @@
#!/bin/sh
DIRS="lib test"
EXIT=0
for DIR in $DIRS; do
OUT="$(flutter format -l 120 --suppress-analytics "$DIR" | sed -e "s/^Formatted \(.*\)/::error file=$DIR\/\1::Not formatted/g")"
echo "$OUT" | grep "::error" && EXIT=1
done
exit $EXIT

View File

@ -23,5 +23,5 @@ jobs:
- name: Check out code
uses: actions/checkout@v3
- name: flutter format
run: $GITHUB_WORKSPACE/.github/workflows/flutterfmt.sh
- name: Check formating
run: dart format -l120 lib/ --set-exit-if-changed --suppress-analytics --output none

View File

@ -19,7 +19,7 @@ jobs:
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'
- name: Install flutter
uses: subosito/flutter-action@v2

104
.github/workflows/smoke.yml vendored Normal file
View File

@ -0,0 +1,104 @@
# This workflow builds the iOS and Android apps, just to check they build without error
name: Smoke build
on:
push:
branches:
- main
pull_request:
jobs:
build-android:
name: Android
runs-on: macos-latest
steps:
- name: Set up Go 1.22
uses: actions/setup-go@v4
with:
go-version: "1.22"
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '17'
- name: Install flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.24.1'
- name: Check out code
uses: actions/checkout@v3
- name: install dependencies
env:
TOKEN: ${{ secrets.MACHINE_USER_PAT }}
run: |
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile init
flutter pub get
touch env.sh
- name: Build Android debug
run: flutter build appbundle --debug
build-ios:
name: iOS
runs-on: macos-latest
steps:
- name: Set up Go 1.22
uses: actions/setup-go@v4
with:
go-version: "1.22"
- name: Install flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.24.1'
- name: Check out code
uses: actions/checkout@v3
- name: Install the appstore connect key material
env:
AC_API_KEY_SECRET_BASE64: ${{ secrets.AC_API_KEY_SECRET_BASE64 }}
run: |
AC_API_KEY_SECRET_PATH="$RUNNER_TEMP/key.p8"
echo "APP_STORE_CONNECT_API_KEY_KEY_FILEPATH=$AC_API_KEY_SECRET_PATH" >> $GITHUB_ENV
echo -n "$AC_API_KEY_SECRET_BASE64" | base64 --decode --output "$AC_API_KEY_SECRET_PATH"
- name: Place Github token for fastlane match
env:
TOKEN: ${{ secrets.MACHINE_USER_PAT }}
run:
echo "MATCH_GIT_BASIC_AUTHORIZATION=$(echo -n "defined-machine:${TOKEN}" | base64)" >> $GITHUB_ENV
- name: install dependencies
env:
TOKEN: ${{ secrets.MACHINE_USER_PAT }}
run: |
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile init
flutter pub get
touch env.sh
- name: Build iOS
env:
TOKEN: ${{ secrets.MACHINE_USER_PAT }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
run: |
cd ios
pod install
fastlane checkBuild
cd -
# verify that the github token didn't make it into the output
mkdir -p build/app/test-ios
cp ios/MobileNebula.ipa build/app/test-ios
cd build/app/test-ios
unzip MobileNebula.ipa
if find . | xargs strings 2>/dev/null | grep -qF "${TOKEN}" ; then
echo "Token found in iOS build"
exit 1
fi

View File

@ -32,13 +32,16 @@ If you are having issues with iOS pods, try blowing it all away! `cd ios && rm -
# Formatting
`flutter format` can be used to format the code in `lib` and `test` but it's default is 80 char line limit, it's 2020
`dart format` can be used to format the code in `lib` and `test`. We use a line-length of 120 characters.
Use:
```sh
flutter format lib/ test/ -l 120
dart format lib/ test/ -l 120
```
In Android Studio, set the line length using Preferences -> Editor -> Code Style -> Dart -> Line length, set it to 120. Enable auto-format with Preferences -> Languages & Frameworks -> Flutter -> Format code on save.
# Release
Update `version` in `pubspec.yaml` to reflect this release, then
@ -53,4 +56,4 @@ Upload the android bundle to the google play store https://play.google.com/apps/
## iOS
In xcode, Release -> Archive then follow the directions to upload to the app store. If you have issues, https://flutter.dev/docs/deployment/ios#create-a-build-archive
In xcode, Release -> Archive then follow the directions to upload to the app store. If you have issues, https://flutter.dev/docs/deployment/ios#create-a-build-archive

View File

@ -28,15 +28,6 @@ android {
compileSdkVersion 34
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
@ -72,6 +63,12 @@ android {
}
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
flutter {
source '../..'
}

View File

@ -17,6 +17,7 @@ pluginManagement {
}
plugins {
id "org.gradle.toolchains.foojay-resolver-convention" version "0.8.0"
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version '8.6.1' apply false
id "org.jetbrains.kotlin.android" version "2.0.20" apply false

View File

@ -18,6 +18,50 @@ default_platform(:ios)
platform :ios do
desc "Push a new beta build to TestFlight"
lane :checkBuild do
# Do some things like setting up a temporary keystore to host secrets in CI
setup_ci
# Change signing behavior to work in CI
update_code_signing_settings(
# Automatic signing seems to be a good thing to have on in dev but will not work in CI
use_automatic_signing: false,
# The default value for this is iOS Development which is not appropriate for release
code_sign_identity: "Apple Distribution",
)
# Find our signing certs and profiles, these come from a private repository and managed by `fastlane match`
match(type: 'appstore', app_identifier: ["net.defined.mobileNebula","net.defined.mobileNebula.NebulaNetworkExtension"], readonly: true)
# Update our main program to have the correct provisioning profile from Apple
update_project_provisioning(
xcodeproj: "Runner.xcodeproj",
target_filter: "Runner",
# This comes from match() above
profile:ENV["sigh_net.defined.mobileNebula_appstore_profile-path"],
build_configuration: "Release"
)
# Update our network extension to have the correct provisioning profile from Apple
update_project_provisioning(
xcodeproj: "Runner.xcodeproj",
target_filter: "NebulaNetworkExtension",
# This comes from match() above
profile:ENV["sigh_net.defined.mobileNebula.NebulaNetworkExtension_appstore_profile-path"],
build_configuration: "Release"
)
build_app(
output_name: "MobileNebula.ipa",
workspace: "Runner.xcworkspace",
scheme: "Runner",
export_method: "app-store",
export_options: {
manageAppVersionAndBuildNumber: false
}
)
end
lane :build do
# Do some things like setting up a temporary keystore to host secrets in CI
setup_ci

View File

@ -85,44 +85,44 @@ class _AppState extends State<App> {
return MaterialApp(
theme: brightness == Brightness.light ? lightTheme : darkTheme,
home: Scaffold(
body: PlatformProvider(
//initialPlatform: initialPlatform,
builder: (context) => PlatformApp(
debugShowCheckedModeBanner: false,
localizationsDelegates: <LocalizationsDelegate<dynamic>>[
DefaultMaterialLocalizations.delegate,
DefaultWidgetsLocalizations.delegate,
DefaultCupertinoLocalizations.delegate,
],
title: 'Nebula',
material: (_, __) {
return new MaterialAppData(
themeMode: brightness == Brightness.light ? ThemeMode.light : ThemeMode.dark,
);
},
cupertino: (_, __) => CupertinoAppData(
theme: CupertinoThemeData(brightness: brightness),
),
onGenerateRoute: (settings) {
if (settings.name == '/') {
return platformPageRoute(context: context, builder: (context) => MainScreen(this.dnEnrolled));
}
final uri = Uri.parse(settings.name!);
if (uri.path == EnrollmentScreen.routeName) {
// TODO: maybe implement this as a dialog instead of a page, you can stack multiple enrollment screens which is annoying in dev
return platformPageRoute(
context: context,
builder: (context) =>
EnrollmentScreen(code: EnrollmentScreen.parseCode(settings.name!), stream: this.dnEnrolled),
body: PlatformProvider(
//initialPlatform: initialPlatform,
builder: (context) => PlatformApp(
debugShowCheckedModeBanner: false,
localizationsDelegates: <LocalizationsDelegate<dynamic>>[
DefaultMaterialLocalizations.delegate,
DefaultWidgetsLocalizations.delegate,
DefaultCupertinoLocalizations.delegate,
],
title: 'Nebula',
material: (_, __) {
return new MaterialAppData(
themeMode: brightness == Brightness.light ? ThemeMode.light : ThemeMode.dark,
);
}
},
cupertino: (_, __) => CupertinoAppData(
theme: CupertinoThemeData(brightness: brightness),
),
onGenerateRoute: (settings) {
if (settings.name == '/') {
return platformPageRoute(context: context, builder: (context) => MainScreen(this.dnEnrolled));
}
return null;
},
final uri = Uri.parse(settings.name!);
if (uri.path == EnrollmentScreen.routeName) {
// TODO: maybe implement this as a dialog instead of a page, you can stack multiple enrollment screens which is annoying in dev
return platformPageRoute(
context: context,
builder: (context) =>
EnrollmentScreen(code: EnrollmentScreen.parseCode(settings.name!), stream: this.dnEnrolled),
);
}
return null;
},
),
),
),
),
);
}
}

View File

@ -7,7 +7,7 @@ clean:
mobileNebula.aar: *.go go.sum
go get -d golang.org/x/mobile/cmd/gomobile
gomobile bind -trimpath -v --target=android
gomobile bind -trimpath -v --target=android -androidapi=26
MobileNebula.xcframework: *.go go.sum
go get -d golang.org/x/mobile/cmd/gomobile