Skip to content

Commit

Permalink
chore(suite-native): add github workflow for preview builds and updates
Browse files Browse the repository at this point in the history
  • Loading branch information
matejkriz committed Oct 14, 2024
1 parent 32893c5 commit 6f79228
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 8 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/build-suite-native-preview.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion suite-native/app/.env.preview
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
EXPO_PUBLIC_ENVIRONMENT=preview
EXPO_PUBLIC_CODESIGN_BUILD=false
EXPO_PUBLIC_BLUETOOTH_ENABLED=true
3 changes: 3 additions & 0 deletions suite-native/app/.fingerprintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ios/**/*

!ios/Podfile.lock
4 changes: 4 additions & 0 deletions suite-native/app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 2 additions & 4 deletions suite-native/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand Down
1 change: 0 additions & 1 deletion suite-native/app/eas.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"adhoc": {
"env": {
"EXPO_PUBLIC_ENVIRONMENT": "preview",
"EXPO_PUBLIC_BLUETOOTH_ENABLED": "true",
"EXPO_PUBLIC_CODESIGN_BUILD": "false"
},
"autoIncrement": true,
Expand Down
4 changes: 2 additions & 2 deletions suite-native/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 6f79228

Please sign in to comment.