Skip to content

Commit

Permalink
Exercising entrypoint with more test targets (#8)
Browse files Browse the repository at this point in the history
* Exercising entrypoint with more test targets

* Running e2e without blocking
  • Loading branch information
ubiratansoares authored Sep 22, 2024
1 parent b992056 commit add3643
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 14 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ jobs:
env:
APPSWEEP_API_KEY: ${{ secrets.APPSWEEP_DOTANUKI_POCKETCASTS_IOS_KEY }}

- name: Test scanning iOS ipa plus dSyms
run: ./e2e/bitwarden-ios.sh
env:
APPSWEEP_API_KEY: ${{ secrets.APPSWEEP_DOTANUKI_BITWARDEN_IOS_KEY }}

- name: Test scanning Android apk plus mappings
run: ./e2e/cromite-android.sh
env:
APPSWEEP_API_KEY: ${{ secrets.APPSWEEP_DOTANUKI_CROMITE_ANDROID_KEY }}

component-tests:
needs: e2e
runs-on: ubuntu-22.04
Expand Down
27 changes: 27 additions & 0 deletions e2e/bitwarden-ios.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Copyright 2024 Dotanuki Labs
# SPDX-License-Identifier: MIT

set -euo pipefail

readonly repo="bitwarden/ios"
readonly version="v2024.9.1"

readonly ipa_asset="Bitwarden.iOS.2024.9.1.1092.ipa"
readonly ipa_download_url="https://github.com/$repo/releases/download/$version/$ipa_asset"
readonly ipa="bitwarden-ios.ipa"

readonly dsyms_asset="Bitwarden.iOS.2024.9.1.1092.dSYMs.zip"
readonly dsyms_download_url="https://github.com/$repo/releases/download/$version/$dsyms_asset"
readonly dsyms_zip="dsyms.zip"

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${script_dir%/*}"
actual_dir=$(pwd)

rm -rf "$actual_dir/.tmp" && mkdir "$actual_dir/.tmp"
curl -fsSL -o "$actual_dir/.tmp/$ipa" -C - "$ipa_download_url"
curl -fsSL -o "$actual_dir/.tmp/$dsyms_zip" -C - "$dsyms_download_url"
unzip -d "$actual_dir/.tmp/dsyms" "$actual_dir/.tmp/$dsyms_zip"

src/main.sh "$actual_dir/.tmp/$ipa" "$actual_dir/.tmp/dsyms"
26 changes: 26 additions & 0 deletions e2e/cromite-android.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Copyright 2024 Dotanuki Labs
# SPDX-License-Identifier: MIT

set -euo pipefail

readonly repo="uazo/cromite"
readonly version="v129.0.6668.59-bbcb812cffa4e2815760cd7fc3e34b00b4e39ea1"

readonly apk_asset="arm64_ChromePublic.apk"
readonly apk_download_url="https://github.com/$repo/releases/download/$version/$apk_asset"
readonly apk="cromite-android.apk"

readonly mappings_asset="arm64_ChromePublic.apk.mapping"
readonly mappings_download_url="https://github.com/$repo/releases/download/$version/$mappings_asset"
readonly mappings="mappings.txt"

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${script_dir%/*}"
actual_dir=$(pwd)

rm -rf "$actual_dir/.tmp" && mkdir "$actual_dir/.tmp"
curl -fsSL -o "$actual_dir/.tmp/$apk" -C - "$apk_download_url"
curl -fsSL -o "$actual_dir/.tmp/$mappings" -C - "$mappings_download_url"

src/main.sh "$actual_dir/.tmp/$apk" "$actual_dir/.tmp/$mappings"
20 changes: 6 additions & 14 deletions src/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,39 +43,31 @@ install_guardsquare_cli() {
}

execute_android_scan() {
local scan_id

if [[ -z "$extras" ]]; then
echo "Scanning standalone archive : $archive"
install_guardsquare_cli
scan_id=$("$guardsquare" scan "$archive" --commit-hash "$GITHUB_SHA" --format "{{.ID}}")
"$guardsquare" scan "$archive" --commit-hash "$GITHUB_SHA"
else
require_r8_or_proguard_mappings
echo "Scanning archive : $archive"
echo "R8/Proguard mappings : $extras"
install_guardsquare_cli
scan_id=$("$guardsquare" scan "$archive" --mapping-file "$extras" --commit-hash "$GITHUB_SHA" --format "{{.ID}}")
"$guardsquare" scan "$archive" --mapping-file "$extras" --commit-hash "$GITHUB_SHA"
fi

"$guardsquare" scan summary --wait-for static "$scan_id" --format json | jq
}

execute_ios_scan() {
local scan_id

if [[ -z "$extras" ]]; then
echo "Scanning standalone archive : $archive"
install_guardsquare_cli
scan_id=$("$guardsquare" scan "$archive" --commit-hash "$GITHUB_SHA" --format "{{.ID}}")
"$guardsquare" scan "$archive" --commit-hash "$GITHUB_SHA"
else
require_dsyms_folder
echo "Scanning archive : $archive"
echo "dsyms location : $extras"
echo "dsyms location : $extras"
install_guardsquare_cli
scan_id=$("$guardsquare" scan "$archive" --dsym "$extras" --commit-hash "$GITHUB_SHA" --format "{{.ID}}")
"$guardsquare" scan "$archive" --dsym "$extras" --commit-hash "$GITHUB_SHA"
fi

"$guardsquare" scan summary --wait-for static "$scan_id" --format json | jq
}

require_archive
Expand All @@ -93,7 +85,7 @@ case "$archive" in
echo "Supported archives :"
echo
echo "- Android : .aab, .apk"
echo "- iOS : .ipa, .xcarchive"
echo "- iOS : .ipa, .xcarchive"
echo
exit 1
;;
Expand Down

0 comments on commit add3643

Please sign in to comment.