From b2d7fe99a235ae5542abda17f7e75cc2972d7ba0 Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Fri, 27 Sep 2024 14:15:54 -0400 Subject: [PATCH 01/14] Simplify/fix dart formatting in CI --- .github/workflows/flutterfmt.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/flutterfmt.yml b/.github/workflows/flutterfmt.yml index 5f73213..af01091 100644 --- a/.github/workflows/flutterfmt.yml +++ b/.github/workflows/flutterfmt.yml @@ -24,4 +24,4 @@ jobs: uses: actions/checkout@v3 - name: Check formating - run: dart format -l120 lib/ --set-exit-if-changed --suppress-analytics --output none \ No newline at end of file + run: dart format -l120 lib/ --set-exit-if-changed --suppress-analytics --output none From 22a13b1a1c12a3e6faa2b20d997b0040cbe89914 Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Fri, 27 Sep 2024 15:51:49 -0400 Subject: [PATCH 02/14] Add build workflow --- .github/workflows/build.yml | 65 +++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..478a965 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,65 @@ +name: Build android and ios +on: + push: + branches: + - main + pull_request: + +jobs: + build: + name: Build ios and android packages + 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 iOS +# env: +# TOKEN: ${{ secrets.MACHINE_USER_PAT }} +# MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} +# run: | +# cd ios +# pod install +# fastlane build +# 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 + + - name: Build Android + run: flutter build appbundle --debug From 9f262ba5a7d866dd170ed34d3d544d6dd8e9327f Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Mon, 30 Sep 2024 13:57:12 -0400 Subject: [PATCH 03/14] Specify androidapi for gomobile --- nebula/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/nebula/Makefile b/nebula/Makefile index 28ca35e..cfa6323 100644 --- a/nebula/Makefile +++ b/nebula/Makefile @@ -10,6 +10,7 @@ clean: mobileNebula.aar: *.go go.sum go get -d golang.org/x/mobile/cmd/gomobile gomobile bind -trimpath -v --target=android -androidapi 26 + gomobile bind -trimpath -v --target=android -androidapi=26 MobileNebula.xcframework: *.go go.sum go get -d golang.org/x/mobile/cmd/gomobile From ed9aeff3e0554a28696a5e92050a21282fd83341 Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Tue, 1 Oct 2024 13:41:02 -0400 Subject: [PATCH 04/14] Add ios build step to ci --- .github/workflows/build.yml | 87 +++++++++++++++++++++++++------------ 1 file changed, 59 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 478a965..15cbe4a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build android and ios +name: Build on: push: branches: @@ -6,10 +6,9 @@ on: pull_request: jobs: - build: - name: Build ios and android packages + build-android: + name: Android runs-on: macos-latest - steps: - name: Set up Go 1.22 uses: actions/setup-go@v4 @@ -29,6 +28,43 @@ jobs: - 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: install dependencies env: @@ -36,30 +72,25 @@ jobs: 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 + cd - + flutter build ipa --debug -# - name: Build iOS -# env: -# TOKEN: ${{ secrets.MACHINE_USER_PAT }} -# MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} -# run: | -# cd ios -# pod install -# fastlane build -# 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 - - - name: Build Android - run: flutter build appbundle --debug + # 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 \ No newline at end of file From d26b25704df5ec3e15e50c2d16fe6e4c340e1391 Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Tue, 1 Oct 2024 15:05:42 -0400 Subject: [PATCH 05/14] Add fastlane match token --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 15cbe4a..ab592c9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -66,6 +66,12 @@ jobs: 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 }} From cb8b44bd27f0237dc7e749f14cc713371ad26052 Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Tue, 1 Oct 2024 15:26:37 -0400 Subject: [PATCH 06/14] Use fastlane to build --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ab592c9..d4611bc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -88,8 +88,8 @@ jobs: run: | cd ios pod install + fastlane build cd - - flutter build ipa --debug # verify that the github token didn't make it into the output mkdir -p build/app/test-ios From 093d734094aa3cb9e19a39df5695582b965a65ba Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Tue, 1 Oct 2024 15:58:48 -0400 Subject: [PATCH 07/14] Avoid incrementing version number --- .github/workflows/build.yml | 2 +- ios/fastlane/Fastfile | 44 +++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d4611bc..342ba40 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -88,7 +88,7 @@ jobs: run: | cd ios pod install - fastlane build + fastlane checkBuild cd - # verify that the github token didn't make it into the output diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index 3969b63..ab4e9dd 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -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 From 5ba3891eda6b7472b0ae10dae5a12bb51d8fdc99 Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Tue, 1 Oct 2024 16:10:14 -0400 Subject: [PATCH 08/14] Rename workflow --- .github/workflows/{build.yml => smoke.yml} | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) rename .github/workflows/{build.yml => smoke.yml} (95%) diff --git a/.github/workflows/build.yml b/.github/workflows/smoke.yml similarity index 95% rename from .github/workflows/build.yml rename to .github/workflows/smoke.yml index 342ba40..d11d24b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/smoke.yml @@ -1,4 +1,6 @@ -name: Build +# This workflow builds the iOS and Android apps, just to check they build without error + +name: Smoke build on: push: branches: From dfa0e7bd4078d7a9b5ab98bc1eebfc29e4aae937 Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Wed, 9 Oct 2024 10:52:54 -0400 Subject: [PATCH 09/14] Fix rebase error --- nebula/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/nebula/Makefile b/nebula/Makefile index cfa6323..0746dad 100644 --- a/nebula/Makefile +++ b/nebula/Makefile @@ -9,7 +9,6 @@ clean: mobileNebula.aar: *.go go.sum go get -d golang.org/x/mobile/cmd/gomobile - gomobile bind -trimpath -v --target=android -androidapi 26 gomobile bind -trimpath -v --target=android -androidapi=26 MobileNebula.xcframework: *.go go.sum From 4c6d9d0745eada810582567bfd60a685560c0dfa Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Fri, 11 Oct 2024 11:40:01 -0400 Subject: [PATCH 10/14] Build ios debug app, do not sign --- ios/fastlane/Fastfile | 35 ++--------------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index ab4e9dd..fca45eb 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -19,43 +19,12 @@ 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", + configuration: "Debug", + export_method: "development", export_options: { manageAppVersionAndBuildNumber: false } From daa634fdb360326644fcefb85c35e6c22035c42d Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Tue, 15 Oct 2024 10:41:06 -0400 Subject: [PATCH 11/14] Skip signing --- ios/fastlane/Fastfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index fca45eb..6218c44 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -18,6 +18,8 @@ default_platform(:ios) platform :ios do desc "Push a new beta build to TestFlight" + setup_ci + lane :checkBuild do build_app( output_name: "MobileNebula.ipa", @@ -25,6 +27,8 @@ platform :ios do scheme: "Runner", configuration: "Debug", export_method: "development", + skip_codesigning: true, + export_team_id: CredentialsManager::AppfileConfig.try_fetch_value(:team_id), # This requires the team_id to be set in the fastlane `Appfile` export_options: { manageAppVersionAndBuildNumber: false } From 571093410e01b6e684d1e09860b2022c0d8dfa65 Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Tue, 15 Oct 2024 11:16:10 -0400 Subject: [PATCH 12/14] Remove setup_ci --- ios/fastlane/Fastfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index 6218c44..5127446 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -18,8 +18,6 @@ default_platform(:ios) platform :ios do desc "Push a new beta build to TestFlight" - setup_ci - lane :checkBuild do build_app( output_name: "MobileNebula.ipa", From 4374c9d5b66e07e18c268311de376c054374a3c6 Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Tue, 15 Oct 2024 12:21:43 -0400 Subject: [PATCH 13/14] Just manually xcodebuild --- .github/workflows/smoke.yml | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index d11d24b..b9f8b3a 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -60,23 +60,7 @@ jobs: - 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 @@ -84,21 +68,7 @@ jobs: 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 \ No newline at end of file + xcodebuild -workspace Runner.xcworkspace -scheme Runner -configuration Release clean archive CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -archivePath "build/MobileNebula.xcarchive" From 1c32d11503efdbb914bbac81420ead4adc1fce9b Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Tue, 15 Oct 2024 12:34:05 -0400 Subject: [PATCH 14/14] Remove checkBuild lane --- ios/fastlane/Fastfile | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index 5127446..3969b63 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -18,21 +18,6 @@ default_platform(:ios) platform :ios do desc "Push a new beta build to TestFlight" - lane :checkBuild do - build_app( - output_name: "MobileNebula.ipa", - workspace: "Runner.xcworkspace", - scheme: "Runner", - configuration: "Debug", - export_method: "development", - skip_codesigning: true, - export_team_id: CredentialsManager::AppfileConfig.try_fetch_value(:team_id), # This requires the team_id to be set in the fastlane `Appfile` - export_options: { - manageAppVersionAndBuildNumber: false - } - ) - end - lane :build do # Do some things like setting up a temporary keystore to host secrets in CI setup_ci