Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jairseedorf committed Apr 22, 2023
0 parents commit 25f7700
Show file tree
Hide file tree
Showing 6,533 changed files with 1,258,943 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 2 additions & 0 deletions .bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BUNDLE_PATH: "vendor/bundle"
BUNDLE_FORCE_RUBY_PLATFORM: 1
339 changes: 339 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,339 @@
version: 2.1

orbs:
gh: circleci/[email protected]

parameters:
version:
type: string
default: ""
platform:
type: string
default: ""
git_ref:
type: string
default: ""
gcs_directory:
type: string
default: ""
build_number:
type: string
default: ""
task:
type: string
default: ""
gcs_url:
type: string
default: ""

jobs:
test_android_in_pr:
docker:
- image: cimg/android:2022.12
resource_class: xlarge
environment:
TERM: dumb
JAVA_OPTS: -Xms512m -Xmx2g
GRADLE_OPTS: -Xmx3g -Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-Xmx2g -XX:+HeapDumpOnOutOfMemoryError"
working_directory: ~/galoy-mobile
shell: /bin/bash --login -o pipefail
steps:
# if workflow was triggered by API then don't run the test jobs
- run: |
if [ << pipeline.trigger_source >> = "api" ]; then
circleci-agent step halt
fi
- checkout:
path: ~/galoy-mobile
- run: sudo apt-get update
- run: curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
- run: sudo apt-get install -y gnupg2 gcc g++ make nodejs jq
- run: sudo npm install -g yarn

- run: sudo apt-get update
- run: sudo apt-get install gnupg2
- run: curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
- run: sudo apt-get install -y nodejs
- run: sudo apt-get install gcc g++ make
- run: sudo npm install -g yarn
- run: gpg --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

- restore_cache:
key: 1-gem-{{ checksum "android/Gemfile.lock" }}
- run: cd android && bundle config set deployment 'true'
- run: cd android && bundle check || bundle install
- save_cache:
key: 1-gem-{{ checksum "android/Gemfile.lock" }}
paths:
- android/vendor

- restore_cache:
key: yarn-{{ checksum "yarn.lock" }}
- run: yarn install
- save_cache:
key: yarn-{{ checksum "yarn.lock" }}
paths:
- node_modules
- run: echo $RELEASE_KEYSTORE | base64 -d > android/app/release.keystore
- run: yarn android:prepareAssets
- run:
name: Test Browserstack
command: |
set -o pipefail
cd android && bundle exec fastlane browserstack | tee browserstack_output.log
error_code=$?
SESSION_ID=$(cat browserstack_output.log | grep sessionId | head -n1 | sed -n "s/^.*'\(.*\)'.*$/\1/ p")
echo "Session ID"
echo $SESSION_ID
VIDEO_URL=$(curl -s -u "$BROWSERSTACK_USER:$BROWSERSTACK_ACCESS_KEY" -X GET "https://api-cloud.browserstack.com/app-automate/sessions/$SESSION_ID.json" | jq -r '.automation_session.video_url')
echo "Video URL"
echo $VIDEO_URL
exit $error_code
test_ios_in_pr:
macos:
xcode: 14.2.0
working_directory: ~/galoy-mobile
environment:
FL_OUTPUT_DIR: output
shell: /bin/bash --login -o pipefail
steps:
# if workflow was triggered by API then don't run the test jobs
- run: |
if [ << pipeline.trigger_source >> = "api" ]; then
circleci-agent step halt
fi
- checkout:
path: ~/galoy-mobile

