Skip to content

feat(text-fields): convert BaseTextField to StatefulWidget and add ma… #3498

feat(text-fields): convert BaseTextField to StatefulWidget and add ma…

feat(text-fields): convert BaseTextField to StatefulWidget and add ma… #3498

name: PR Continuous Integration - Mobile App
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set Environment Variables
uses: ./.github/actions/setvars
with:
varFilePath: ./.github/variables/myvars.env
- uses: actions/setup-java@v4
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
- uses: subosito/flutter-action@v2
with:
cache: true
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Launch tests
run: flutter test
pre-build:
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
needs: test
name: pre-build
steps:
- name: Get current timestamp
id: getCurrentTimestamp
run: echo "date=$(date +%s)" >> "$GITHUB_OUTPUT"
outputs:
date: ${{ steps.getCurrentTimestamp.outputs.date }}
build-android-staging:
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
needs: pre-build
steps:
- uses: actions/checkout@v4
- name: Set Environment Variables
uses: ./.github/actions/setvars
with:
varFilePath: ./.github/variables/myvars.env
- uses: actions/setup-java@v4
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
- uses: subosito/flutter-action@v2
with:
cache: true
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Check Firebase App Distribution CLI cache
uses: actions/cache@v4
id: firebase-tools-cache
with:
path: /usr/local/bin
key: ${{ runner.os }}-firebase-tools
- name: Install Firebase App Distribution CLI
if: steps.firebase-tools-cache.outputs.cache-hit != 'true'
run: |
curl -sL https://firebase.tools | bash
- name: Write Google configuration for Android
shell: bash
run: |
echo "$STAGING_GOOGLE_SERVICE_B64" | base64 --decode > android/app/google-services.json
env:
STAGING_GOOGLE_SERVICE_B64: ${{ secrets.STAGING_GOOGLE_SERVICE_B64 }}
- name: Write key properties
shell: bash
run: |
echo "$STAGING_KEY_PROPERTIES_B64" | base64 --decode > android/key.properties
env:
STAGING_KEY_PROPERTIES_B64: ${{ secrets.STAGING_KEY_PROPERTIES_B64 }}
- name: Write key store
shell: bash
run: |
mkdir android/keystore
echo "$STAGING_KEYSTORE_B64" | base64 --decode > android/keystore/passemploi.jks
env:
STAGING_KEYSTORE_B64: ${{ secrets.STAGING_KEYSTORE_B64 }}
- name: Write env
shell: bash
run: |
echo "$STAGING_RUNTIME_ENV_B64" | base64 --decode > env/.env.staging
env:
STAGING_RUNTIME_ENV_B64: ${{ secrets.STAGING_RUNTIME_ENV_B64 }}
- name: Install Flutter dependencies
shell: bash
run: |
flutter pub get
- name: CEJ - Build Android apk
run: |
flutter build apk \
-t lib/cej_main.dart \
--flavor cejStaging \
--release \
--build-number=${{ needs.pre-build.outputs.date }}
- name: CEJ - Deploy Android apk to Firebase App Distribution
run: |
firebase appdistribution:distribute build/app/outputs/flutter-apk/app-cejstaging-release.apk \
--token "$STAGING_FIREBASE_CI_TOKEN" \
--app "$CEJ_STAGING_ANDROID_APP_ID" \
--groups "$STAGING_FIREBASE_RELEASE_GROUPS"
env:
STAGING_FIREBASE_CI_TOKEN: ${{ secrets.STAGING_FIREBASE_CI_TOKEN }}
CEJ_STAGING_ANDROID_APP_ID: ${{ secrets.CEJ_STAGING_ANDROID_APP_ID }}
STAGING_FIREBASE_RELEASE_GROUPS: ${{ secrets.STAGING_FIREBASE_RELEASE_GROUPS }}
- name: BRSA - Build Android apk
run: |
flutter build apk \
-t lib/brsa_main.dart \
--flavor brsaStaging \
--release \
--build-number=${{ needs.pre-build.outputs.date }}
- name: BRSA - Deploy Android apk to Firebase App Distribution
run: |
firebase appdistribution:distribute build/app/outputs/flutter-apk/app-brsastaging-release.apk \
--token "$STAGING_FIREBASE_CI_TOKEN" \
--app "$BRSA_STAGING_ANDROID_APP_ID" \
--groups "$STAGING_FIREBASE_RELEASE_GROUPS"
env:
STAGING_FIREBASE_CI_TOKEN: ${{ secrets.STAGING_FIREBASE_CI_TOKEN }}
BRSA_STAGING_ANDROID_APP_ID: ${{ secrets.BRSA_STAGING_ANDROID_APP_ID }}
STAGING_FIREBASE_RELEASE_GROUPS: ${{ secrets.STAGING_FIREBASE_RELEASE_GROUPS }}
build-ios-staging:
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}
runs-on: macos-13
needs: pre-build
steps:
- uses: actions/checkout@v4
- name: Set Environment Variables
uses: ./.github/actions/setvars
with:
varFilePath: ./.github/variables/myvars.env
- name: Write ssh gitlab private key
shell: bash
run: |
echo "$SSH_GITLAB_PRIVATE_KEY" > ~/.ssh/id_ed25519
env:
SSH_GITLAB_PRIVATE_KEY: ${{ secrets.SSH_GITLAB_PRIVATE_KEY }}
- name: ssh agent
shell: bash
run: |
chmod 600 ~/.ssh/id_ed25519
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
ssh-keyscan -t rsa gitlab.com >> ~/.ssh/known_hosts
- uses: subosito/flutter-action@v2
with:
cache: true
flutter-version: ${{ env.FLUTTER_VERSION }}
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Check Codemagic CLI cache
uses: actions/cache@v4
id: codemagic-cache
with:
path: /Users/runner/hostedtoolcache/Python/${{ env.PYTHON_VERSION }}/x64
key: ${{ runner.os }}-codemagic
- name: Install Codemagic CLI tools
if: steps.codemagic-cache.outputs.cache-hit != 'true'
shell: bash
run: |
pip3 install codemagic-cli-tools
- name: Check Firebase App Distribution CLI cache
uses: actions/cache@v4
id: firebase-tools-cache
with:
path: /usr/local/bin
key: ${{ runner.os }}-firebase-tools
- name: Install Firebase App Distribution CLI
if: steps.firebase-tools-cache.outputs.cache-hit != 'true'
run: |
curl -sL https://firebase.tools | bash
- name: Write Google configuration for ios
shell: bash
run: |
mkdir -p ios/firebase-config/cejStaging
mkdir -p ios/firebase-config/brsaStaging
echo "$CEJ_STAGING_GOOGLE_SERVICE_IOS_B64" | base64 --decode > ios/firebase-config/cejStaging/GoogleService-Info.plist
echo "$BRSA_STAGING_GOOGLE_SERVICE_IOS_B64" | base64 --decode > ios/firebase-config/brsaStaging/GoogleService-Info.plist
env:
CEJ_STAGING_GOOGLE_SERVICE_IOS_B64: ${{ secrets.CEJ_STAGING_GOOGLE_SERVICE_IOS_B64 }}
BRSA_STAGING_GOOGLE_SERVICE_IOS_B64: ${{ secrets.BRSA_STAGING_GOOGLE_SERVICE_IOS_B64 }}
- name: Write env
shell: bash
run: |
echo "$STAGING_RUNTIME_ENV_B64" | base64 --decode > env/.env.staging
env:
STAGING_RUNTIME_ENV_B64: ${{ secrets.STAGING_RUNTIME_ENV_B64 }}
- name: Install Flutter dependencies
shell: bash
run: |
flutter pub get
- name: Check CocoaPods cache
uses: actions/cache@v4
id: cocoapods-cache
with:
path: ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('pubspec.lock') }}
- name: Install CocoaPods dependencies
if: steps.cocoapods-cache.outputs.cache-hit != 'true'
shell: bash
run: |
find . -name "Podfile" -execdir pod install \;
- name: Write Apple prod API Key
shell: bash
run: |
mkdir ~/.private_keys
echo "$APPLE_PROD_API_KEY_B64" | base64 --decode > ios/AuthKey_"$APPLE_PROD_API_KEY".p8
env:
APPLE_PROD_API_KEY: ${{ secrets.APPLE_PROD_API_KEY }}
APPLE_PROD_API_KEY_B64: ${{ secrets.APPLE_PROD_API_KEY_B64 }}
- name: CEJ - Set up a temporary keychain for code signing
shell: bash
run: |
keychain initialize
- name: CEJ - Fetch the code signing files from App Store Connect
shell: bash
run: |
export APP_STORE_CONNECT_ISSUER_ID="$APPLE_PROD_API_ISSUER"
export APP_STORE_CONNECT_KEY_IDENTIFIER="$APPLE_PROD_API_KEY"
export APP_STORE_CONNECT_PRIVATE_KEY=`cat ios/AuthKey_"$APPLE_PROD_API_KEY".p8`
app-store-connect fetch-signing-files fr.fabrique.social.gouv.passemploi.staging \
--platform IOS \
--type IOS_APP_ADHOC \
--certificate-key=@env:APPLE_P12_PRIVATE_KEY \
--create
env:
APPLE_PROD_API_ISSUER: ${{ secrets.APPLE_PROD_API_ISSUER }}
APPLE_PROD_API_KEY: ${{ secrets.APPLE_PROD_API_KEY }}
APPLE_P12_PRIVATE_KEY: ${{secrets.APPLE_P12_PRIVATE_KEY}}
- name: CEJ - Add fetched certificates to keychain
shell: bash
run: |
keychain add-certificates
- name: CEJ - Update Xcode project settings with fetched code signing profiles and create staging_export_options.plist
shell: bash
run: |
xcode-project use-profiles --export-options-plist ios/staging_export_options.plist
- name: CEJ - Build IPA with generated staging_export_options.plist
shell: bash
run: |
flutter build ipa \
-t lib/cej_main.dart \
--flavor cejStaging \
--release \
--build-number=${{ needs.pre-build.outputs.date }} \
--export-options-plist=ios/staging_export_options.plist \
--no-pub \
--verbose
- name: CEJ - Deploy IPA to Firebase App Distribution
run: |
mv "$(find $(pwd) -name "\[stg\] CEJ.ipa")" CEJ.ipa
firebase appdistribution:distribute $(find $(pwd) -name "CEJ.ipa") \
--token "$STAGING_FIREBASE_CI_TOKEN" \
--app "$CEJ_STAGING_IOS_APP_ID" \
--groups "$STAGING_FIREBASE_RELEASE_GROUPS"
env:
STAGING_FIREBASE_CI_TOKEN: ${{ secrets.STAGING_FIREBASE_CI_TOKEN }}
CEJ_STAGING_IOS_APP_ID: ${{ secrets.CEJ_STAGING_IOS_APP_ID }}
STAGING_FIREBASE_RELEASE_GROUPS: ${{ secrets.STAGING_FIREBASE_RELEASE_GROUPS }}
- name: BRSA - Set up a temporary keychain for code signing
shell: bash
run: |
keychain initialize
- name: BRSA - Fetch the code signing files from App Store Connect
shell: bash
run: |
export APP_STORE_CONNECT_ISSUER_ID="$APPLE_PROD_API_ISSUER"
export APP_STORE_CONNECT_KEY_IDENTIFIER="$APPLE_PROD_API_KEY"
export APP_STORE_CONNECT_PRIVATE_KEY=`cat ios/AuthKey_"$APPLE_PROD_API_KEY".p8`
app-store-connect fetch-signing-files fr.fabrique.social.gouv.passemploi.rsa.staging \
--platform IOS \
--type IOS_APP_ADHOC \
--certificate-key=@env:APPLE_P12_PRIVATE_KEY \
--create
env:
APPLE_PROD_API_ISSUER: ${{ secrets.APPLE_PROD_API_ISSUER }}
APPLE_PROD_API_KEY: ${{ secrets.APPLE_PROD_API_KEY }}
APPLE_P12_PRIVATE_KEY: ${{secrets.APPLE_P12_PRIVATE_KEY}}
- name: BRSA - Add fetched certificates to keychain
shell: bash
run: |
keychain add-certificates
- name: BRSA - Update Xcode project settings with fetched code signing profiles and create staging_export_options.plist
shell: bash
run: |
xcode-project use-profiles --export-options-plist ios/staging_export_options.plist
- name: BRSA - Build IPA with generated staging_export_options.plist
shell: bash
run: |
flutter build ipa \
-t lib/brsa_main.dart \
--flavor brsaStaging \
--release \
--build-number=${{ needs.pre-build.outputs.date }} \
--export-options-plist=ios/staging_export_options.plist \
--no-pub \
--verbose
- name: BRSA - Deploy IPA to Firebase App Distribution
run: |
mv "$(find $(pwd) -name "\[stg\] pass emploi.ipa")" pass-emploi.ipa
firebase appdistribution:distribute $(find $(pwd) -name "pass-emploi.ipa") \
--token "$STAGING_FIREBASE_CI_TOKEN" \
--app "$BRSA_STAGING_IOS_APP_ID" \
--groups "$STAGING_FIREBASE_RELEASE_GROUPS"
env:
STAGING_FIREBASE_CI_TOKEN: ${{ secrets.STAGING_FIREBASE_CI_TOKEN }}
BRSA_STAGING_IOS_APP_ID: ${{ secrets.BRSA_STAGING_IOS_APP_ID }}
STAGING_FIREBASE_RELEASE_GROUPS: ${{ secrets.STAGING_FIREBASE_RELEASE_GROUPS }}