Splited the test report job for forks

Refactored fastlane for both ios and android

Refactored github workflows

(cherry picked from commit c3ff622af05f87e16ae1cadec0c95c87cca3d763)
This commit is contained in:
Nguyen Thai
2023-05-15 11:45:33 +07:00
committed by Dat Vu
parent 1e3b96703a
commit 146b208631
11 changed files with 187 additions and 159 deletions
+6 -20
View File
@@ -1,5 +1,10 @@
on:
workflow_call:
pull_request:
paths-ignore:
- ".github/**"
- "docs"
- "Jenkinsfile"
- "**/*.md"
name: Analyze and test
@@ -56,22 +61,3 @@ jobs:
with:
name: test-reports
path: test-report*.json
report:
runs-on: ubuntu-latest
if: success() || failure() # Always upload report
needs:
- analyze-test
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: test-reports
- uses: dorny/test-reporter@v1
with:
name: Flutter Tests
path: "*.json"
reporter: flutter-json
only-summary: "true"
@@ -1,23 +1,11 @@
on:
workflow_dispatch:
pull_request:
paths-ignore:
- ".github/**"
- "docs"
- "Jenkinsfile"
- "**/*.md"
name: CI
name: Build dev binaries
jobs:
analyze-test:
name: Analyze and test
uses: ./.github/workflows/analyze-test.yaml
build-app:
name: Build app
needs:
- analyze-test
runs-on: ${{ matrix.runner }}
strategy:
matrix:
@@ -41,21 +29,18 @@ jobs:
cache-key: deps-${{ hashFiles('**/pubspec.lock') }} # optional, change this to force refresh cache
cache-path: ${{ runner.tool_cache }}/flutter # optional, change this to specify the cache path
- name: Setup Fastlane
uses: ruby/setup-ruby@v1
with:
ruby-version: "ruby"
bundler-cache: true
working-directory: ${{ matrix.os }}
- name: Setup Firebase env
env:
FIREBASE_ENV: ${{ secrets.FIREBASE_ENV }}
run: echo "$FIREBASE_ENV" > ./configurations/env.fcm
- name: Setup Android environment
if: matrix.os == 'android'
env:
PLAY_STORE_UPLOAD_KEY_BASE64: ${{ secrets.PLAY_STORE_UPLOAD_KEY_BASE64 }}
PLAY_STORE_KEY_INFO_BASE64: ${{ secrets.PLAY_STORE_KEY_INFO_BASE64 }}
run: |
echo "$PLAY_STORE_UPLOAD_KEY_BASE64" | base64 --decode > app/keystore.jks
echo "$PLAY_STORE_KEY_INFO_BASE64" | base64 --decode > key.properties
working-directory: ${{ matrix.os }}
- name: Setup Java
if: matrix.os == 'android'
uses: actions/setup-java@v3
@@ -65,37 +50,25 @@ jobs:
- name: Setup iOS environment
if: matrix.os == 'ios'
env:
CERTIFICATE_BASE64: ${{ secrets.CERTIFICATE_BASE64 }}
PROVISION_PROFILE_BASE64: ${{ secrets.PROVISION_PROFILE_BASE64 }}
SHAREEXT_PROVISION_PROFILE_BASE64: ${{ secrets.SHAREEXT_PROVISION_PROFILE_BASE64 }}
run: |
echo -n "$CERTIFICATE_BASE64" | base64 --decode --output cert.p12
echo -n "$PROVISION_PROFILE_BASE64" | base64 --decode --output buildpp.mobileprovision
echo -n "$SHAREEXT_PROVISION_PROFILE_BASE64" | base64 --decode --output shareextpp.mobileprovision
flutter pub get && pod install
flutter pub get
pod install && pod update
working-directory: ${{ matrix.os }}
- name: Setup Fastlane
uses: ruby/setup-ruby@v1
with:
ruby-version: "ruby"
bundler-cache: true
working-directory: ${{ matrix.os }}
- name: Run prebuild
run: bash prebuild.sh
- name: Build
env:
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
APPLE_CERTIFICATES_SSH_KEY: ${{ secrets.APPLE_CERTIFICATES_SSH_KEY }}
run: bundle exec fastlane dev
working-directory: ${{ matrix.os }}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: tmail-dev-pr-${{ github.event.pull_request.number }}
name: tmail-dev
path: |
build/app/outputs/flutter-apk/app-release.apk
build/app/outputs/flutter-apk/app-debug.apk
ios/Runner.ipa
+19 -32
View File
@@ -6,15 +6,9 @@ on:
name: Release
jobs:
analyze-test:
name: Analyze and test
uses: ./.github/workflows/analyze-test.yaml
release:
name: Release
if: startsWith(github.ref, 'refs/tags/v')
needs:
- analyze-test
runs-on: ${{ matrix.runner }}
strategy:
matrix:
@@ -45,6 +39,20 @@ jobs:
FIREBASE_ENV: ${{ secrets.FIREBASE_ENV }}
run: echo "$FIREBASE_ENV" > ./configurations/env.fcm
- name: Setup Fastlane
uses: ruby/setup-ruby@v1
with:
ruby-version: "ruby"
bundler-cache: true
working-directory: ${{ matrix.os }}
- name: Setup Java
if: matrix.os == 'android'
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "11"
- name: Setup Android environment
if: matrix.os == 'android'
env:
@@ -55,44 +63,23 @@ jobs:
echo "$PLAY_STORE_KEY_INFO_BASE64" | base64 --decode > key.properties
working-directory: ${{ matrix.os }}
- name: Setup Java
if: matrix.os == 'android'
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "11"
- name: Setup iOS environment
if: matrix.os == 'ios'
env:
CERTIFICATE_BASE64: ${{ secrets.CERTIFICATE_BASE64 }}
PROVISION_PROFILE_BASE64: ${{ secrets.PROVISION_PROFILE_BASE64 }}
SHAREEXT_PROVISION_PROFILE_BASE64: ${{ secrets.SHAREEXT_PROVISION_PROFILE_BASE64 }}
APPLE_API_KEY_BASE64: ${{ secrets.APPLE_API_KEY_BASE64 }}
run: |
echo -n "$CERTIFICATE_BASE64" | base64 --decode --output cert.p12
echo -n "$PROVISION_PROFILE_BASE64" | base64 --decode --output buildpp.mobileprovision
echo -n "$SHAREEXT_PROVISION_PROFILE_BASE64" | base64 --decode --output shareextpp.mobileprovision
echo -n "$APPLE_API_KEY_BASE64" | base64 --decode --output apiKey.p8
flutter pub get && pod install
flutter pub get
pod install && pod update
working-directory: ${{ matrix.os }}
- name: Setup Fastlane
uses: ruby/setup-ruby@v1
with:
ruby-version: "ruby"
bundler-cache: true
working-directory: ${{ matrix.os }}
- name: Run prebuild
run: bash prebuild.sh
- name: Build and deploy
env:
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
FASTLANE_USER: ${{ secrets.APPLE_ID }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
APPLE_CERTIFICATES_SSH_KEY: ${{ secrets.APPLE_CERTIFICATES_SSH_KEY }}
PLAY_STORE_CONFIG_JSON: ${{ secrets.PLAY_STORE_CONFIG_JSON }}
APPLE_ISSUER_ID: ${{ secrets.APPLE_ISSUER_ID }}
APPLE_KEY_ID: ${{ secrets.APPLE_KEY_ID }}
APPLE_KEY_CONTENT: ${{ secrets.APPLE_KEY_CONTENT }}
run: bundle exec fastlane release
working-directory: ${{ matrix.os }}
+21
View File
@@ -0,0 +1,21 @@
on:
workflow_run:
workflows:
- "Analyze and test"
types:
- completed
name: Test Reports
jobs:
reports:
name: Upload test reports
runs-on: ubuntu-latest
steps:
- uses: dorny/test-reporter@v1
with:
artifact: test-reports
name: Flutter Tests
path: "*.json"
reporter: flutter-json
only-summary: "true"