- run:
name: Check Ruby version
command: |
rbenv versions
echo "Ruby version in .ruby-version:"
cat .ruby-version
echo "Ruby version in Gemfile:"
grep -E "^ruby" Gemfile
- run:
name: Install Bundler 2.2.30
command: |
gem install bundler:2.2.30
echo "export BUNDLE_PATH=$(bundle show --path)" >> $BASH_ENV
source $BASH_ENV
- add_ssh_keys:
fingerprints:
- "19:7e:f3:6c:be:a7:17:01:7d:09:ca:39:c3:98:86:90"
- restore_cache:
key: 1-gem-{{ checksum "ios/Gemfile.lock" }}
- run: cd ios && bundle config set deployment 'true'
- run: cd ios && bundle config set --local path 'vendor/bundle'
- run: cd ios && bundle check || bundle install
- run: gem install cocoapods
- save_cache:
key: 1-gem-{{ checksum "ios/Gemfile.lock" }}
paths:
- ios/vendor
- restore_cache:
key: 1-yarn-{{ checksum "yarn.lock" }}-pod1-{{ checksum "ios/Podfile.lock" }}
- run: yarn install
- save_cache:
key: 1-yarn-{{ checksum "yarn.lock" }}-pod1-{{ checksum "ios/Podfile.lock" }}
paths:
- node_modules
- ios/Pods
- run:
name: Browserstack Testing
command: |
set -o pipefail
cd ios && bundle exec fastlane browserstack | tee browserstack_output.log
error_code=$?
SESSION_ID=$(cat browserstack_output.log | grep sessionId | head -n1 | sed -n "s/^.*'\(.*\)'.*$/\1/ p")
echo "Session ID"
echo $SESSION_ID
VIDEO_URL=$(curl -s -u "$BROWSERSTACK_USER:$BROWSERSTACK_ACCESS_KEY" -X GET "https://api-cloud.browserstack.com/app-automate/sessions/$SESSION_ID.json" | jq -r '.automation_session.video_url')
echo "Video URL"
echo $VIDEO_URL
exit $error_code
no_output_timeout: 15m

build_android:
docker:
- image: cimg/android:2022.12
resource_class: xlarge
environment:
TERM: dumb
JAVA_OPTS: -Xms2g -Xmx4g
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-Xmx4g -XX:+HeapDumpOnOutOfMemoryError"
PUBLIC_VERSION: << pipeline.parameters.version >>
BUILD_NUMBER: << pipeline.parameters.build_number >>
GCS_DIRECTORY: << pipeline.parameters.gcs_directory >>
working_directory: ~/galoy-mobile
shell: /bin/bash --login -o pipefail
steps:
# if workflow was triggered by github then don't run the test jobs
- run: |
if [ << pipeline.trigger_source >> = "webhook" ]; then
circleci-agent step halt
fi
- gh/install
- checkout:
path: ~/galoy-mobile
- run: git checkout << pipeline.parameters.git_ref >>
- run: sudo apt-get update
- run: curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
- run: sudo apt-get install -y nodejs
- run: sudo npm install -g yarn
- run: gpg --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
- run: echo $GCLOUD_BUCKET_KEY | base64 --decode > key.json
- run: gcloud auth activate-service-account --key-file key.json

- run: cd android && bundle config set deployment 'true'
- run: cd android && bundle check || bundle install

