From 6eb567d09fa40f80e7d815980ef2c64144406b7e Mon Sep 17 00:00:00 2001 From: staszekscp Date: Fri, 18 Nov 2022 09:55:08 +0100 Subject: [PATCH 01/24] test android deployment --- .github/workflows/testBuild.yml | 87 +++++++++++++++++++++++++++++++++ Gemfile | 4 ++ Gemfile.lock | 10 ++++ fastlane/Fastfile | 23 +++++++++ fastlane/Pluginfile | 5 ++ 5 files changed, 129 insertions(+) create mode 100644 .github/workflows/testBuild.yml create mode 100644 fastlane/Pluginfile diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml new file mode 100644 index 000000000000..f760ea946281 --- /dev/null +++ b/.github/workflows/testBuild.yml @@ -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}}' \ No newline at end of file diff --git a/Gemfile b/Gemfile index c41a21c6604f..86cf34940e86 100644 --- a/Gemfile +++ b/Gemfile @@ -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) \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 5ac763189187..95a2611d953c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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) @@ -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) @@ -283,6 +292,7 @@ PLATFORMS DEPENDENCIES cocoapods (~> 1.11.3) fastlane (~> 2) + fastlane-plugin-aws_s3 xcpretty (~> 0) BUNDLED WITH diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 74060ccb501c..795dec68c235 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -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" diff --git a/fastlane/Pluginfile b/fastlane/Pluginfile new file mode 100644 index 000000000000..c6ab0dfb46a4 --- /dev/null +++ b/fastlane/Pluginfile @@ -0,0 +1,5 @@ +# Autogenerated by fastlane +# +# Ensure this file is checked in to source control! + +gem 'fastlane-plugin-aws_s3' From cf1412a8e22e7464b0c020fc8128bbb7e7495a08 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Fri, 18 Nov 2022 12:51:27 +0100 Subject: [PATCH 02/24] add ios build_test lane --- .github/workflows/testBuild.yml | 52 ++++++++++++++++++++++++++++----- fastlane/Fastfile | 51 ++++++++++++++++++++++++++++++-- 2 files changed, 93 insertions(+), 10 deletions(-) diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index f760ea946281..4195e8f921e4 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -56,32 +56,68 @@ jobs: - uses: actions/upload-artifact@v2 with: - name: paths.json - path: ./paths.json + name: android_paths.json + path: ./android_paths.json + + iOS: + name: Build and deploy iOS + needs: validateActor + if: ${{ fromJSON(needs.validateActor.outputs.IS_DEPLOYER) }} + runs-on: macos-12 + steps: + - uses: Expensify/App/.github/actions/composite/setupNode@main + + - uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7 + with: + ruby-version: '2.7' + bundler-cache: true + + - name: Install cocoapods + uses: nick-invision/retry@0711ba3d7808574133d713a0d92d2941be03a350 + with: + timeout_minutes: 10 + max_attempts: 5 + command: cd ios && pod install + + - name: Decrypt profile + run: cd ios && gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output chat_expensify_adhoc.mobileprovision.gpg chat_expensify_adhoc.mobileprovision.gpg.gpg + env: + LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }} + + - name: Decrypt certificate + run: cd ios && gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output Certificates.p12 Certificates.p12.gpg + env: + LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }} + + - name: Run Fastlane + run: bundle exec fastlane ios 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 postGithubComment: runs-on: ubuntu-latest name: An example job to comment a PR - needs: [android] + needs: [android, ios] 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=`cat ./android_paths.json` content="${content//'%'/'%25'}" content="${content//$'\n'/'%0A'}" content="${content//$'\r'/'%0D'}" - echo "::set-output name=paths::$content" + echo "::set-output name=android_paths::$content" - name: Comment PR uses: thollander/actions-comment-pull-request@v1 with: message: | - 'Hello world ! ${{fromJson(steps.set_var.outputs.paths).html_path}}' \ No newline at end of file + 'Hello world ! ${{fromJson(steps.set_var.outputs.android_paths).html_path}}' \ No newline at end of file diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 795dec68c235..12df04586092 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -52,11 +52,11 @@ platform :android do bucket: ENV['S3_BUCKET'], region: ENV['S3_REGION'], - apk: 'expensify_test.apk', + apk: lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH], 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') + sh("echo '{\"apk_path\": \"#{lane_context[SharedValues::S3_APK_OUTPUT_PATH]}\",\"html_path\": \"#{lane_context[SharedValues::S3_HTML_OUTPUT_PATH]}\"}' > ../android_paths.json") end desc "Build and upload app to Google Play" @@ -114,6 +114,53 @@ platform :ios do ) end + desc "Build app for testing" + lane :build_test do + require 'securerandom' + ENV["ENVFILE"]=".env.production" + + keychain_password = SecureRandom.uuid + + create_keychain( + name: "ios-build.keychain", + password: keychain_password, + default_keychain: "true", + unlock: "true", + timeout: "3600", + add_to_search_list: "true" + ) + + import_certificate( + certificate_path: "./ios/Certificates.p12", + keychain_name: "ios-build.keychain", + keychain_password: keychain_password + ) + + install_provisioning_profile( + path: "./ios/chat_expensify_adhoc.mobileprovision.gpg" + ) + + build_app( + workspace: "./ios/NewExpensify.xcworkspace", + scheme: "NewExpensify", + export_options: { + manageAppVersionAndBuildNumber: false + } + ) + + aws_s3( + access_key: ENV['S3_ACCESS_KEY'], + secret_access_key: ENV['S3_SECRET_ACCESS_KEY'], + bucket: ENV['S3_BUCKET'], + region: ENV['S3_REGION'], + + ipa: lane_context[SharedValues::IPA_OUTPUT_PATH], + app_directory: 'ios', + ) + + sh("echo '{\"ipa_path\": \"#{lane_context[SharedValues::S3_IPA_OUTPUT_PATH]}\",\"html_path\": \"#{lane_context[SharedValues::S3_HTML_OUTPUT_PATH]}\"}' > ../ios_paths.json") + end + desc "Build and upload app to TestFlight" lane :beta do require 'securerandom' From a32b785b9ccb4e5adf00fee68052e737b6e09f3c Mon Sep 17 00:00:00 2001 From: staszekscp Date: Fri, 18 Nov 2022 14:35:13 +0100 Subject: [PATCH 03/24] fix adding comment --- .github/workflows/testBuild.yml | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index 4195e8f921e4..b316305d6371 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -56,7 +56,7 @@ jobs: - uses: actions/upload-artifact@v2 with: - name: android_paths.json + name: android path: ./android_paths.json iOS: @@ -96,6 +96,11 @@ jobs: 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: ios + path: ./ios_paths.json postGithubComment: @@ -108,16 +113,22 @@ jobs: - uses: actions/download-artifact@v2 - - id: set_var + - name: Read JSONs with paths + id: set_var run: | - content=`cat ./android_paths.json` - content="${content//'%'/'%25'}" - content="${content//$'\n'/'%0A'}" - content="${content//$'\r'/'%0D'}" - echo "::set-output name=android_paths::$content" + content_android=`cat ./android/android_paths.json` + content_android="${content_android//'%'/'%25'}" + content_android="${content_android//$'\n'/'%0A'}" + content_android="${content_android//$'\r'/'%0D'}" + echo "::set-output name=android_paths::$content_android" + content_ios=`cat ./ios/ios_paths.json` + content_ios="${content_ios//'%'/'%25'}" + content_ios="${content_ios//$'\n'/'%0A'}" + content_ios="${content_ios//$'\r'/'%0D'}" + echo "::set-output name=ios_paths::$content_ios" - name: Comment PR uses: thollander/actions-comment-pull-request@v1 with: message: | - 'Hello world ! ${{fromJson(steps.set_var.outputs.android_paths).html_path}}' \ No newline at end of file + 'Hello world ! ${{fromJson(steps.set_var.outputs.android_paths).html_path}} and ${{fromJson(steps.set_var.outputs.ios_paths).html_path}}'' \ No newline at end of file From cd1a13a0763f431e97ac2d96dc37d322c80929f2 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Fri, 18 Nov 2022 14:36:38 +0100 Subject: [PATCH 04/24] switch envfile --- fastlane/Fastfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 12df04586092..bd6e0c1a36ca 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -38,7 +38,7 @@ platform :android do desc "Build app for testing" lane :build_test do - ENV["ENVFILE"]="e2e/.env.e2e" + ENV["ENVFILE"]=".env.staging" gradle( project_dir: './android', @@ -117,7 +117,7 @@ platform :ios do desc "Build app for testing" lane :build_test do require 'securerandom' - ENV["ENVFILE"]=".env.production" + ENV["ENVFILE"]=".env.staging" keychain_password = SecureRandom.uuid From bb54af2720aefb4a20bd66c73d4e5cafaa84135b Mon Sep 17 00:00:00 2001 From: staszekscp Date: Mon, 21 Nov 2022 09:27:51 +0100 Subject: [PATCH 05/24] remove validate actor --- .github/workflows/testBuild.yml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index b316305d6371..3341fe970f22 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -9,22 +9,9 @@ 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: @@ -62,7 +49,6 @@ jobs: iOS: name: Build and deploy iOS needs: validateActor - if: ${{ fromJSON(needs.validateActor.outputs.IS_DEPLOYER) }} runs-on: macos-12 steps: - uses: Expensify/App/.github/actions/composite/setupNode@main From a2a61ea8a0230218aac2d6b6c8b966d462550847 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Mon, 21 Nov 2022 10:41:56 +0100 Subject: [PATCH 06/24] romeve needs: validateActor --- .github/workflows/testBuild.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index 3341fe970f22..5f268eb87ed1 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -11,7 +11,6 @@ env: jobs: android: name: Build and deploy Android - needs: validateActor runs-on: ubuntu-latest steps: @@ -48,7 +47,6 @@ jobs: iOS: name: Build and deploy iOS - needs: validateActor runs-on: macos-12 steps: - uses: Expensify/App/.github/actions/composite/setupNode@main @@ -87,8 +85,7 @@ jobs: with: name: ios path: ./ios_paths.json - - + postGithubComment: runs-on: ubuntu-latest name: An example job to comment a PR From 1ae52cf4e2f8c2e6b729f5593a8d501cad8aa366 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Mon, 21 Nov 2022 10:53:41 +0100 Subject: [PATCH 07/24] add test web job --- .github/workflows/testBuild.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index 5f268eb87ed1..a91aea6436a6 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -86,6 +86,32 @@ jobs: name: ios path: ./ios_paths.json + web: + name: Build and deploy Web + runs-on: ubuntu-latest + steps: + - uses: Expensify/App/.github/actions/composite/setupNode@main + + - name: Configure AWS Credentials + # Version: 1.5.5 + uses: aws-actions/configure-aws-credentials@e97d7fbc8e0e5af69631c13daa0f4b5a8d88165b + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + + - name: Build web for staging + run: npm run build-staging + + - name: Build docs + run: npm run storybook-build + continue-on-error: true + + - name: Deploy to S3 for internal testing + run: aws s3 cp --recursive --acl public-read "$GITHUB_WORKSPACE"/dist s3://ad-hoc-expensify-cash/web/"$PULL_REQUEST_NAME" + env: + PULL_REQUEST_NAME: ${{ github.event.pull_request.title }} + postGithubComment: runs-on: ubuntu-latest name: An example job to comment a PR From e6d0d3221360260eb3968bbd28afffa29bbc4bab Mon Sep 17 00:00:00 2001 From: staszekscp Date: Mon, 21 Nov 2022 12:30:28 +0100 Subject: [PATCH 08/24] add web to needs --- .github/workflows/testBuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index a91aea6436a6..dcd59c3c164f 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -115,7 +115,7 @@ jobs: postGithubComment: runs-on: ubuntu-latest name: An example job to comment a PR - needs: [android, ios] + needs: [android, ios, web] steps: - name: Checkout uses: actions/checkout@v3 From 2bfaa7783ea673fe42fba3a2e179b0d939f644ee Mon Sep 17 00:00:00 2001 From: staszekscp Date: Mon, 21 Nov 2022 15:52:52 +0100 Subject: [PATCH 09/24] test --- .github/workflows/testBuild.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index dcd59c3c164f..5f39b33098b0 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -1,8 +1,7 @@ name: Build and deploy apps for testing on: - workflow_dispatch: - pull_request: + pull_request_target: types: [opened, synchronize] env: From d391290a79112cc0b6105437790a3e879ac2c4ca Mon Sep 17 00:00:00 2001 From: staszekscp Date: Mon, 21 Nov 2022 16:13:41 +0100 Subject: [PATCH 10/24] test --- .github/workflows/testBuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index 5f39b33098b0..ce239204b52e 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -1,7 +1,7 @@ name: Build and deploy apps for testing on: - pull_request_target: + pull_request: types: [opened, synchronize] env: From ffe4ff24d13eca1271e44567d2416639463a8127 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 22 Nov 2022 12:24:43 +0100 Subject: [PATCH 11/24] test --- .github/workflows/cla.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 8943669c2ba8..7e413720931d 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -13,6 +13,7 @@ jobs: # It does not run for pull requests created by OSBotify if: ${{ github.event.issue.pull_request || (github.event_name == 'pull_request_target' && github.event.pull_request.user.login != 'OSBotify') }} steps: + - uses: Expensify/App/.github/actions/composite/setupNode@main - uses: actions-ecosystem/action-regex-match@9c35fe9ac1840239939c59e5db8839422eed8a73 id: sign with: From d67f2720a615073eac6cc3441e10f06395975a95 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 22 Nov 2022 12:27:28 +0100 Subject: [PATCH 12/24] test --- .github/workflows/cla.yml | 1 - .github/workflows/testBuild.yml | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 7e413720931d..8943669c2ba8 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -13,7 +13,6 @@ jobs: # It does not run for pull requests created by OSBotify if: ${{ github.event.issue.pull_request || (github.event_name == 'pull_request_target' && github.event.pull_request.user.login != 'OSBotify') }} steps: - - uses: Expensify/App/.github/actions/composite/setupNode@main - uses: actions-ecosystem/action-regex-match@9c35fe9ac1840239939c59e5db8839422eed8a73 id: sign with: diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index ce239204b52e..400f461d6be4 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -1,8 +1,10 @@ name: Build and deploy apps for testing on: - pull_request: - types: [opened, synchronize] + workflow_run: + workflows: [Jest Unit Tests] + types: + - completed env: DEVELOPER_DIR: /Applications/Xcode_14.0.1.app/Contents/Developer From 0174dcb26060fc71c3f364f36640fb3c7310c43c Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 22 Nov 2022 14:46:10 +0100 Subject: [PATCH 13/24] test --- .github/actions/composite/setupNode/action.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/actions/composite/setupNode/action.yml b/.github/actions/composite/setupNode/action.yml index 95e187ff4d3a..eeae2012573e 100644 --- a/.github/actions/composite/setupNode/action.yml +++ b/.github/actions/composite/setupNode/action.yml @@ -4,9 +4,7 @@ description: Set up Node runs: using: composite steps: - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - with: - fetch-depth: 0 + - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 with: From 420dba92d6b5481249a6aa0f2cb07a6370e5a5d3 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Wed, 23 Nov 2022 09:50:24 +0100 Subject: [PATCH 14/24] revert test changes --- .github/actions/composite/setupNode/action.yml | 4 +++- .github/workflows/testBuild.yml | 5 +---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/actions/composite/setupNode/action.yml b/.github/actions/composite/setupNode/action.yml index eeae2012573e..95e187ff4d3a 100644 --- a/.github/actions/composite/setupNode/action.yml +++ b/.github/actions/composite/setupNode/action.yml @@ -4,7 +4,9 @@ description: Set up Node runs: using: composite steps: - + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + fetch-depth: 0 - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 with: diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index 400f461d6be4..6ded7e7bb7e4 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -1,10 +1,7 @@ name: Build and deploy apps for testing on: - workflow_run: - workflows: [Jest Unit Tests] - types: - - completed + pull_request: env: DEVELOPER_DIR: /Applications/Xcode_14.0.1.app/Contents/Developer From 5f34e1d0d034985f280dcb95dede755189fd3bee Mon Sep 17 00:00:00 2001 From: staszekscp Date: Wed, 23 Nov 2022 16:23:32 +0100 Subject: [PATCH 15/24] finish test version --- .../actions/composite/setupNode/action.yml | 4 - .../e2ePerformanceRegressionTests.yml | 9 +- .github/workflows/lint.yml | 4 + .github/workflows/platformDeploy.yml | 20 ++++ .github/workflows/test.yml | 4 + .github/workflows/testBuild.yml | 105 ++++++++++++------ .github/workflows/validateGithubActions.yml | 4 + .github/workflows/verifyPodfile.yml | 4 + fastlane/Fastfile | 6 +- 9 files changed, 116 insertions(+), 44 deletions(-) diff --git a/.github/actions/composite/setupNode/action.yml b/.github/actions/composite/setupNode/action.yml index 95e187ff4d3a..d475acf5380f 100644 --- a/.github/actions/composite/setupNode/action.yml +++ b/.github/actions/composite/setupNode/action.yml @@ -4,10 +4,6 @@ description: Set up Node runs: using: composite steps: - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - with: - fetch-depth: 0 - - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 with: node-version-file: '.nvmrc' diff --git a/.github/workflows/e2ePerformanceRegressionTests.yml b/.github/workflows/e2ePerformanceRegressionTests.yml index a59eb8c0dbff..9ed2e9ed4e33 100644 --- a/.github/workflows/e2ePerformanceRegressionTests.yml +++ b/.github/workflows/e2ePerformanceRegressionTests.yml @@ -7,10 +7,14 @@ on: jobs: e2e-tests: if: ${{ github.event.label.name == 'e2e' }} - name: "Run e2e performance regression tests" + name: 'Run e2e performance regression tests' # Although the tests will run on an android emulator, using macOS as its more performant runs-on: macos-12 steps: + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + fetch-depth: 0 + - uses: Expensify/App/.github/actions/composite/setupNode@main - uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7 @@ -43,7 +47,7 @@ jobs: disable-animations: false script: echo "Generated AVD snapshot for caching." -# Note: if the android build fails the logs can be incomplete. It can help to run the build once manually to get a full log + # Note: if the android build fails the logs can be incomplete. It can help to run the build once manually to get a full log - name: Preheat build system env: JAVA_HOME: ${{ env.JAVA_HOME_11_X64 }} @@ -76,4 +80,3 @@ jobs: name: test-failure-logs path: e2e/.results retention-days: 5 - diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0af8907b085d..f41c02352097 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,6 +11,10 @@ jobs: if: ${{ github.actor != 'OSBotify' || github.event_name == 'workflow_call' }} runs-on: ubuntu-latest steps: + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + fetch-depth: 0 + - uses: Expensify/App/.github/actions/composite/setupNode@main - run: npm run lint diff --git a/.github/workflows/platformDeploy.yml b/.github/workflows/platformDeploy.yml index 6aa397758ea2..c1cc0d3485e9 100644 --- a/.github/workflows/platformDeploy.yml +++ b/.github/workflows/platformDeploy.yml @@ -31,6 +31,10 @@ jobs: if: ${{ fromJSON(needs.validateActor.outputs.IS_DEPLOYER) }} runs-on: ubuntu-latest steps: + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + fetch-depth: 0 + - uses: Expensify/App/.github/actions/composite/setupNode@main - uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7 @@ -100,6 +104,10 @@ jobs: if: ${{ fromJSON(needs.validateActor.outputs.IS_DEPLOYER) }} runs-on: macos-12 steps: + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + fetch-depth: 0 + - uses: Expensify/App/.github/actions/composite/setupNode@main - name: Decrypt Developer ID Certificate @@ -135,6 +143,10 @@ jobs: if: ${{ fromJSON(needs.validateActor.outputs.IS_DEPLOYER) }} runs-on: macos-12 steps: + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + fetch-depth: 0 + - uses: Expensify/App/.github/actions/composite/setupNode@main - uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7 @@ -219,6 +231,10 @@ jobs: if: ${{ fromJSON(needs.validateActor.outputs.IS_DEPLOYER) }} runs-on: ubuntu-latest steps: + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + fetch-depth: 0 + - uses: Expensify/App/.github/actions/composite/setupNode@main - name: Setup Cloudflare CLI @@ -340,6 +356,10 @@ jobs: if: ${{ always() }} needs: [android, desktop, iOS, web] steps: + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + fetch-depth: 0 + - uses: Expensify/App/.github/actions/composite/setupNode@main - name: Set version diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 90e6e06e75d2..8c303c580614 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,6 +39,10 @@ jobs: chunk: ${{fromJson(needs.config.outputs.MATRIX)}} steps: + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + fetch-depth: 0 + - uses: Expensify/App/.github/actions/composite/setupNode@main # If automatic signing is enabled, iOS builds will fail, so ensure we always have the proper profile specified diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index 6ded7e7bb7e4..6b7619312677 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -1,16 +1,35 @@ name: Build and deploy apps for testing on: - pull_request: + pull_request_target: + types: [opened, synchronize] env: DEVELOPER_DIR: /Applications/Xcode_14.0.1.app/Contents/Developer jobs: + validateActor: + runs-on: ubuntu-latest + outputs: + IS_TEAM_MEMBER: ${{ fromJSON(steps.isUserDeployer.outputs.isTeamMember) }} + 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_TEAM_MEMBER) }} runs-on: ubuntu-latest steps: + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} - uses: Expensify/App/.github/actions/composite/setupNode@main @@ -37,16 +56,24 @@ jobs: 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 + PULL_REQUEST_NAME: ${{ github.event.pull_request.title }} + + - uses: actions/upload-artifact@v3 with: name: android path: ./android_paths.json iOS: name: Build and deploy iOS + needs: validateActor + if: ${{ fromJSON(needs.validateActor.outputs.IS_TEAM_MEMBER) }} runs-on: macos-12 steps: + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} + - uses: Expensify/App/.github/actions/composite/setupNode@main - uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7 @@ -78,47 +105,55 @@ jobs: S3_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} S3_BUCKET: ad-hoc-expensify-cash S3_REGION: us-east-1 + PULL_REQUEST_NAME: ${{ github.event.pull_request.title }} - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: ios path: ./ios_paths.json - - web: - name: Build and deploy Web - runs-on: ubuntu-latest - steps: - - uses: Expensify/App/.github/actions/composite/setupNode@main - - - name: Configure AWS Credentials - # Version: 1.5.5 - uses: aws-actions/configure-aws-credentials@e97d7fbc8e0e5af69631c13daa0f4b5a8d88165b - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - name: Build web for staging - run: npm run build-staging - - - name: Build docs - run: npm run storybook-build - continue-on-error: true - - - name: Deploy to S3 for internal testing - run: aws s3 cp --recursive --acl public-read "$GITHUB_WORKSPACE"/dist s3://ad-hoc-expensify-cash/web/"$PULL_REQUEST_NAME" - env: - PULL_REQUEST_NAME: ${{ github.event.pull_request.title }} + # web: + # name: Build and deploy Web + # needs: validateActor + # if: ${{ fromJSON(needs.validateActor.outputs.IS_TEAM_MEMBER) }} + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + # with: + # fetch-depth: 0 + # ref: ${{ github.event.pull_request.head.sha }} + + # - uses: Expensify/App/.github/actions/composite/setupNode@main + + # - name: Configure AWS Credentials + # # Version: 1.5.5 + # uses: aws-actions/configure-aws-credentials@e97d7fbc8e0e5af69631c13daa0f4b5a8d88165b + # with: + # aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + # aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + # aws-region: us-east-1 + + # - name: Build web for staging + # run: npm run build-staging + + # - name: Build docs + # run: npm run storybook-build + # continue-on-error: true + + # - name: Deploy to S3 for internal testing + # run: aws s3 cp --recursive --acl public-read "$GITHUB_WORKSPACE"/dist s3://ad-hoc-expensify-cash/web/"$PULL_REQUEST_NAME" + # env: + # PULL_REQUEST_NAME: ${{ github.event.pull_request.title }} postGithubComment: runs-on: ubuntu-latest name: An example job to comment a PR - needs: [android, ios, web] + needs: [android, ios] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 - name: Read JSONs with paths id: set_var @@ -135,7 +170,9 @@ jobs: echo "::set-output name=ios_paths::$content_ios" - name: Comment PR - uses: thollander/actions-comment-pull-request@v1 + uses: thollander/actions-comment-pull-request@8732291afbb10a0a98adbb80269d2aa5a732182c with: message: | - 'Hello world ! ${{fromJson(steps.set_var.outputs.android_paths).html_path}} and ${{fromJson(steps.set_var.outputs.ios_paths).html_path}}'' \ No newline at end of file + | android :robot: | iOS :apple: | + | ------------- | ------------- | + | ${{fromJson(steps.set_var.outputs.android_paths).html_path}} | ${{fromJson(steps.set_var.outputs.ios_paths).html_path}} | diff --git a/.github/workflows/validateGithubActions.yml b/.github/workflows/validateGithubActions.yml index 4e51d785d6b0..051b20ed8e42 100644 --- a/.github/workflows/validateGithubActions.yml +++ b/.github/workflows/validateGithubActions.yml @@ -10,6 +10,10 @@ jobs: if: github.actor != 'OSBotify' runs-on: ubuntu-latest steps: + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + fetch-depth: 0 + - uses: Expensify/App/.github/actions/composite/setupNode@main # Rebuild all the actions on this branch and check for a diff. Fail if there is one, diff --git a/.github/workflows/verifyPodfile.yml b/.github/workflows/verifyPodfile.yml index 17d80ca7e055..c7db42cc8cb5 100644 --- a/.github/workflows/verifyPodfile.yml +++ b/.github/workflows/verifyPodfile.yml @@ -10,6 +10,10 @@ jobs: if: github.actor != 'OSBotify' runs-on: ubuntu-latest steps: + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + fetch-depth: 0 + - uses: Expensify/App/.github/actions/composite/setupNode@main - run: ./.github/scripts/verifyPodfile.sh diff --git a/fastlane/Fastfile b/fastlane/Fastfile index bd6e0c1a36ca..a2e0c757459b 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -42,7 +42,7 @@ platform :android do gradle( project_dir: './android', - task: 'bundle', + task: 'assemble', build_type: 'Release', ) @@ -53,7 +53,7 @@ platform :android do region: ENV['S3_REGION'], apk: lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH], - app_directory: 'android', + app_directory: "android/#{ENV['PULL_REQUEST_NAME']}", ) sh("echo '{\"apk_path\": \"#{lane_context[SharedValues::S3_APK_OUTPUT_PATH]}\",\"html_path\": \"#{lane_context[SharedValues::S3_HTML_OUTPUT_PATH]}\"}' > ../android_paths.json") @@ -155,7 +155,7 @@ platform :ios do region: ENV['S3_REGION'], ipa: lane_context[SharedValues::IPA_OUTPUT_PATH], - app_directory: 'ios', + app_directory: "android/#{ENV['PULL_REQUEST_NAME']}", ) sh("echo '{\"ipa_path\": \"#{lane_context[SharedValues::S3_IPA_OUTPUT_PATH]}\",\"html_path\": \"#{lane_context[SharedValues::S3_HTML_OUTPUT_PATH]}\"}' > ../ios_paths.json") From edce1fb28003ea1508c22382753ccffda92e7c18 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Thu, 24 Nov 2022 11:35:06 +0100 Subject: [PATCH 16/24] fix warnings from yml --- .github/workflows/testBuild.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index 6b7619312677..efff324243f2 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -158,16 +158,16 @@ jobs: - name: Read JSONs with paths id: set_var run: | - content_android=`cat ./android/android_paths.json` + content_android="$(cat ./android/android_paths.json)" content_android="${content_android//'%'/'%25'}" content_android="${content_android//$'\n'/'%0A'}" content_android="${content_android//$'\r'/'%0D'}" - echo "::set-output name=android_paths::$content_android" - content_ios=`cat ./ios/ios_paths.json` + echo "android_paths=$content_android" >> $GITHUB_OUTPUT + content_ios="$(cat ./ios/ios_paths.json)" content_ios="${content_ios//'%'/'%25'}" content_ios="${content_ios//$'\n'/'%0A'}" content_ios="${content_ios//$'\r'/'%0D'}" - echo "::set-output name=ios_paths::$content_ios" + echo "ios_paths=$content_ios" >> $GITHUB_OUTPUT - name: Comment PR uses: thollander/actions-comment-pull-request@8732291afbb10a0a98adbb80269d2aa5a732182c From 971df036c0f264d67e078b46f2c5f42afa2e7791 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Thu, 24 Nov 2022 13:03:50 +0100 Subject: [PATCH 17/24] fix shellcheck --- .github/workflows/testBuild.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index efff324243f2..0b539480b00e 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -162,12 +162,12 @@ jobs: content_android="${content_android//'%'/'%25'}" content_android="${content_android//$'\n'/'%0A'}" content_android="${content_android//$'\r'/'%0D'}" - echo "android_paths=$content_android" >> $GITHUB_OUTPUT + echo "android_paths=$content_android" >> "$GITHUB_OUTPUT" content_ios="$(cat ./ios/ios_paths.json)" content_ios="${content_ios//'%'/'%25'}" content_ios="${content_ios//$'\n'/'%0A'}" content_ios="${content_ios//$'\r'/'%0D'}" - echo "ios_paths=$content_ios" >> $GITHUB_OUTPUT + echo "ios_paths=$content_ios" >> "$GITHUB_OUTPUT" - name: Comment PR uses: thollander/actions-comment-pull-request@8732291afbb10a0a98adbb80269d2aa5a732182c From ab86c42722a5587f58a2e9abc32ae99e7e59fb53 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Thu, 24 Nov 2022 18:03:12 +0100 Subject: [PATCH 18/24] add comment to checkout action --- .github/workflows/e2ePerformanceRegressionTests.yml | 1 + .github/workflows/lint.yml | 1 + .github/workflows/platformDeploy.yml | 5 +++++ .github/workflows/test.yml | 1 + .github/workflows/testBuild.yml | 4 ++-- .github/workflows/validateGithubActions.yml | 1 + .github/workflows/verifyPodfile.yml | 1 + 7 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2ePerformanceRegressionTests.yml b/.github/workflows/e2ePerformanceRegressionTests.yml index 9ed2e9ed4e33..5584758663a8 100644 --- a/.github/workflows/e2ePerformanceRegressionTests.yml +++ b/.github/workflows/e2ePerformanceRegressionTests.yml @@ -11,6 +11,7 @@ jobs: # Although the tests will run on an android emulator, using macOS as its more performant runs-on: macos-12 steps: + # This action checks-out the repository, so the workflow can access it. - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 with: fetch-depth: 0 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f41c02352097..f0bcf63b6955 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,6 +11,7 @@ jobs: if: ${{ github.actor != 'OSBotify' || github.event_name == 'workflow_call' }} runs-on: ubuntu-latest steps: + # This action checks-out the repository, so the workflow can access it. - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 with: fetch-depth: 0 diff --git a/.github/workflows/platformDeploy.yml b/.github/workflows/platformDeploy.yml index c1cc0d3485e9..5b61a294ca5b 100644 --- a/.github/workflows/platformDeploy.yml +++ b/.github/workflows/platformDeploy.yml @@ -31,6 +31,7 @@ jobs: if: ${{ fromJSON(needs.validateActor.outputs.IS_DEPLOYER) }} runs-on: ubuntu-latest steps: + # This action checks-out the repository, so the workflow can access it. - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 with: fetch-depth: 0 @@ -104,6 +105,7 @@ jobs: if: ${{ fromJSON(needs.validateActor.outputs.IS_DEPLOYER) }} runs-on: macos-12 steps: + # This action checks-out the repository, so the workflow can access it. - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 with: fetch-depth: 0 @@ -143,6 +145,7 @@ jobs: if: ${{ fromJSON(needs.validateActor.outputs.IS_DEPLOYER) }} runs-on: macos-12 steps: + # This action checks-out the repository, so the workflow can access it. - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 with: fetch-depth: 0 @@ -231,6 +234,7 @@ jobs: if: ${{ fromJSON(needs.validateActor.outputs.IS_DEPLOYER) }} runs-on: ubuntu-latest steps: + # This action checks-out the repository, so the workflow can access it. - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 with: fetch-depth: 0 @@ -356,6 +360,7 @@ jobs: if: ${{ always() }} needs: [android, desktop, iOS, web] steps: + # This action checks-out the repository, so the workflow can access it. - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 with: fetch-depth: 0 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8c303c580614..72dde5fe38cf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,6 +39,7 @@ jobs: chunk: ${{fromJson(needs.config.outputs.MATRIX)}} steps: + # This action checks-out the repository, so the workflow can access it. - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 with: fetch-depth: 0 diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index 0b539480b00e..255c7805e4a4 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -26,9 +26,9 @@ jobs: if: ${{ fromJSON(needs.validateActor.outputs.IS_TEAM_MEMBER) }} runs-on: ubuntu-latest steps: + # This action checks-out the repository, so the workflow can access it. - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 with: - fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha }} - uses: Expensify/App/.github/actions/composite/setupNode@main @@ -69,9 +69,9 @@ jobs: if: ${{ fromJSON(needs.validateActor.outputs.IS_TEAM_MEMBER) }} runs-on: macos-12 steps: + # This action checks-out the repository, so the workflow can access it. - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 with: - fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha }} - uses: Expensify/App/.github/actions/composite/setupNode@main diff --git a/.github/workflows/validateGithubActions.yml b/.github/workflows/validateGithubActions.yml index 051b20ed8e42..b583ba31f2bc 100644 --- a/.github/workflows/validateGithubActions.yml +++ b/.github/workflows/validateGithubActions.yml @@ -10,6 +10,7 @@ jobs: if: github.actor != 'OSBotify' runs-on: ubuntu-latest steps: + # This action checks-out the repository, so the workflow can access it. - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 with: fetch-depth: 0 diff --git a/.github/workflows/verifyPodfile.yml b/.github/workflows/verifyPodfile.yml index c7db42cc8cb5..84f52d09997a 100644 --- a/.github/workflows/verifyPodfile.yml +++ b/.github/workflows/verifyPodfile.yml @@ -10,6 +10,7 @@ jobs: if: github.actor != 'OSBotify' runs-on: ubuntu-latest steps: + # This action checks-out the repository, so the workflow can access it. - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 with: fetch-depth: 0 From 9286aa47a5eeb4b76043226b9e80f1bb7c911d4f Mon Sep 17 00:00:00 2001 From: staszekscp Date: Thu, 24 Nov 2022 18:37:15 +0100 Subject: [PATCH 19/24] change thollander/actions-comment to github CLI --- .../workflows/e2ePerformanceRegressionTests.yml | 2 +- .github/workflows/testBuild.yml | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/e2ePerformanceRegressionTests.yml b/.github/workflows/e2ePerformanceRegressionTests.yml index 5584758663a8..c3fe4753b115 100644 --- a/.github/workflows/e2ePerformanceRegressionTests.yml +++ b/.github/workflows/e2ePerformanceRegressionTests.yml @@ -7,7 +7,7 @@ on: jobs: e2e-tests: if: ${{ github.event.label.name == 'e2e' }} - name: 'Run e2e performance regression tests' + name: Run e2e performance regression tests # Although the tests will run on an android emulator, using macOS as its more performant runs-on: macos-12 steps: diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index 255c7805e4a4..ee40e5162677 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -169,10 +169,11 @@ jobs: content_ios="${content_ios//$'\r'/'%0D'}" echo "ios_paths=$content_ios" >> "$GITHUB_OUTPUT" - - name: Comment PR - uses: thollander/actions-comment-pull-request@8732291afbb10a0a98adbb80269d2aa5a732182c - with: - message: | - | android :robot: | iOS :apple: | - | ------------- | ------------- | - | ${{fromJson(steps.set_var.outputs.android_paths).html_path}} | ${{fromJson(steps.set_var.outputs.ios_paths).html_path}} | + - name: Publish links to apps for download + run: | + gh pr comment --body \ + "| android :robot: | iOS :apple: | + | ------------- | ------------- | + | ${{fromJson(steps.set_var.outputs.android_paths).html_path}} | ${{fromJson(steps.set_var.outputs.ios_paths).html_path}} |" + env: + GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }} From 4052da6ca4d545e52c0ee2fe1d2c8bd60da70523 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Thu, 24 Nov 2022 18:45:29 +0100 Subject: [PATCH 20/24] fix indentation --- .github/workflows/e2ePerformanceRegressionTests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2ePerformanceRegressionTests.yml b/.github/workflows/e2ePerformanceRegressionTests.yml index c3fe4753b115..ad6425d4ec90 100644 --- a/.github/workflows/e2ePerformanceRegressionTests.yml +++ b/.github/workflows/e2ePerformanceRegressionTests.yml @@ -48,7 +48,7 @@ jobs: disable-animations: false script: echo "Generated AVD snapshot for caching." - # Note: if the android build fails the logs can be incomplete. It can help to run the build once manually to get a full log + # Note: if the android build fails the logs can be incomplete. It can help to run the build once manually to get a full log - name: Preheat build system env: JAVA_HOME: ${{ env.JAVA_HOME_11_X64 }} From fad0297758ca90e151de16d90d725b697ef87f64 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Fri, 25 Nov 2022 10:15:45 +0100 Subject: [PATCH 21/24] switch from pull_request_target to workflow_dispatch --- .github/workflows/testBuild.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index ee40e5162677..e2d98c61680f 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -1,8 +1,9 @@ name: Build and deploy apps for testing on: - pull_request_target: - types: [opened, synchronize] + workflow_dispatch: + # pull_request_target: + # types: [opened, synchronize] env: DEVELOPER_DIR: /Applications/Xcode_14.0.1.app/Contents/Developer @@ -10,6 +11,8 @@ env: jobs: validateActor: runs-on: ubuntu-latest + permissions: + pull_request: write outputs: IS_TEAM_MEMBER: ${{ fromJSON(steps.isUserDeployer.outputs.isTeamMember) }} steps: @@ -25,6 +28,8 @@ jobs: needs: validateActor if: ${{ fromJSON(needs.validateActor.outputs.IS_TEAM_MEMBER) }} runs-on: ubuntu-latest + permissions: + pull_request: write steps: # This action checks-out the repository, so the workflow can access it. - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 @@ -68,6 +73,8 @@ jobs: needs: validateActor if: ${{ fromJSON(needs.validateActor.outputs.IS_TEAM_MEMBER) }} runs-on: macos-12 + permissions: + pull_request: write steps: # This action checks-out the repository, so the workflow can access it. - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 @@ -149,9 +156,13 @@ jobs: runs-on: ubuntu-latest name: An example job to comment a PR needs: [android, ios] + permissions: + pull_request: write steps: - name: Checkout uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + ref: ${{ github.event.pull_request.head.ref }} - uses: actions/download-artifact@v3 From f17e7a97aed82053304cca94ff3af44e20122e2f Mon Sep 17 00:00:00 2001 From: staszekscp Date: Fri, 25 Nov 2022 11:10:19 +0100 Subject: [PATCH 22/24] add pull_request_target --- .github/workflows/testBuild.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index e2d98c61680f..85bc4300f146 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -2,8 +2,8 @@ name: Build and deploy apps for testing on: workflow_dispatch: - # pull_request_target: - # types: [opened, synchronize] + pull_request_target: + types: [opened, synchronize] env: DEVELOPER_DIR: /Applications/Xcode_14.0.1.app/Contents/Developer @@ -11,8 +11,6 @@ env: jobs: validateActor: runs-on: ubuntu-latest - permissions: - pull_request: write outputs: IS_TEAM_MEMBER: ${{ fromJSON(steps.isUserDeployer.outputs.isTeamMember) }} steps: @@ -28,8 +26,6 @@ jobs: needs: validateActor if: ${{ fromJSON(needs.validateActor.outputs.IS_TEAM_MEMBER) }} runs-on: ubuntu-latest - permissions: - pull_request: write steps: # This action checks-out the repository, so the workflow can access it. - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 @@ -73,8 +69,6 @@ jobs: needs: validateActor if: ${{ fromJSON(needs.validateActor.outputs.IS_TEAM_MEMBER) }} runs-on: macos-12 - permissions: - pull_request: write steps: # This action checks-out the repository, so the workflow can access it. - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 @@ -156,8 +150,6 @@ jobs: runs-on: ubuntu-latest name: An example job to comment a PR needs: [android, ios] - permissions: - pull_request: write steps: - name: Checkout uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 From d15b3f2cce39e4e31c4c827dc3ddad0aeec6e63f Mon Sep 17 00:00:00 2001 From: staszekscp Date: Fri, 25 Nov 2022 15:30:15 +0100 Subject: [PATCH 23/24] change pr name to number --- .github/workflows/testBuild.yml | 8 ++++---- fastlane/Fastfile | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index 85bc4300f146..ea25f937d1da 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -57,7 +57,7 @@ jobs: S3_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} S3_BUCKET: ad-hoc-expensify-cash S3_REGION: us-east-1 - PULL_REQUEST_NAME: ${{ github.event.pull_request.title }} + PULL_REQUEST_NUMBER: ${{ github.event.number }} - uses: actions/upload-artifact@v3 with: @@ -106,7 +106,7 @@ jobs: S3_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} S3_BUCKET: ad-hoc-expensify-cash S3_REGION: us-east-1 - PULL_REQUEST_NAME: ${{ github.event.pull_request.title }} + PULL_REQUEST_NUMBER: ${{ github.event.number }} - uses: actions/upload-artifact@v3 with: @@ -142,9 +142,9 @@ jobs: # continue-on-error: true # - name: Deploy to S3 for internal testing - # run: aws s3 cp --recursive --acl public-read "$GITHUB_WORKSPACE"/dist s3://ad-hoc-expensify-cash/web/"$PULL_REQUEST_NAME" + # run: aws s3 cp --recursive --acl public-read "$GITHUB_WORKSPACE"/dist s3://ad-hoc-expensify-cash/web/"$PULL_REQUEST_NUMBER" # env: - # PULL_REQUEST_NAME: ${{ github.event.pull_request.title }} + # PULL_REQUEST_NUMBER: ${{ github.event.number }} postGithubComment: runs-on: ubuntu-latest diff --git a/fastlane/Fastfile b/fastlane/Fastfile index a2e0c757459b..4188e62db7be 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -53,7 +53,7 @@ platform :android do region: ENV['S3_REGION'], apk: lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH], - app_directory: "android/#{ENV['PULL_REQUEST_NAME']}", + app_directory: "android/#{ENV['PULL_REQUEST_NUMBER']}", ) sh("echo '{\"apk_path\": \"#{lane_context[SharedValues::S3_APK_OUTPUT_PATH]}\",\"html_path\": \"#{lane_context[SharedValues::S3_HTML_OUTPUT_PATH]}\"}' > ../android_paths.json") @@ -155,7 +155,7 @@ platform :ios do region: ENV['S3_REGION'], ipa: lane_context[SharedValues::IPA_OUTPUT_PATH], - app_directory: "android/#{ENV['PULL_REQUEST_NAME']}", + app_directory: "android/#{ENV['PULL_REQUEST_NUMBER']}", ) sh("echo '{\"ipa_path\": \"#{lane_context[SharedValues::S3_IPA_OUTPUT_PATH]}\",\"html_path\": \"#{lane_context[SharedValues::S3_HTML_OUTPUT_PATH]}\"}' > ../ios_paths.json") From 8d9d1a2ded4b8bec48f2814143bfc5771b9be3b6 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Fri, 25 Nov 2022 19:10:27 +0100 Subject: [PATCH 24/24] fix minor issues --- .github/workflows/testBuild.yml | 5 +++-- Gemfile | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index ea25f937d1da..79503b8f4b09 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -148,7 +148,7 @@ jobs: postGithubComment: runs-on: ubuntu-latest - name: An example job to comment a PR + name: Post a GitHub comment with app download links for testing needs: [android, ios] steps: - name: Checkout @@ -175,7 +175,8 @@ jobs: - name: Publish links to apps for download run: | gh pr comment --body \ - "| android :robot: | iOS :apple: | + "Use the links below to test this build in android and iOS. Happy testing! + | android :robot: | iOS :apple: | | ------------- | ------------- | | ${{fromJson(steps.set_var.outputs.android_paths).html_path}} | ${{fromJson(steps.set_var.outputs.ios_paths).html_path}} |" env: diff --git a/Gemfile b/Gemfile index 86cf34940e86..d8b9c135680d 100644 --- a/Gemfile +++ b/Gemfile @@ -6,4 +6,4 @@ gem "xcpretty", "~> 0" plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') -eval_gemfile(plugins_path) if File.exist?(plugins_path) \ No newline at end of file +eval_gemfile(plugins_path) if File.exist?(plugins_path)