Created
February 6, 2025 18:55
-
-
Save ThatSaxyDev/fd6ae74b589e29fa6e9646bc93c307bf to your computer and use it in GitHub Desktop.
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: patrol_test_staging | |
on: | |
push: | |
branches: | |
- patrol_implementation | |
pull_request: | |
branches: | |
- main | |
jobs: | |
patrol_test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
token: <toekn> | |
- name: Set Up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'temurin' # Specify the distribution | |
java-version: '17' | |
- name: Install Android SDK | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y wget unzip | |
wget https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip -O android-sdk.zip | |
unzip android-sdk.zip -d android-sdk | |
mkdir -p $ANDROID_HOME/cmdline-tools | |
mv android-sdk/cmdline-tools $ANDROID_HOME/cmdline-tools/latest | |
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses || true | |
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --update | |
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install 'build-tools;35.0.0' platform-tools 'platforms;android-31' | |
- name: Set Up Flutter (Stable Channel) | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
- name: Install Patrol CLI | |
run: dart pub global activate patrol_cli | |
- name: Configure Git Credentials | |
run: | | |
git config --global credential.helper store | |
echo "<gitlink>" > ~/.git-credentials | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "actions@github.com" | |
- name: Get Flutter Dependencies | |
run: flutter pub get | |
- name: Install Emulator Dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libpulse0 libgl1-mesa-dev | |
- name: Start Android Emulator | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 31 | |
target: google_apis | |
arch: x86_64 | |
disable-animations: true | |
emulator-options: "-no-window -gpu swiftshader_indirect -accel off" | |
script: | | |
echo "Waiting for emulator to start..." | |
adb wait-for-device | |
adb shell getprop sys.boot_completed | |
echo "Emulator started" | |
emulator-boot-timeout: 600 | |
- name: Restart ADB | |
run: | | |
adb kill-server | |
adb start-server | |
adb devices | |
sleep 10 | |
- name: Ensure Emulator Booted | |
run: | | |
BOOT_COMPLETED=$(adb shell getprop sys.boot_completed 2>&1 | tr -d '\r') | |
if [ "$BOOT_COMPLETED" = "1" ]; then | |
echo "Emulator boot completed." | |
else | |
echo "Emulator failed to boot." >&2 | |
exit 1 | |
- name: Run Patrol Tests | |
run: patrol test --verbose -t integration_test/send_to_bank_test.dart | |
# Merge to Main Branch Upon Success | |
#- name: Merge to Main | |
# if: github.ref == 'refs/heads/staging' | |
# run: | | |
# git checkout main | |
# git merge staging --no-ff -m "Merge staging into main" | |
# git push origin main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment