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"
+1 -1
View File
@@ -20,7 +20,7 @@ default_platform(:android)
platform :android do
desc "Build development version"
lane :dev do
sh "flutter build apk --verbose --release --dart-define=SERVER_URL=$SERVER_URL"
sh "flutter build apk --verbose --debug --dart-define=SERVER_URL=$SERVER_URL"
end
desc "Build and deploy release version"
+40
View File
@@ -0,0 +1,40 @@
fastlane documentation
----
# Installation
Make sure you have the latest version of the Xcode command line tools installed:
```sh
xcode-select --install
```
For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane)
# Available Actions
## Android
### android dev
```sh
[bundle exec] fastlane android dev
```
Build development version
### android release
```sh
[bundle exec] fastlane android release
```
Build and deploy release version
----
This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.
More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools).
The documentation of _fastlane_ can be found on [docs.fastlane.tools](https://docs.fastlane.tools).
+18 -4
View File
@@ -468,6 +468,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/RunnerProfile.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = KUT463DS29;
@@ -603,6 +604,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = KUT463DS29;
@@ -632,9 +634,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = KUT463DS29;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = KUT463DS29;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
@@ -644,7 +649,8 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.linagora.ios.teammail;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = tmail.development.profile;
PROVISIONING_PROFILE_SPECIFIER = tmail.distribution.profile;
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = tmail.distribution.profile;
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
@@ -661,9 +667,11 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = TeamMailShareExtension/TeamMailShareExtension.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = KUT463DS29;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = KUT463DS29;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = TeamMailShareExtension/Info.plist;
@@ -680,7 +688,8 @@
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.linagora.ios.teammail.TeamMailShareExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = tmail.ext.ios.development.provisioning.profile;
PROVISIONING_PROFILE_SPECIFIER = tmail.share.ext.development.profile;
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = tmail.share.ext.development.profile;
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -700,9 +709,12 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = TeamMailShareExtension/TeamMailShareExtension.entitlements;
CODE_SIGN_IDENTITY = "Apple Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = KUT463DS29;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = KUT463DS29;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = TeamMailShareExtension/Info.plist;
@@ -718,7 +730,8 @@
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.linagora.ios.teammail.TeamMailShareExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = tmail.ext.ios.development.provisioning.profile;
PROVISIONING_PROFILE_SPECIFIER = tmail.share.ext.distribution.profile;
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = tmail.share.ext.distribution.profile;
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
@@ -736,6 +749,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = TeamMailShareExtension/TeamMailShareExtension.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = KUT463DS29;
@@ -754,7 +768,7 @@
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.linagora.ios.teammail.TeamMailShareExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = tmail.ext.ios.development.provisioning.profile;
PROVISIONING_PROFILE_SPECIFIER = tmail.share.ext.development.profile;
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
+12 -58
View File
@@ -11,53 +11,24 @@
#
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
update_fastlane
opt_out_usage
default_platform(:ios)
setup_ci if ENV['CI']
# Import signing certificate
import_certificate(
certificate_path: "cert.p12",
certificate_password: ENV["CERTIFICATE_PASSWORD"],
keychain_name: ENV["MATCH_KEYCHAIN_NAME"]
)
# 2 provisioning profiles, 1 for the main app and 1 for the share extension
install_provisioning_profile(path: "buildpp.mobileprovision")
install_provisioning_profile(path: "shareextpp.mobileprovision")
platform :ios do
desc "Build development version"
lane :dev do
update_code_signing_settings(
use_automatic_signing: false,
path: "Runner.xcodeproj",
code_sign_identity: "Apple Development"
)
# Update the provisioning profile for both the main app and extension
update_project_provisioning(
xcodeproj: "Runner.xcodeproj",
profile: "./buildpp.mobileprovision",
target_filter: ".*Runner.*"
)
update_project_provisioning(
xcodeproj: "Runner.xcodeproj",
profile: "./shareextpp.mobileprovision",
target_filter: ".*TeamMailShareExtension.*"
sync_code_signing(
type: "development",
git_private_key: ENV["APPLE_CERTIFICATES_SSH_KEY"]
)
build_app(
scheme: "Runner",
configuration: "Debug",
workspace: "Runner.xcworkspace",
export_method: "development",
export_options: {
provisioningProfiles: {
"com.linagora.ios.teammail": "tmail.development.profile",
"com.linagora.ios.teammail.TeamMailShareExtension": "tmail.share.ext.development.profile"
}
}
)
end
@@ -67,7 +38,11 @@ platform :ios do
app_store_connect_api_key(
key_id: ENV["APPLE_KEY_ID"],
issuer_id: ENV["APPLE_ISSUER_ID"],
key_filepath: "./apiKey.p8"
key_content: ENV["APPLE_KEY_CONTENT"]
)
sync_code_signing(
type: "appstore",
git_private_key: ENV["APPLE_CERTIFICATES_SSH_KEY"]
)
increment_build_number(
build_number: latest_testflight_build_number + 1
@@ -75,32 +50,11 @@ platform :ios do
increment_version_number(
version_number: last_git_tag.gsub("v", "")
)
update_code_signing_settings(
use_automatic_signing: false,
path: "Runner.xcodeproj",
code_sign_identity: "Apple Distribution"
)
# Update the provisioning profile for both the main app and extension
update_project_provisioning(
xcodeproj: "Runner.xcodeproj",
profile: "./buildpp.mobileprovision",
target_filter: ".*Runner.*"
)
update_project_provisioning(
xcodeproj: "Runner.xcodeproj",
profile: "./shareextpp.mobileprovision",
target_filter: ".*TeamMailShareExtension.*"
)
build_app(
scheme: "Runner",
configuration: "Release",
workspace: "Runner.xcworkspace",
export_method: "app-store",
export_options: {
provisioningProfiles: {
"com.linagora.ios.teammail": "tmail.distribution.profile",
"com.linagora.ios.teammail.TeamMailShareExtension": "tmail.share.ext.distribution.profile"
}
}
export_method: "app-store"
)
upload_to_testflight(
skip_waiting_for_build_processing: true,
+13
View File
@@ -0,0 +1,13 @@
git_url("git@github.com:linagora/apple-certificates.git")
storage_mode("git")
type("development") # The default type, can be: appstore, adhoc, enterprise or development
app_identifier(["com.linagora.ios.teammail", "com.linagora.ios.teammail.TeamMailShareExtension"])
# username("user@fastlane.tools") # Your Apple Developer Portal username
# For all available options run `fastlane match --help`
# Remove the # in the beginning of the line to enable the other options
# The docs are available on https://docs.fastlane.tools/actions/match
+40
View File
@@ -0,0 +1,40 @@
fastlane documentation
----
# Installation
Make sure you have the latest version of the Xcode command line tools installed:
```sh
xcode-select --install
```
For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane)
# Available Actions
## iOS
### ios dev
```sh
[bundle exec] fastlane ios dev
```
Build development version
### ios release
```sh
[bundle exec] fastlane ios release
```
Build and deploy release version
----
This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.
More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools).
The documentation of _fastlane_ can be found on [docs.fastlane.tools](https://docs.fastlane.tools).
+3 -3
View File
@@ -5,11 +5,11 @@ set -e
set -x
cd core
#flutter pub get
flutter pub get
## Install necessary pods
#cd ../ios
#flutter pub get && pod install
# cd ../ios
# flutter pub get && pod install
cd ../model
flutter pub get && flutter pub run build_runner build --delete-conflicting-outputs