Skip to content

Commit

Permalink
ci: upload recordings to gcs (#3153)
Browse files Browse the repository at this point in the history
* ci: upload recordings to gcs

* test
  • Loading branch information
sandipndev authored Apr 6, 2024
1 parent 0c90d68 commit 0bda993
Showing 1 changed file with 70 additions and 4 deletions.
74 changes: 70 additions & 4 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ jobs:
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
retry_wait_seconds: 30
max_attempts: 3
max_attempts: 10
retry_wait_seconds: 45
command: nix develop -c sh -c 'cd dev && tilt ci'
- name: Tilt Server
run: |
Expand Down Expand Up @@ -88,6 +88,39 @@ jobs:
name: android-recordings
path: android-recordings

# Upload recordings to GCS bucket
- uses: "google-github-actions/auth@v2"
if: always()
with:
credentials_json: "${{ secrets.BUILD_ARTIFACTS_BUCKET_KEY }}"
- uses: "google-github-actions/upload-cloud-storage@v2"
if: always()
with:
path: android-recordings
predefinedAcl: publicRead
glob: "**/*.mp4"
headers: |-
content-type: video/mp4
destination: galoy-mobile-recordings/android-recordings/${{ github.run_id }}
- name: Append Direct Links to GitHub Actions Summary
run: |
# Define the base URL for the uploaded files in the GCS bucket
BASE_URL="https://storage.googleapis.com/galoy-mobile-recordings/android-recordings/${{ github.run_id }}/android-recordings"
echo "## Android Recordings" >> $GITHUB_STEP_SUMMARY
find android-recordings -type f -name "*.mp4" | while read file; do
# Extract the relative path of the file within the android-recordings folder
RELATIVE_PATH="${file#android-recordings/}"
# Construct the direct URL for the file
FILE_URL="${BASE_URL}/${RELATIVE_PATH}"
TEST_NAME=$(echo "$RELATIVE_PATH" | sed -E 's|.*/(.*)/test\.mp4|\1|')
# Append the URL to the GitHub Actions summary
echo "- $TEST_NAME [Recording](<$FILE_URL>)" >> $GITHUB_STEP_SUMMARY
done
# Cleanup
- name: Terminate Metro
if: always()
Expand Down Expand Up @@ -145,8 +178,8 @@ jobs:
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
retry_wait_seconds: 30
max_attempts: 3
max_attempts: 10
retry_wait_seconds: 45
command: nix develop -c sh -c 'cd dev && tilt ci'
- name: Tilt Server
run: |
Expand Down Expand Up @@ -177,6 +210,39 @@ jobs:
name: ios-recordings
path: ios-recordings

# Upload recordings to GCS bucket
- uses: "google-github-actions/auth@v2"
if: always()
with:
credentials_json: "${{ secrets.BUILD_ARTIFACTS_BUCKET_KEY }}"
- uses: "google-github-actions/upload-cloud-storage@v2"
if: always()
with:
path: ios-recordings
predefinedAcl: publicRead
glob: "**/*.mp4"
headers: |-
content-type: video/mp4
destination: galoy-mobile-recordings/ios-recordings/${{ github.run_id }}
- name: Append Direct Links to GitHub Actions Summary
run: |
# Define the base URL for the uploaded files in the GCS bucket
BASE_URL="https://storage.googleapis.com/galoy-mobile-recordings/ios-recordings/${{ github.run_id }}/ios-recordings"
echo "## iOS Recordings" >> $GITHUB_STEP_SUMMARY
find ios-recordings -type f -name "*.mp4" | while read file; do
# Extract the relative path of the file within the ios-recordings folder
RELATIVE_PATH="${file#ios-recordings/}"
# Construct the direct URL for the file
FILE_URL="${BASE_URL}/${RELATIVE_PATH}"
TEST_NAME=$(echo "$RELATIVE_PATH" | sed -E 's|.*/(.*)/test\.mp4|\1|')
# Append the URL to the GitHub Actions summary
echo "- $TEST_NAME [Recording](<$FILE_URL>)" >> $GITHUB_STEP_SUMMARY
done
# Cleanup
- name: Cleanup
if: always()
Expand Down

0 comments on commit 0bda993

Please sign in to comment.