- restore_cache:
key: 2-yarn-{{ checksum "yarn.lock" }}-android
- run: yarn install
- save_cache:
key: 2-yarn-{{ checksum "yarn.lock" }}-android
paths:
- node_modules
- run: echo $JAVA_OPTS
- run: echo $GRADLE_OPTS
- run: echo $RELEASE_KEYSTORE | base64 -d > android/app/release.keystore
- run:
name: build
command: |
cd android
sed -i'' -e "s/versionCode .*$/versionCode $BUILD_NUMBER/g" app/build.gradle
bundle exec fastlane android build 2>&1 | tee android_build_output.log
no_output_timeout: 15m
- run:
name: upload to gcs
command: gsutil cp -r android/app/build/outputs/* gs://galoy-build-artifacts/galoy-mobile/$GCS_DIRECTORY/galoy-mobile-$(date +%s)-v${PUBLIC_VERSION}/
- store_artifacts:
path: android/android_build_output.log

build_ios:
macos:
xcode: 14.2.0
resource_class: macos.x86.medium.gen2
environment:
PUBLIC_VERSION: << pipeline.parameters.version >>
BUILD_NUMBER: << pipeline.parameters.build_number >>
GCS_DIRECTORY: << pipeline.parameters.gcs_directory >>
working_directory: ~/galoy-mobile
shell: /bin/bash --login -o pipefail
steps:
# if workflow was triggered by github then don't run the test jobs
- run: |
if [ << pipeline.trigger_source >> = "webhook" ]; then
circleci-agent step halt
fi
- gh/install
- checkout:
path: ~/galoy-mobile
- run: git checkout << pipeline.parameters.git_ref >>
- run:
name: Install Bundler 2.2.30
command: |
gem install bundler:2.2.30
echo "export BUNDLE_PATH=$(bundle show --path)" >> $BASH_ENV
source $BASH_ENV
- add_ssh_keys:
fingerprints:
- "19:7e:f3:6c:be:a7:17:01:7d:09:ca:39:c3:98:86:90"
- run: HOMEBREW_NO_AUTO_UPDATE=1 brew install --cask google-cloud-sdk
- run: echo $GCLOUD_BUCKET_KEY | base64 --decode > key.json
- run: gcloud auth activate-service-account --key-file key.json
- restore_cache:
key: 1-gem-{{ checksum "ios/Gemfile.lock" }}
- run: cd ios && bundle config set deployment 'true'
- run: cd ios && bundle config set --local path 'vendor/bundle'
- run: cd ios && bundle check || bundle install
- run: gem install cocoapods
- save_cache:
key: 1-gem-{{ checksum "ios/Gemfile.lock" }}
paths:
- ios/vendor
- restore_cache:
key: 1-yarn-{{ checksum "yarn.lock" }}-pod1-{{ checksum "ios/Podfile.lock" }}
- run: yarn install
- save_cache:
key: 1-yarn-{{ checksum "yarn.lock" }}-pod1-{{ checksum "ios/Podfile.lock" }}
paths:
- node_modules
- ios/Pods
- run:
name: build
command: |
cd ios
sed -i'' -e "s/MARKETING_VERSION.*/MARKETING_VERSION = $PUBLIC_VERSION;/g" GaloyApp.xcodeproj/project.pbxproj
bundle exec fastlane build 2>&1 | tee ios_build_output.log
no_output_timeout: 15m
- run:
name: upload to gcs
command: |
timestamp=$(date +%s)
gsutil cp -r ~/galoy-mobile/ios/Bitcoin\ Beach.ipa gs://galoy-build-artifacts/galoy-mobile/$GCS_DIRECTORY/galoy-mobile-$timestamp-v${PUBLIC_VERSION}/
gsutil cp -r ~/galoy-mobile/ios/Bitcoin\ Beach.app.dSYM.zip gs://galoy-build-artifacts/galoy-mobile/$GCS_DIRECTORY/galoy-mobile-$timestamp-v${PUBLIC_VERSION}/
- store_artifacts:
path: ios/ios_build_output.log

upload_to_app_store:
macos:
xcode: 14.2.0
resource_class: macos.x86.medium.gen2
environment:
GCS_URL: << pipeline.parameters.gcs_url >>
working_directory: ~/galoy-mobile
shell: /bin/bash --login -o pipefail
steps:
# if workflow was triggered by github then don't run the test jobs
- run: |
if [ << pipeline.trigger_source >> = "webhook" ]; then
circleci-agent step halt
fi
- gh/install
- checkout:
path: ~/galoy-mobile
- run: HOMEBREW_NO_AUTO_UPDATE=1 brew install --cask google-cloud-sdk
- run: echo $GCLOUD_BUCKET_KEY | base64 --decode > key.json
- run: gcloud auth activate-service-account --key-file key.json
- run: git checkout << pipeline.parameters.git_ref >>
- run: cd ios && gsutil cp -r "$GCS_URL" .
- restore_cache:
key: 1-gem-{{ checksum "ios/Gemfile.lock" }}
- run: cd ios && bundle check || bundle install
- save_cache:
key: 1-gem-{{ checksum "ios/Gemfile.lock" }}
paths:
- ios/vendor
- run: cd ios && bundle exec fastlane app_store_upload

workflows:
build_android_and_upload_to_bucket:
when:
equal: [android, << pipeline.parameters.platform >>]
jobs:
- build_android
build_ios_and_upload_to_bucket:
when:
equal: [ios, << pipeline.parameters.platform >>]
jobs:
- build_ios
upload_to_app_store:
when:
and:
- equal: [upload_to_app_store, << pipeline.parameters.task >>]
- equal: ["api", << pipeline.trigger_source >>]
jobs:
- upload_to_app_store
test_in_pr:
when:
not:
equal: [main, << pipeline.git.branch >>]
jobs:
- test_android_in_pr
- test_ios_in_pr
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Windows files
[*.bat]
end_of_line = crlf
Loading

0 comments on commit 25f7700

Please sign in to comment.