126 lines
3.6 KiB
YAML
126 lines
3.6 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
# branches:
|
|
# - master
|
|
# pull_request:
|
|
# branches:
|
|
# - master
|
|
# release:
|
|
# types:
|
|
# - created
|
|
|
|
env:
|
|
flutter_version: "1.17.5"
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: [ubuntu-latest]
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Cache Flutter dependencies
|
|
id: cache
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: /opt/hostedtoolcache/flutter
|
|
key: ${{ runner.OS }}-flutter-cache-${{ env.flutter_version }}
|
|
- name: Flutter action
|
|
uses: subosito/flutter-action@v1.3.2
|
|
with:
|
|
flutter-version: ${{ env.flutter_version }}
|
|
- name: Get dependencies
|
|
run: flutter pub get
|
|
- name: Coverage fix
|
|
run: |
|
|
file=test/coverage_helper_test.dart
|
|
echo "// Helper file to make coverage work for all dart files\n" > $file
|
|
echo "// ignore_for_file: unused_import" >> $file
|
|
find lib -name '*.dart' | grep -e '[^g]\.dart' | grep -v '_html.dart' | cut -c4- | awk -v package=stream_chat_flutter '{printf "import '\''package:%s%s'\'';\n", package, $1}' >> $file
|
|
echo "" >> $file
|
|
echo "void main(){}" >> $file
|
|
cat $file
|
|
- name: Run tests
|
|
run: flutter test --coverage
|
|
- name: Codecov
|
|
run: bash <(curl -s https://codecov.io/bash) -c -t ${{ secrets.CODECOV_TOKEN }} -f coverage/lcov.info -F flutter_tool
|
|
build_ios:
|
|
name: Build iOS
|
|
runs-on: macOS-latest
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- uses: actions/setup-java@v1
|
|
with:
|
|
java-version: '12.x'
|
|
- uses: subosito/flutter-action@v1.3.2
|
|
with:
|
|
flutter-version: ${{ env.flutter_version }}
|
|
- run: |
|
|
cd example
|
|
flutter pub get
|
|
flutter clean
|
|
flutter build ios --release --no-codesign
|
|
- name: Upload iPA
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: ios-build
|
|
path: example/build/ios/iphoneos
|
|
|
|
deploy_ios:
|
|
name: Upload iOS to Firebase App Distribution
|
|
needs: [build_ios]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- name: set up JDK 1.8
|
|
uses: actions/setup-java@v1
|
|
with:
|
|
java-version: 1.8
|
|
- name: Download Artifact
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: ios-build
|
|
- run: |
|
|
ls -l /home/runner/work/stream-chat-flutter/stream-chat-flutter
|
|
ls -l .
|
|
- name: Upload IPA
|
|
uses: wzieba/Firebase-Distribution-Github-Action@v1.2.1
|
|
with:
|
|
appId: "1:674907137625:ios:cafb9fb076a453c4d7f348"
|
|
token: ${{secrets.FIREBASE_TOKEN}}
|
|
groups: ios-stream-testers
|
|
file: Runner.ipa
|
|
debug: true
|
|
build_and_deploy_android:
|
|
name: Build and deploy android
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/checkout@v1
|
|
- uses: actions/setup-java@v1
|
|
with:
|
|
java-version: '12.x'
|
|
- uses: subosito/flutter-action@v1.3.2
|
|
with:
|
|
flutter-version: ${{ env.flutter_version }}
|
|
- run: |
|
|
cd example
|
|
flutter pub get
|
|
- name: Build
|
|
run: |
|
|
cd example
|
|
flutter build apk
|
|
- name: Upload
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: apk-build
|
|
path: example/build/app/outputs/bundle/release
|
|
- name: Deploy
|
|
#if: github.base_ref == 'master'
|
|
uses: wzieba/Firebase-Distribution-Github-Action@v1.2.1
|
|
with:
|
|
appId: ${{secrets.FIREBASE_ANDROID_APPID}}
|
|
token: ${{secrets.FIREBASE_TOKEN}}
|
|
groups: stream-testers
|
|
file: example/build/app/outputs/apk/release/app-release.apk
|