Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: mobile app #1075

Merged
merged 15 commits into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ dist
packages/web-server/public/assets
packages/web-server/tmp
packages/web-server/vendor/bundles
packages/desktop
packages/desktop
packages/mobile
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true

[*.{js,json,yml}]
charset = utf-8
indent_style = space
indent_size = 2
98 changes: 98 additions & 0 deletions .github/workflows/mobile.build-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Build Production

on: [workflow_dispatch]

jobs:
android:
defaults:
run:
working-directory: ./packages/mobile
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Export version from package.json
run:
echo "PACKAGE_VERSION=$(grep '"version"' package.json | cut -d '"' -f 4)" >> $GITHUB_ENV
- name: Setup react-native kernel and increase watchers
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
- name: Decode Production Android keystore
run: |
echo "${{ secrets.ANDROID_KEYSTORE }}" > keystore.keystore.asc
gpg -d --passphrase "${{ secrets.KEYSTORE_PASSPHRASE }}" --batch keystore.keystore.asc > android/app/keystore.keystore
- name: Install dependencies
run: yarn install
- name: Ruby Setup for Fastlane
uses: ruby/setup-ruby@v1
- name: fastlane
uses: maierj/[email protected]
env:
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
BUILD_NUMBER: ${{ github.run_number }}
ANDROID_KEYSTORE_ALIAS: ${{ secrets.ANDROID_KEYSTORE_ALIAS }}
ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
GOOGLE_PLAY_JSON_KEY_DATA: ${{ secrets.GOOGLE_PLAY_JSON_KEY_DATA }}
with:
lane: 'android prod'
- name: Upload universal apk to artifacts
uses: actions/upload-artifact@v2
with:
name: prod.apk
path: android/app/build/outputs/apk/prod/release/app-prod-release.apk
- name: Upload Android App Bundle to artifacts
uses: actions/upload-artifact@v2
with:
name: release.aab
path: android/app/build/outputs/bundle/prodRelease/app-prod-release.aab
ios:
defaults:
run:
working-directory: ./packages/mobile
runs-on: macos-11
timeout-minutes: 90
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Export version from package.json
run:
echo "PACKAGE_VERSION=$(grep '"version"' package.json | cut -d '"' -f 4)" >> $GITHUB_ENV
- name: Set longer yarn timeout
run: yarn config set network-timeout 300000
- name: Install dependencies
run: yarn run init
- name: Set ssh connection to Github
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Export Apple AppStore Connect API key
run: echo "${{ secrets.APPSTORE_CONNECT_KEY }}" > ios/Authkey.p8
- name: Ruby Setup for Fastlane
uses: ruby/setup-ruby@v1
- name: Setup fastlane
uses: maierj/[email protected]
env:
FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
with:
lane: 'ios setup'
- name: fastlane
uses: maierj/[email protected]
env:
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
APPLE_APP_ID: ${{ secrets.APP_APPLE_ID }}
APPSTORE_CONNECT_KEY_ID: ${{ secrets.APPSTORE_CONNECT_KEY_ID }}
APPSTORE_CONNECT_KEY_ISSUER_ID: ${{ secrets.APPSTORE_CONNECT_KEY_ISSUER_ID }}
FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
MATCH_CERTIFICATES_URL: ${{ secrets.MATCH_CERTIFICATES_URL }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
BUILD_NUMBER: ${{ github.run_number }}
with:
lane: 'ios prod'

100 changes: 100 additions & 0 deletions .github/workflows/mobile.build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Build Development

on:
push:
branches:
- develop
paths:
- packages/mobile/**
workflow_dispatch:

jobs:
android:
defaults:
run:
working-directory: ./packages/mobile
runs-on: ubuntu-latest
timeout-minutes: 45
if: "!contains(github.event.head_commit.message, 'skip ci')"
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Export version from package.json
run: |
echo "PACKAGE_VERSION=$(grep '"version"' package.json | cut -d '"' -f 4)" >> $GITHUB_ENV
- name: Setup react-native kernel and increase watchers
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
- name: Decode Dev Android keystore
run: |
echo "${{ secrets.DEV_KEYSTORE }}" > keystore.keystore.asc
gpg -d --passphrase "${{ secrets.DEV_KEYSTORE_PASSPHRASE }}" --batch keystore.keystore.asc > android/app/keystore.keystore
- name: Ruby Setup for Fastlane
uses: ruby/setup-ruby@v1
- name: Install dependencies
run: yarn install
- name: fastlane
uses: maierj/[email protected]
env:
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
BUILD_NUMBER: ${{ github.run_number }}
ANDROID_KEYSTORE_ALIAS: ${{ secrets.DEV_ANDROID_KEYSTORE_ALIAS }}
ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD: ${{ secrets.DEV_ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.DEV_ANDROID_KEYSTORE_PASSWORD }}
GOOGLE_PLAY_JSON_KEY_DATA: ${{ secrets.GOOGLE_PLAY_JSON_KEY_DATA }}
with:
lane: 'android dev'
- name: Upload universal apk to artifacts
uses: actions/upload-artifact@v2
with:
name: dev.apk
path: android/app/build/outputs/apk/dev/release/app-dev-release.apk
ios:
defaults:
run:
working-directory: ./packages/mobile
runs-on: macos-11
timeout-minutes: 90
if: "!contains(github.event.head_commit.message, 'skip ci')"
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Export version from package.json
run: |
echo "PACKAGE_VERSION=$(grep '"version"' package.json | cut -d '"' -f 4)" >> $GITHUB_ENV
- name: Set longer yarn timeout
run: yarn config set network-timeout 300000
- name: Ruby Setup for Fastlane
uses: ruby/setup-ruby@v1
- name: Install dependencies
run: yarn run init
- name: Set ssh connection to Github
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Export Apple AppStore Connect API key
run: echo "${{ secrets.APPSTORE_CONNECT_KEY }}" > ios/Authkey.p8
- name: Setup fastlane
uses: maierj/[email protected]
env:
FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
with:
lane: 'ios setup'
- name: fastlane
uses: maierj/[email protected]
env:
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
APPLE_APP_ID: ${{ secrets.DEV_APP_APPLE_ID }}
APPSTORE_CONNECT_KEY_ID: ${{ secrets.APPSTORE_CONNECT_KEY_ID }}
APPSTORE_CONNECT_KEY_ISSUER_ID: ${{ secrets.APPSTORE_CONNECT_KEY_ISSUER_ID }}
FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
MATCH_CERTIFICATES_URL: ${{ secrets.MATCH_CERTIFICATES_URL }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
BUILD_NUMBER: ${{ github.run_number }}
with:
lane: 'ios dev'
74 changes: 74 additions & 0 deletions .github/workflows/mobile.e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: e2e

on: [workflow_dispatch]


jobs:
android:
defaults:
run:
working-directory: ./packages/mobile
runs-on: macos-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1

- name: Download Android Emulator Image
run: |
$ANDROID_HOME/tools/bin/sdkmanager --install "system-images;android-28;default;x86_64"
$ANDROID_HOME/tools/bin/avdmanager create avd -n pixel -d "Nexus 5X" --package "system-images;android-28;default;x86_64"

- name: Install Dependencies
run: yarn install

- name: Add usesCleartextTraffic to release AndroidManifest.xml
run: yarn replace-in-file '<application' '<application android:usesCleartextTraffic="true"' ./android/app/src/main/AndroidManifest.xml

- name: Build for detox
env:
DETOX_CI: true
run: yarn detox build --configuration android.emu.release

- name: Setup Emulator
timeout-minutes: 10
run: |
echo "Starting emulator"
nohup $ANDROID_HOME/emulator/emulator -avd pixel -no-audio -no-snapshot -no-window -gpu swiftshader_indirect &
$ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done; input keyevent 82'
$ANDROID_HOME/platform-tools/adb shell settings put global window_animation_scale 0 &
$ANDROID_HOME/platform-tools/adb shell settings put global transition_animation_scale 0 &
$ANDROID_HOME/platform-tools/adb shell settings put global animator_duration_scale 0 &
echo "Emulator started"
- name: Run tests
run: yarn detox test --configuration android.emu.release

ios:
defaults:
run:
working-directory: ./packages/mobile
runs-on: macos-latest
timeout-minutes: 30

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1

- name: Install Dependencies
run: yarn install

- name: Install Pods
run: npx pod-install ios

- name: Install detox dependencies
run: brew tap wix/brew
- name: Install simulator utils
run: brew install applesimutils
- name: Build for detox
run: yarn detox build --configuration ios.sim.release
- name: Run tests
run: yarn detox test --configuration ios.sim.release
20 changes: 20 additions & 0 deletions .github/workflows/mobile.lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: lint & typescript check

on:
push:
paths:
- packages/mobile/**

jobs:
lint:
defaults:
run:
working-directory: ./packages/mobile
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
run: yarn install
- name: Lint code
run: yarn lint
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
ruby-version: 2.6.8
- name: Install dependencies
run: yarn install --pure-lockfile
run: yarn install
- name: Build
run: yarn build
- name: ESLint
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/web.beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
ruby-version: 2.6.8
- name: Install dependencies
run: yarn install --pure-lockfile
run: yarn install
- name: Build
run: yarn build
- name: ESLint
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/web.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
with:
ruby-version: 2.6.8
- name: Install dependencies
run: yarn install --pure-lockfile
run: yarn install
- name: Build
run: yarn build
- name: ESLint
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/web.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
with:
ruby-version: 2.6.8
- name: Install dependencies
run: yarn install --pure-lockfile
run: yarn install
- name: Build
run: yarn build
- name: ESLint
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,11 @@ yarn-error.log
package-lock.json
codeqldb
coverage

**/.pnp.*
**/.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
yarn run lint-staged
Loading