Psg 4891 Use repo templates in passage-flutter #39
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: Integration Tests | |
on: | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
web-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.22.1' | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Install dependencies | |
run: | | |
cd proxy-server | |
npm install | |
cd ../.. | |
flutter pub get | |
working-directory: ./integrationtestapp | |
- name: Set up Google Chrome and ChromeDriver | |
uses: browser-actions/setup-chrome@v1 | |
with: | |
chrome-version: 129 | |
install-chromedriver: true | |
install-dependencies: true | |
- name: Start Xvfb | |
run: | | |
sudo apt-get install -y xvfb | |
export DISPLAY=:99 | |
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & | |
- name: Start ChromeDriver | |
run: | | |
nohup chromedriver --port=4444 & | |
sleep 5 | |
- name: Start Proxy Server | |
run: | | |
nohup node integrationtestapp/proxy-server/proxy_server.js & | |
sleep 5 | |
env: | |
MAILOSAUR_API_KEY: ${{ secrets.MAILOSAUR_API_KEY }} | |
- name: Run Web tests with XVFB | |
run: | | |
for test in integration_test/*.dart; do | |
xvfb-run --auto-servernum --server-args="-screen 0 1280x1024x24" flutter drive --driver=test_driver/integration_test.dart --target=$test -d chrome --web-port=4200 --dart-define=MAILOSAUR_API_KEY=${{ secrets.MAILOSAUR_API_KEY }} | |
done | |
working-directory: ./integrationtestapp | |
env: | |
MAILOSAUR_API_KEY: ${{ secrets.MAILOSAUR_API_KEY }} | |
android-tests: | |
runs-on: ubuntu-latest | |
needs: web-tests | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.22.1' | |
- name: Enable KVM | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- name: Install dependencies | |
run: flutter pub get | |
working-directory: ./integrationtestapp | |
- name: Set environment variables | |
env: | |
MAILOSAUR_API_KEY: ${{ secrets.MAILOSAUR_API_KEY }} | |
run: | | |
echo "export MAILOSAUR_API_KEY=${{ secrets.MAILOSAUR_API_KEY }}" >> $GITHUB_ENV | |
- name: Start emulator and run tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 34 | |
target: google_apis | |
build-tools: 34.0.0 | |
arch: x86_64 | |
profile: Nexus 6 | |
working-directory: ./integrationtestapp | |
script: flutter test integration_test/*.dart -d emulator-5554 --dart-define=MAILOSAUR_API_KEY=${{ secrets.MAILOSAUR_API_KEY }} | |
ios-tests: | |
runs-on: macos-latest | |
needs: android-tests | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Xcode 15.4 | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: '15.4' | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.22.1' | |
- name: Install dependencies | |
run: flutter pub get | |
working-directory: ./integrationtestapp | |
- name: Install CocoaPods | |
run: pod install --project-directory=ios | |
working-directory: ./integrationtestapp | |
- name: Install simulator | |
id: install-simulator | |
uses: futureware-tech/simulator-action@v3 | |
with: | |
model: 'iPhone 14' | |
- name: Run iOS tests | |
run: flutter test integration_test/*.dart -d ${{ steps.install-simulator.outputs.udid }} --dart-define=MAILOSAUR_API_KEY=${{ secrets.MAILOSAUR_API_KEY }} | |
working-directory: ./integrationtestapp | |
env: | |
MAILOSAUR_API_KEY: ${{ secrets.MAILOSAUR_API_KEY }} |