From 6f7922870d525b375bc79d984fbd37ba23cb7c65 Mon Sep 17 00:00:00 2001 From: Matej Kriz Date: Fri, 20 Sep 2024 17:07:03 +0200 Subject: [PATCH] chore(suite-native): add github workflow for preview builds and updates --- .../workflows/build-suite-native-preview.yml | 58 +++++++++++++++++++ suite-native/app/.env.preview | 1 - suite-native/app/.fingerprintignore | 3 + suite-native/app/README.md | 4 ++ suite-native/app/app.config.ts | 6 +- suite-native/app/eas.json | 1 - suite-native/app/package.json | 4 +- 7 files changed, 69 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/build-suite-native-preview.yml create mode 100644 suite-native/app/.fingerprintignore diff --git a/.github/workflows/build-suite-native-preview.yml b/.github/workflows/build-suite-native-preview.yml new file mode 100644 index 000000000000..1ed993360b63 --- /dev/null +++ b/.github/workflows/build-suite-native-preview.yml @@ -0,0 +1,58 @@ +name: "[Build] suite-native preview" + +on: + push: + # push develop(default) branch is necessary for this action to update its fingerprint database + branches: [develop] + pull_request: + paths: + - "suite-native/**" + - "packages/react-native-usb/**" + - "packages/transport-native/**" + - "yarn.lock" + # list of paths is not complete, but it's always possible to dispatch manually + workflow_dispatch: + +jobs: + update: + if: github.repository == 'trezor/trezor-suite' || github.repository == 'trezor/trezor-suite-private' + name: EAS Update + runs-on: ubuntu-latest + concurrency: fingerprint-${{ github.workflow }}-${{ github.head_ref || github.run_id }} + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + EXPO_PUBLIC_ENVIRONMENT: preview + permissions: + contents: read + pull-requests: write + actions: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + cache: yarn + - name: Setup EAS + uses: expo/expo-github-action@v8 + with: + eas-version: latest + token: ${{ secrets.EXPO_TOKEN_DEVELOP }} + - name: Install libs + run: yarn workspaces focus @suite-native/app + + - name: Create preview builds if fingerprint changed + uses: expo/expo-github-action/preview-build@main + with: + command: eas build --profile preview --platform all + working-directory: suite-native/app + + - name: Install deps and build libs + run: | + yarn install --immutable + yarn message-system-sign-config + + - name: Create preview update + uses: expo/expo-github-action/preview@v8 + with: + command: eas update --auto + working-directory: suite-native/app diff --git a/suite-native/app/.env.preview b/suite-native/app/.env.preview index 605b5f252dde..d2479a3b6ff1 100644 --- a/suite-native/app/.env.preview +++ b/suite-native/app/.env.preview @@ -1,3 +1,2 @@ EXPO_PUBLIC_ENVIRONMENT=preview EXPO_PUBLIC_CODESIGN_BUILD=false -EXPO_PUBLIC_BLUETOOTH_ENABLED=true diff --git a/suite-native/app/.fingerprintignore b/suite-native/app/.fingerprintignore new file mode 100644 index 000000000000..ed463428a533 --- /dev/null +++ b/suite-native/app/.fingerprintignore @@ -0,0 +1,3 @@ +ios/**/* + +!ios/Podfile.lock diff --git a/suite-native/app/README.md b/suite-native/app/README.md index 6832b48a5a55..0507d0e4a39a 100644 --- a/suite-native/app/README.md +++ b/suite-native/app/README.md @@ -69,6 +69,10 @@ You can override ENV variables locally using `.env.development.local` (or `.env. > You can use `EXPO_PUBLIC_IS_ANALYTICS_LOGGER_ENABLED=true` in `.env.development.local` to debug analytics locally. +## Native changes - bumping runtimeVersion + +Whenever you do a change in a native code (updating native dependency and so on), you have to bump `runtimeVersion` in `app.config.ts` file manually so EAS knows that it has to prepare new development build. See [Runtime Versions Expo Docs](https://docs.expo.dev/distribution/runtime-versions/). Hopefully it's just a temporary situation until [fingerprint policy](https://docs.expo.dev/eas-update/runtime-versions/#fingerprint-runtime-version-policy) is finalized. Fingerprint policy is not working well with development builds yet, waiting for SDK 52. + ## Troubleshooting 1. For any issues with the build, try to clean the project and rebuild it: diff --git a/suite-native/app/app.config.ts b/suite-native/app/app.config.ts index ef94daa71bc2..33228d866a6b 100644 --- a/suite-native/app/app.config.ts +++ b/suite-native/app/app.config.ts @@ -169,10 +169,8 @@ export default ({ config }: ConfigContext): ExpoConfig => { slug: appSlugs[buildType], owner: appOwners[buildType], version: suiteNativeVersion, - runtimeVersion: { - policy: 'fingerprint', - }, - ...(buildType === 'develop' + runtimeVersion: '2', + ...(['develop', 'preview'].includes(buildType) ? { updates: { url: `https://u.expo.dev/${projectId}`, diff --git a/suite-native/app/eas.json b/suite-native/app/eas.json index c45dd6ed68be..f3b6ce69dd3d 100644 --- a/suite-native/app/eas.json +++ b/suite-native/app/eas.json @@ -33,7 +33,6 @@ "adhoc": { "env": { "EXPO_PUBLIC_ENVIRONMENT": "preview", - "EXPO_PUBLIC_BLUETOOTH_ENABLED": "true", "EXPO_PUBLIC_CODESIGN_BUILD": "false" }, "autoIncrement": true, diff --git a/suite-native/app/package.json b/suite-native/app/package.json index 99bc330575e1..81bd15a7e2a9 100644 --- a/suite-native/app/package.json +++ b/suite-native/app/package.json @@ -13,8 +13,8 @@ "pods": "npx pod-install", "prebuild": "expo prebuild", "build:adhoc": "npx eas-cli build --profile adhoc", - "eas-build-post-install": "yarn workspace @suite-common/message-system sign-config", - "eas-build-on-success": "./eas-post-success.sh", + "eas-build-post-install": "./eas-scripts/eas-post-install.sh", + "eas-build-on-success": "./eas-scripts/eas-post-success.sh", "prebuild:clean": "expo prebuild --clean", "build:e2e": "../../node_modules/.bin/detox build --configuration", "test:e2e": "../../node_modules/.bin/detox test --configuration",