From b8bcf32af4a922abcb126b575cb6a509f3aa7cd0 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 c91f622e4ef130c2b0d17a01743c34335c9628fd 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 3cb7d84a7b7dd916b05ee8c69fea032110d8f9af 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 a4703d140352114615ce96f9a41823b34d2f49b6 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 3e58c41a0eb13277ae8731a1f4d932759c921989 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 da6447175183473f72e987df6bd862bd922b1e3d 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 8111303d91ca41aac06e3917faeb615d954c59cf 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 c886cfcf5bec43b659a347b9a372c91e868c3e40 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 9d5cda781022e5c9ba93152c7c9ec07b13c29dbd 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 0e9dae0a9c5ef7ab4c61d5991a9199d02d0110ee 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 b82ef08fd1aa2c51dc8a9c00dbffe2ac19eb568c 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 a88c845850d265be3ede3f26bdf45b32fc569c2d 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 5c0f98ad8a3470b623bedf788f9a83dbd7810278 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 71e6734865a38f72f8f3d64f84043fbe276e8676 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