[WIP] github workflow
This commit is contained in:
@@ -1,63 +0,0 @@
|
|||||||
name: Build
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
- feature/new-ui
|
|
||||||
release:
|
|
||||||
types:
|
|
||||||
- created
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build_and_deploy_ios:
|
|
||||||
runs-on: [macos-latest]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Install RubyGems
|
|
||||||
run: |
|
|
||||||
cd example/ios
|
|
||||||
bundle install
|
|
||||||
- uses: subosito/[email protected]
|
|
||||||
with:
|
|
||||||
channel: 'stable'
|
|
||||||
- name: Install firebase-tools
|
|
||||||
run: npm install -g firebase-tools
|
|
||||||
- name: Flutter setup
|
|
||||||
run: |
|
|
||||||
cd example
|
|
||||||
flutter pub get
|
|
||||||
- name: Build and release
|
|
||||||
env:
|
|
||||||
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
|
|
||||||
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
|
|
||||||
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
|
|
||||||
run: |
|
|
||||||
cd example
|
|
||||||
flutter build ios --release --no-codesign
|
|
||||||
cd ios
|
|
||||||
bundle exec fastlane deploy_to_firebase
|
|
||||||
build_and_deploy_android:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions/setup-java@v1
|
|
||||||
with:
|
|
||||||
java-version: '12.x'
|
|
||||||
- uses: subosito/[email protected]
|
|
||||||
with:
|
|
||||||
channel: 'stable'
|
|
||||||
- run: |
|
|
||||||
cd example
|
|
||||||
flutter pub get
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
cd example
|
|
||||||
flutter build apk
|
|
||||||
- name: Deploy
|
|
||||||
uses: wzieba/[email protected]
|
|
||||||
with:
|
|
||||||
appId: ${{secrets.FIREBASE_ANDROID_APPID}}
|
|
||||||
token: ${{secrets.FIREBASE_TOKEN}}
|
|
||||||
groups: stream-testers
|
|
||||||
file: example/build/app/outputs/apk/release/app-release.apk
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
name: Flutter Analyze
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- '*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: subosito/flutter-action@v1
|
|
||||||
with:
|
|
||||||
channel: 'beta'
|
|
||||||
- run: flutter pub get
|
|
||||||
|
|
||||||
- name: 'Flutter Format Check'
|
|
||||||
run: flutter format --set-exit-if-changed --dry-run .
|
|
||||||
|
|
||||||
- run: flutter analyze
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
BRANCH=$1
|
||||||
|
|
||||||
|
if [ "$BRANCH" == "dev" ]
|
||||||
|
then
|
||||||
|
# TODO Flutter dev branch is currently broken so we're unable to test MacOS.
|
||||||
|
echo "TODO: Skipping macOS testing due to Flutter dev branch issue. Switching branch to stable."
|
||||||
|
BRANCH=stable
|
||||||
|
fi
|
||||||
|
|
||||||
|
git clone https://github.com/flutter/flutter.git --depth 1 -b $BRANCH _flutter
|
||||||
|
echo "::add-path::$GITHUB_WORKSPACE/_flutter/bin"
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
flutter pub global activate melos
|
||||||
|
echo "::add-path::$HOME/.pub-cache/bin"
|
||||||
|
echo "::add-path::$GITHUB_WORKSPACE/_flutter/.pub-cache/bin"
|
||||||
|
echo "::add-path::$GITHUB_WORKSPACE/_flutter/bin/cache/dart-sdk/bin"
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [[ $(git ls-files --modified) ]]; then
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo "These files are not formatted correctly:"
|
||||||
|
for f in $(git ls-files --modified); do
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo "-----------------------------------------------------------------"
|
||||||
|
echo "$f"
|
||||||
|
echo "-----------------------------------------------------------------"
|
||||||
|
echo ""
|
||||||
|
git --no-pager diff --unified=0 --minimal $f
|
||||||
|
echo ""
|
||||||
|
echo "-----------------------------------------------------------------"
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
done
|
||||||
|
if [[ $GITHUB_WORKFLOW ]]; then
|
||||||
|
git checkout . > /dev/null 2>&1
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
echo "❌ Some files are incorrectly formatted, see above output."
|
||||||
|
echo ""
|
||||||
|
echo "To fix these locally, run: 'melos run format'."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
echo "✅ All files are formatted correctly."
|
||||||
|
fi
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
|
||||||
|
name: stream_flutter_workflow
|
||||||
|
|
||||||
|
env:
|
||||||
|
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths-ignore:
|
||||||
|
- 'docs/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
timeout-minutes: 15
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: 'Install Flutter'
|
||||||
|
run: ./.github/workflows/scripts/install-flutter.sh stable
|
||||||
|
- name: 'Install Tools'
|
||||||
|
run: |
|
||||||
|
./.github/workflows/scripts/install-tools.sh
|
||||||
|
flutter pub global activate tuneup
|
||||||
|
- name: 'Bootstrap Workspace'
|
||||||
|
run: melos bootstrap
|
||||||
|
- name: 'Dart Analyze'
|
||||||
|
run: |
|
||||||
|
melos exec -c 3 -- \
|
||||||
|
tuneup check
|
||||||
|
- name: 'Pub Check'
|
||||||
|
run: |
|
||||||
|
melos exec -c 1 --no-private --ignore="*example*" -- \
|
||||||
|
pub publish --dry-run
|
||||||
|
format:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 15
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: 'Install Flutter'
|
||||||
|
run: ./.github/workflows/scripts/install-flutter.sh stable
|
||||||
|
- name: 'Install Tools'
|
||||||
|
run: |
|
||||||
|
./.github/workflows/scripts/install-tools.sh
|
||||||
|
curl -sL https://github.com/google/google-java-format/releases/download/google-java-format-1.3/google-java-format-1.3-all-deps.jar -o $HOME/google-java-format.jar
|
||||||
|
- name: 'Bootstrap Workspace'
|
||||||
|
run: melos bootstrap
|
||||||
|
- name: 'Dart'
|
||||||
|
run: |
|
||||||
|
melos exec -c 1 -- \
|
||||||
|
flutter format .
|
||||||
|
./.github/workflows/scripts/validate-formatting.sh
|
||||||
|
- name: 'Objective-C'
|
||||||
|
if: ${{ success() || failure() }}
|
||||||
|
run: |
|
||||||
|
melos exec -c 4 --ignore="*platform_interface*" --ignore="*web*" -- \
|
||||||
|
find . -maxdepth 3 -name "*.h" -o -name "*.m" -print0 \| xargs -0 clang-format -i --style=Google --verbose
|
||||||
|
./.github/workflows/scripts/validate-formatting.sh
|
||||||
|
- name: 'Java'
|
||||||
|
if: ${{ success() || failure() }}
|
||||||
|
run: |
|
||||||
|
melos exec -c 4 --ignore="*platform_interface*" --ignore="*web*" -- \
|
||||||
|
find . -maxdepth 12 -name "*.java" -print0 \| xargs -0 java -jar $HOME/google-java-format.jar --replace
|
||||||
|
./.github/workflows/scripts/validate-formatting.sh
|
||||||
|
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 15
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: 'Install Flutter'
|
||||||
|
run: ./.github/workflows/scripts/install-flutter.sh stable
|
||||||
|
- name: 'Install Tools'
|
||||||
|
run: ./.github/workflows/scripts/install-tools.sh
|
||||||
|
- name: 'Bootstrap Workspace'
|
||||||
|
run: melos bootstrap
|
||||||
|
- name: 'Flutter Test'
|
||||||
|
run: |
|
||||||
|
melos exec -c 3 --dir-exists=test --ignore="*example*" --ignore="*web*" -- \
|
||||||
|
flutter test
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
name: Test
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: [ubuntu-latest]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Flutter action
|
|
||||||
uses: subosito/[email protected]
|
|
||||||
with:
|
|
||||||
channel: 'stable'
|
|
||||||
- name: Get dependencies
|
|
||||||
run: flutter pub get
|
|
||||||
- name: Run formatter
|
|
||||||
run: flutter format -n --set-exit-if-changed .
|
|
||||||
- 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
|
|
||||||
Reference in New Issue
Block a user