Skip to content

Commit

Permalink
test android deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
staszekscp committed Nov 23, 2022
1 parent ece97e2 commit 6eb567d
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 0 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/testBuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Build and deploy apps for testing

on:
workflow_dispatch:
pull_request:
types: [opened, synchronize]

env:
DEVELOPER_DIR: /Applications/Xcode_14.0.1.app/Contents/Developer

jobs:
validateActor:
runs-on: ubuntu-latest
outputs:
IS_DEPLOYER: ${{ fromJSON(steps.isUserDeployer.outputs.isTeamMember) || github.actor == 'OSBotify' }}
steps:
- id: isUserDeployer
uses: tspascoal/get-user-teams-membership@baf2e6adf4c3b897bd65a7e3184305c165aec872
with:
GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }}
username: ${{ github.actor }}
team: mobile-deployers

android:
name: Build and deploy Android
needs: validateActor
if: ${{ fromJSON(needs.validateActor.outputs.IS_DEPLOYER) }}
runs-on: ubuntu-latest
steps:

- uses: Expensify/App/.github/actions/composite/setupNode@main

- uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7
with:
ruby-version: '2.7'
bundler-cache: true

- name: Decrypt keystore
run: cd android/app && gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output my-upload-key.keystore my-upload-key.keystore.gpg
env:
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}

- name: Decrypt json key
run: cd android/app && gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output android-fastlane-json-key.json android-fastlane-json-key.json.gpg
env:
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}

- name: Run Fastlane beta test
id: runFastlaneBetaTest
run: bundle exec fastlane android build_test
env:
S3_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_ID }}
S3_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
S3_BUCKET: ad-hoc-expensify-cash
S3_REGION: us-east-1

- uses: actions/upload-artifact@v2
with:
name: paths.json
path: ./paths.json


postGithubComment:
runs-on: ubuntu-latest
name: An example job to comment a PR
needs: [android]
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: actions/download-artifact@v2
with:
name: paths.json

- id: set_var
run: |
content=`cat ./paths.json`
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
echo "::set-output name=paths::$content"
- name: Comment PR
uses: thollander/actions-comment-pull-request@v1
with:
message: |
'Hello world ! ${{fromJson(steps.set_var.outputs.paths).html_path}}'
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ source "https://rubygems.org"
gem "cocoapods", "~> 1.11.3"
gem "fastlane", "~> 2"
gem "xcpretty", "~> 0"


plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
10 changes: 10 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ GEM
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
apktools (0.7.4)
rubyzip (~> 2.0)
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.2.0)
Expand Down Expand Up @@ -155,6 +157,10 @@ GEM
xcodeproj (>= 1.13.0, < 2.0.0)
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3)
fastlane-plugin-aws_s3 (2.1.0)
apktools (~> 0.7)
aws-sdk-s3 (~> 1)
mime-types (~> 3.3)
ffi (1.15.5)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
Expand Down Expand Up @@ -207,6 +213,9 @@ GEM
json (2.6.2)
jwt (2.5.0)
memoist (0.16.2)
mime-types (3.4.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2022.0105)
mini_magick (4.11.0)
mini_mime (1.1.2)
minitest (5.16.2)
Expand Down Expand Up @@ -283,6 +292,7 @@ PLATFORMS
DEPENDENCIES
cocoapods (~> 1.11.3)
fastlane (~> 2)
fastlane-plugin-aws_s3
xcpretty (~> 0)

BUNDLED WITH
Expand Down
23 changes: 23 additions & 0 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,29 @@ platform :android do
)
end

desc "Build app for testing"
lane :build_test do
ENV["ENVFILE"]="e2e/.env.e2e"

gradle(
project_dir: './android',
task: 'bundle',
build_type: 'Release',
)

aws_s3(
access_key: ENV['S3_ACCESS_KEY'],
secret_access_key: ENV['S3_SECRET_ACCESS_KEY'],
bucket: ENV['S3_BUCKET'],
region: ENV['S3_REGION'],

apk: 'expensify_test.apk',
app_directory: 'android',
)

sh('echo "{\"apk_path\": \"${lane_context[SharedValues::S3_APK_OUTPUT_PATH]}\",\"html_path\": \"${lane_context[SharedValues::S3_HTML_OUTPUT_PATH]}\"}" > ../paths.json')
end

desc "Build and upload app to Google Play"
lane :beta do
ENV["ENVFILE"]=".env.production"
Expand Down
5 changes: 5 additions & 0 deletions fastlane/Pluginfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Autogenerated by fastlane
#
# Ensure this file is checked in to source control!

gem 'fastlane-plugin-aws_s3'

0 comments on commit 6eb567d

Please sign in to comment.