Skip to content

feat(repo): add nightly builds sample app #2124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 152 additions & 0 deletions .github/workflows/build_nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
name: build_nightly

on:
push:
branches:
- develop
workflow_dispatch:
inputs:
build_ios:
type: boolean
description: iOS
default: true
build_android:
type: boolean
description: Android
default: true
build_web:
type: boolean
description: Web
default: true

defaults:
run:
working-directory: sample_app

env:
FLUTTER_VERSION: "3.29.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we can use "3.x" here instead, It will automatically use the latest version in the 3.x range.

Suggested change
FLUTTER_VERSION: "3.29.0"
FLUTTER_VERSION: "3.x"

FLUTTER_CHANNEL: stable

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build_and_deploy_ios:
runs-on: macos-latest
timeout-minutes: 40
if: ${{ github.event_name == 'push' || inputs.build_ios == true }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove this push check now?

steps:
- name: Install Bot SSH Key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.BOT_SSH_PRIVATE_KEY }}

- name: Checkout code
uses: actions/checkout@v3

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: ${{ env.FLUTTER_CHANNEL }}
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also add the cache-key in order for the cache to work perfectly.
https://github.com/GetStream/stream-chat-flutter/blob/master/.github/workflows/stream_flutter_workflow.yml#L41


- name: Setup Ruby and Gems
uses: ruby/setup-ruby@v1
with:
working-directory: sample_app/ios
bundler-cache: true

- name: Install firebase-tools
run: npm install -g firebase-tools

- name: Copy google service account
run: |
echo "${{ secrets.SAMPLE_FIREBASE_UPLOAD_CREDENTIALS }}" | base64 --decode | jq > ${{ github.workspace }}/sample_app/ios/firebase-service-account.json

- name: Build and release
working-directory: sample_app/ios
env:
GOOGLE_APPLICATION_CREDENTIALS: "${{ github.workspace }}/sample_app/ios/firebase-service-account.json"
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
APPSTORE_API_KEY: ${{ secrets.APPSTORE_API_KEY }}
run: |
bundle exec fastlane deploy_to_firebase

build_and_deploy_android:
runs-on: ubuntu-latest
timeout-minutes: 15
if: ${{ github.event_name == 'push' || inputs.build_android == true }}
steps:
- name: Install Bot SSH Key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.BOT_SSH_PRIVATE_KEY }}

- name: Checkout code
uses: actions/checkout@v3

- name: Setup Java
uses: actions/setup-java@v1
with:
distribution: "zulu"
java-version: "17"

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: ${{ env.FLUTTER_CHANNEL }}
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true

- name: Build
run: flutter build apk

- name: Copy google service account
run: |
echo "${{ secrets.SAMPLE_FIREBASE_UPLOAD_CREDENTIALS }}" | base64 --decode | jq > ${{ github.workspace }}/sample_app/android/firebase-service-account.json

- name: Deploy
uses: wzieba/Firebase-Distribution-Github-Action@v1
with:
appId: ${{secrets.SAMPLE_FIREBASE_ANDROID_APPID}}
serviceCredentialsFile: "${{ github.workspace }}/sample_app/android/firebase-service-account.json"
groups: stream-testers
debug: true
file: "${{ github.workspace }}/sample_app/build/app/outputs/flutter-apk/app-release.apk"

- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: android-stream-chat-v1
path: "${{ github.workspace }}/sample_app/build/app/outputs/flutter-apk/app-release.apk"

build_and_deploy_web:
runs-on: ubuntu-latest
timeout-minutes: 10
if: ${{ github.event_name == 'push' || inputs.build_web == true }}
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: config git
run: |
git config --global user.email "$(git log --format='%ae' HEAD^!)"
git config --global user.name "$(git log --format='%an' HEAD^!)"
git fetch origin gh-pages:gh-pages

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: ${{ env.FLUTTER_CHANNEL }}
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true

- name: Build and Deploy
uses: bluefireteam/flutter-gh-pages@v9
with:
baseHref: /stream-chat-flutter/
workingDir: sample_app


1 change: 1 addition & 0 deletions .github/workflows/pr_title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
doc
repo
localization
samples
requireScope: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ GeneratedPluginRegistrant.*
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java
**/android/app/.cxx

# iOS/XCode related
**/ios/**/*.mode1v3
Expand Down Expand Up @@ -128,5 +129,6 @@ gradle-wrapper.jar
!/pubspec.lock
!**/example/web/sql-wasm.js
!**/example/web/sql-wasm.wasm
!/sample_app/android/app/google-services.json
!/sample_app/web/sql-wasm.js
!/sample_app/web/sql-wasm.wasm
31 changes: 31 additions & 0 deletions sample_app/Fastfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
opt_out_usage

# Have an easy way to get the root of the project
def root_path
Dir.pwd.sub(/.*\Kfastlane/, '').sub(/.*\Kandroid/, '').sub(/.*\Kios/, '').sub(/.*\K\/\//, '')
end

# Have an easy way to run flutter tasks on the root of the project
lane :sh_on_root do |options|
Dir.chdir(root_path) { sh(options[:command]) }
end

# Tasks to be reused on each platform flow
lane :fetch_dependencies do
sh_on_root(command: "flutter pub get --suppress-analytics")
end

# Tasks to be reused on each platform flow
lane :build_autogenerated_code do
sh_on_root(command: "flutter pub run build_runner build --delete-conflicting-outputs")
end

# Tasks to be reused on each platform flow
lane :lint do
sh_on_root(command: "flutter format --suppress-analytics --set-exit-if-changed -n lib/main.dart lib/src/ test/")
end

# Tasks to be reused on each platform flow
lane :test do |options|
sh_on_root(command: "flutter test --no-pub --coverage --suppress-analytics")
end
7 changes: 3 additions & 4 deletions sample_app/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (flutterVersionName == null) {
}

android {
namespace "com.example.example"
namespace "io.getstream.chat.android.flutter.sample"

compileSdkVersion 35

Expand All @@ -40,10 +40,9 @@ android {
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.example"
applicationId "io.getstream.chat.android.flutter.sample"
minSdkVersion 23
targetSdkVersion 34
targetSdkVersion 35
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
Expand Down
Loading
Loading