Skip to content

Latest commit

 

History

History
139 lines (110 loc) · 8.16 KB

Instructions-Compile.md

File metadata and controls

139 lines (110 loc) · 8.16 KB

The F5 Experience

Requirements

TODO Find Azurite seed data for the API (Tylah might be blind)

Required Tools (for Mac)

  • XCode v15.0.1+
    • Check or set Command Line Tools location
    • Preferences | Locations | Command Line Tools

Setting up the Repo for Development

To work on the API + Admin UI

  1. Clone this Repo https://github.com/SSWConsulting/SSW.Rewards.Mobile.git
  2. Get the Secrets from Keeper
    1. Client Secrets | SSW | SSW.Rewards | Developer Secrets
    2. Add them as .NET User Secrets for WebAPI.csproj
  3. Create a Developer Certificate https://learn.microsoft.com/en-us/aspnet/core/security/docker-https?view=aspnetcore-8.0#certificates
    1. Create WebAPI.pfx with a password of ThisPassword (You can change change this, but the docker-compose.yml should be updated appropriately)

Windows

dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\WebAPI.pfx -p ThisPassword
dotnet dev-certs https --trust

Mac

   dotnet dev-certs https -ep ${HOME}/.aspnet/https/WebAPI.pfx -p ThisPassword
   dotnet dev-certs https --trust
  1. Cd into the Repo
  2. Run the Docker Containers
  • On Windows, open PowerShell and run:
./up.ps1
  • On macOS or Linux, open a terminal and run:
pwsh ./up.ps1

You should now be able to access the AdminUI hosted locally at https://localhost:7137

You should now be able to access the WebAPI Swagger docs at https://localhost:5001/swagger/index.html

Note: You can run only the WebAPI or AdminUI by running:

docker compose --profile webapi up -d

OR

docker compose --profile admin up -d

Mobile UI

Microsoft Learn has a great step-by-step process to get your first .NET MAUI project up and running, this will should allow you to run the Mobile UI with out much issue! https://learn.microsoft.com/en-us/dotnet/maui/get-started/first-app?view=net-maui-8.0&tabs=vsmac&pivots=devices-android

To work on the Mobile UI (Android SDK)

  1. Run the Docker containers (Only WebApi required)
  2. Start a Dev Tunnel for the API
devtunnel host -p 5001
  1. Update the Constants.cs ApiBaseUrl in the #if DEBUG block to use your DevTunnel address
  2. Run the MobileUI, targeting your Android Emulator

To work on the Mobile UI (iOS, MacOS Only)

  1. Complete steps 1-3 above
  2. Run the MobileUI, targeting your Android Emulator

NOTE: if you cannot build and see an error relating to the provisioning profile/ app signing identity

  1. Open up the iOS project settings by right clicking on SSW.Consulting.iOS and selecting Options.
  2. go to 'iOS Bundle Signing' and select your signing identity and provisioning profile.
  • These should be automatic by default but if you get an error you can manually set them.
  • If you don't have these, talk to another Team Member or Sys Admin and get them to add your AppleID to the Superior Software for Windows Pty Ltd Apple Developer Program Team

Setting up your own iPhone for testing

If you want to set up to deploy to your own iPhone, talk to an App Manager, it's hard! :) Or you can give it a go yourself. For that you will be using 2 portals - App Store Connect and Apple Developer Portal:

  1. Talk to a team member who has either Admin or App Manager role in App Store Connect. Give them your Apple ID (you can provide your personal one) and they will send you an invite to the Apple Developer team. If you've never used Apple products before, you will need to create an Apple ID. You need to be granted at least the App Manager role to be able to perform some of the steps below; otherwise ask someone with the App Manager Role or higher to assist you.
  2. On your mac create a Certificate Signing Request (CSR) using Keychain. Go to Keychain Access -> Certificate Assistant -> Request a certificate from a certificate authority. Fill the fields and save generated CSR somewhere.
  3. Go to https://developer.apple.com, scroll down and click "Certificates, IDs, & Profiles".
  4. Select the Certificates tab. Add a new Certificate of type Apple Development. For that you will need to upload the CSR. Once the certificate is created, the CSR is no longer needed and can be deleted.
  5. Download the certificate on your mac and double click it to install.
  6. Go back to the developer portal and select the Devices tab.
  7. Add a device you are gonna be using for testing. To get your device's UDID connect it to your mac and open the Music app. Select your device on the left and then click a couple of times on the subtitle which displays your iPhone model, storage and battery level.
  8. Once your device is added to the developer portal, select the Profiles tab. Update the provisioning profile for iOS App Development SSWRewards_Dev. Select the certificate and device added on the previous steps. Tip: Any changes to the provisioning profile won't disrupt the work of your team.
  9. Download the provisioning profile on your mac and double click to install it. Tip: provisioning profiles are installed to ~/Library/MobileDevice/Provisioning Profiles/

After that you should be able to deploy and debug the application on your iPhone.

Creating a production build locally

Currently we have GitHub Actions which build and push the application to InternalTesting and TestFlight. But sometimes it's required to build and sign the application locally. Below is a detailed description how to do that.

iOS

Apple expects developers to have individual development certificates (up to 2 per developer) and share distribution certificates (up to 3 per team). To be able to build and sign an ipa file you need to have a distribution certificate and provisioning profile associated with it installed on your machine. All the secrets can be found in our password manager (PM).

  1. Get distribution certificate as a base-64 string from PM and run: echo <cert-base64-string> | base64 --decode > DistributionCertificate.p12
  2. Double click the certificate to install it; use the password from PM
  3. Download distribution provisioning profile form the Apple Developer Portal
  4. Double click the provisioning profile to install it
  5. Go to the MobileUI folder
  6. Run dotnet publish -f net8.0-ios -p:ArchiveOnBuild=true -p:CodesignKey="XXX" -p:CodesignProvision="YYY"; XXX is the CertificateName (in PM) and YYY is ProfileName (same as in Apple Developer Portal)
  7. The ipa file in the ../MobileUI/bin/Release/net8.0-ios/ios-arm64/publish/ folder is ready to be uploaded to TestFlight

Android

  1. Find keystore info in PM
  2. Run echo <keystore-base64-string> | base64 --decode > rewards.keystore
  3. To see the info about keystore run keytool -list -v -keystore rewards.keystore
  4. Run dotnet publish -f net8.0-android -p:AndroidKeyStore=true -p:AndroidSigningKeyStore=rewards.keystore -p:AndroidSigningKeyAlias=XXX -p:AndroidSigningKeyPass=YYY -p:AndroidSigningStorePass=YYY; XXX and YYY can be found in PM
  5. The signed aab file in the ../MobileUI/bin/Release/net8.0-android/publish/ folder is ready to be uploaded to InternalTesting

Now you are setup, lets get started on a PBI

Be sure to read the Definition of done and the Definition of ready