Added macos support. #564
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: BrowserStack CI | |
on: | |
push: | |
branches: [ ios-migrate ] | |
pull_request: | |
branches: [ ios-migrate ] | |
env: | |
GOPRIVATE: github.com/getlantern | |
jobs: | |
build: | |
runs-on: | |
group: large-runners | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Pull LFS objects | |
run: git lfs pull | |
# Install Flutter | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.10.5" | |
channel: "stable" | |
- run: flutter --version | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.19 | |
- name: Granting private modules access | |
run: | | |
git config --global url."https://${{ secrets.CI_PRIVATE_REPOS_GH_TOKEN }}:[email protected]/".insteadOf "https://github.com/" | |
- name: Setup Sentry CLI | |
uses: mathieu-bour/setup-sentry-cli@v1 | |
with: | |
version: latest | |
token: ${{ SECRETS.SENTRY_TOKEN }} # from GitHub secrets | |
organization: getlantern | |
project: android | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 17 | |
- name: Setup protoc | |
uses: arduino/setup-protoc@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Clear Go Modules cache | |
run: go clean -modcache | |
- name: Install protoc-gen-go | |
run: | | |
go get google.golang.org/protobuf/cmd/protoc-gen-go | |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
- name: Activate protoc-gen-dart plugin | |
run: | | |
echo "${HOME}/.pub-cache/bin" >> $GITHUB_PATH | |
dart pub global activate protoc_plugin | |
mkdir -p "${HOME}/.pub-cache/bin" | |
mv "${FLUTTER_ROOT}/.pub-cache/bin/protoc-gen-dart" "${HOME}/.pub-cache/bin" | |
- name: Build Android-Lib | |
run: make android-lib ANDROID_ARCH=all | |
- name: Build APK | |
run: | | |
flutter pub get | |
make appium-test-build | |
- name: Build IOS-Framework | |
run: make build-framework | |
- name: Build IPA | |
run: | | |
flutter pub get | |
make appium-ios-ipa | |
- name: List files in current directory | |
run: ls -la | |
- name: Install jq | |
run: sudo apt-get install jq | |
- name: Upload to BrowserStack | |
env: | |
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | |
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | |
BROWSERSTACK_APP_PATH: "build/app/outputs/flutter-apk/app-appiumtest-debug.apk" | |
BROWSERSTACK_IOS_APP_PATH: "build/ios/ipa/Lantern.ipa" | |
run: | | |
response=$(curl -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY" \ | |
-X POST "https://api-cloud.browserstack.com/app-automate/upload" \ | |
-F "file=@$BROWSERSTACK_APP_PATH" \ | |
-F "custom_id=LanternApp") | |
app_url=$(echo $response | jq -r .app_url) | |
echo "$app_url" | |
echo "BROWSERSTACK_APP_ID=$app_url" >> $GITHUB_ENV | |
# Upload iOS app | |
response_ios=$(curl -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY" \ | |
-X POST "https://api-cloud.browserstack.com/app-automate/upload" \ | |
-F "file=@$BROWSERSTACK_IOS_APP_PATH" \ | |
-F "ios_keychain_support=true" \ | |
-F "custom_id=LanternAppIOS") # Custom ID for the iOS app | |
app_url_ios=$(echo $response_ios | jq -r .app_url) | |
echo "iOS app URL: $app_url_ios" | |
echo "BROWSERSTACK_APP_ID_IOS=$app_url_ios" >> $GITHUB_ENV | |
- name: Run Tests | |
env: | |
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | |
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | |
RUN_ENV: "live" | |
run: | | |
cd appium_kotlin | |
./gradlew test |