PE-6873: setup integration tests flutter #5923
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: 'PR build and deploy' | |
on: | |
pull_request: | |
branches-ignore: | |
- gh-pages | |
- master | |
env: | |
BUILD_NUMBER: ${{ github.run_number }} | |
GIT_SHA: ${{ github.sha }} | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
PR_TITLE: ${{ github.event.pull_request.title }} | |
RELEASE_NOTES: ${{ github.event.pull_request.title }} - ${{ github.sha }} | |
jobs: | |
pre-build: | |
uses: ./.github/workflows/test.yml | |
integration-tests: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout code | |
- uses: actions/checkout@v3 | |
# Install Flutter | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.7.10' # Specify your Flutter version | |
# Set up Chromedriver and Chrome | |
- uses: nanasess/setup-chromedriver@v2 | |
# Start Xvfb and Chromedriver | |
- name: Start Xvfb and Chromedriver | |
run: | | |
export DISPLAY=:99 | |
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & | |
chromedriver --port=4444 & | |
sleep 5 # Wait for Chromedriver to start | |
# Get Flutter dependencies | |
- name: Get Flutter dependencies | |
run: flutter pub get | |
# Run Flutter integration tests | |
- name: Run Flutter Integration Tests | |
run: | | |
flutter drive \ | |
--driver=test_driver/integration_test.dart \ | |
--target=integration_test/app_test.dart \ | |
-d chrome --dart-define=integration-test=true | |
build-web: | |
needs: pre-build | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout | |
- uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
# Set Flutter version from fvm | |
- uses: kuhnroyal/flutter-fvm-config-action@v1 | |
# Install Flutter | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: ${{ env.FLUTTER_CHANNEL }} | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
- name: Install script_runner | |
run: flutter pub global activate script_runner | |
- name: Build app | |
run: | | |
scr setup | |
flutter config --enable-web | |
flutter build web --dart-define=environment=development --release --pwa-strategy=none --no-web-resources-cdn --dart2js-optimization=O1 | |
# JS files cache invalidation | |
- name: main.dart.js and service worker cache invalidation | |
run: | | |
sed -i 's/main.dart.js/main.dart.js?version='"$GITHUB_SHA"'/' build/web/index.html | |
sed -i 's/flutter_service_worker.js/flutter_service_worker.js?version='"$GITHUB_SHA"'/' build/web/index.html | |
# Disribute to Firebase | |
- uses: FirebaseExtended/action-hosting-deploy@v0 | |
with: | |
repoToken: '${{ secrets.GITHUB_TOKEN }}' | |
firebaseServiceAccount: '${{ secrets.FIREBASE_CI_SERVICE_ACCOUNT }}' | |
expires: 7d | |
build-ios: | |
# skipped for now | |
if: false | |
needs: pre-build | |
runs-on: macos-latest | |
steps: | |
# Checkout | |
- uses: actions/checkout@v3 | |
# Install Ruby | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.1' | |
# Set Flutter version from fvm | |
- uses: kuhnroyal/flutter-fvm-config-action@v1 | |
# Install Flutter | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: ${{ env.FLUTTER_CHANNEL }} | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
- name: Set FIREBASE_JSON env var | |
run: echo "FIREBASE_JSON=$RUNNER_TEMP/firebase.json" >> $GITHUB_ENV | |
- name: Save Firebase Service Account json | |
env: | |
FIREBASE_SERVICE_ACCOUNT_JSON: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }} | |
run: echo -n "$FIREBASE_SERVICE_ACCOUNT_JSON" >> $FIREBASE_JSON | |
- name: Install fastlane and Cocoapods | |
working-directory: ./ios | |
run: bundle install | |
- name: Build iOS with fastlane | |
env: | |
MATCH_GIT_PRIVATE_KEY: ${{ secrets.FASTLANE_SSH_KEY }} | |
MATCH_PASSWORD: ${{ secrets.FASTLANE_MATCH_PASSWORD }} | |
working-directory: ./ios | |
run: bundle exec fastlane deploy type:branch | |
- name: Update PR description and Jira | |
env: | |
FL_JIRA_PASSWORD: ${{ secrets.FASTLANE_JIRA_API_KEY }} | |
FL_JIRA_SITE: ${{ secrets.FASTLANE_JIRA_SITE }} | |
FL_JIRA_USERNAME: ${{ secrets.FASTLANE_JIRA_USER }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
working-directory: ./ios | |
run: bundle exec fastlane update_release_url | |
build-android: | |
needs: pre-build | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout | |
- uses: actions/checkout@v3 | |
# Install Ruby | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.1' | |
# Install JDK | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
cache: 'gradle' | |
check-latest: true | |
# Set Flutter version from fvm | |
- uses: kuhnroyal/flutter-fvm-config-action@v1 | |
# Install Flutter | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: ${{ env.FLUTTER_CHANNEL }} | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
- name: Set FIREBASE_JSON env var | |
run: echo "FIREBASE_JSON=$RUNNER_TEMP/firebase.json" >> $GITHUB_ENV | |
- name: Save Firebase Service Account json | |
env: | |
FIREBASE_SERVICE_ACCOUNT_JSON: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }} | |
run: echo -n "$FIREBASE_SERVICE_ACCOUNT_JSON" >> $FIREBASE_JSON | |
- name: Set ANDROID_SIGNING_STORE_FILE env var | |
run: echo "ANDROID_SIGNING_STORE_FILE=$RUNNER_TEMP/keystore.jks" >> $GITHUB_ENV | |
- name: Save Android Keystore file | |
env: | |
ANDROID_SIGNING_STORE: ${{ secrets.ANDROID_SIGNING_STORE }} | |
run: echo -n "$ANDROID_SIGNING_STORE" | base64 --decode >> $ANDROID_SIGNING_STORE_FILE | |
- name: Install fastlane | |
working-directory: ./android | |
run: bundle install | |
- name: Build Android with fastlane | |
env: | |
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }} | |
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} | |
ANDROID_STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }} | |
working-directory: ./android | |
run: bundle exec fastlane deploy type:branch | |
- name: Update PR description and Jira | |
env: | |
FL_JIRA_PASSWORD: ${{ secrets.FASTLANE_JIRA_API_KEY }} | |
FL_JIRA_SITE: ${{ secrets.FASTLANE_JIRA_SITE }} | |
FL_JIRA_USERNAME: ${{ secrets.FASTLANE_JIRA_USER }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
working-directory: ./android | |
run: bundle exec fastlane update_release_url |