Merge pull request #95 from jpeg-ms/jeandr/add-support-for-aab-stores-upload

Implement support for AAB upload to store
This commit is contained in:
Evgeniy Khramkov 2019-07-23 07:48:17 -07:00 коммит произвёл GitHub
Родитель afdc16edd1 1dd1bd91eb
Коммит 71b0b41a50
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 146 добавлений и 6 удалений

Просмотреть файл

@ -35,6 +35,7 @@ The action parameters `api_token` and `owner_name` can also be omitted when thei
- `APPCENTER_OWNER_NAME` - Owner name
- `APPCENTER_APP_NAME` - App name. If there is no app with such name, you will be prompted to create one
- `APPCENTER_DISTRIBUTE_APK` - Build release path for android build
- `APPCENTER_DISTRIBUTE_AAB` - Build release path for android app bundle build (preview)
- `APPCENTER_DISTRIBUTE_IPA` - Build release path for ios build
- `APPCENTER_DISTRIBUTE_DSYM` - Path to your symbols (app.dSYM.zip) file
- `APPCENTER_DISTRIBUTE_UPLOAD_DSYM_ONLY` - Flag to upload only the dSYM file to App Center

Просмотреть файл

@ -118,7 +118,8 @@ module Fastlane
file = [
params[:ipa],
params[:apk]
params[:apk],
params[:aab]
].detect { |e| !e.to_s.empty? }
UI.user_error!("Couldn't find build file at path '#{file}'") unless file && File.exist?(file)
@ -275,7 +276,7 @@ module Fastlane
default_value: Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH],
optional: true,
type: String,
conflicting_options: [:ipa],
conflicting_options: [:ipa, :aab],
conflict_block: proc do |value|
UI.user_error!("You can't use 'apk' and '#{value.key}' options in one run")
end,
@ -284,13 +285,28 @@ module Fastlane
UI.user_error!("Only \".apk\" formats are allowed, you provided \"#{File.extname(value)}\"") unless accepted_formats.include? File.extname(value)
end),
FastlaneCore::ConfigItem.new(key: :aab,
env_name: "APPCENTER_DISTRIBUTE_AAB",
description: "Build release path for android app bundle build (preview)",
default_value: Actions.lane_context[SharedValues::GRADLE_AAB_OUTPUT_PATH],
optional: true,
type: String,
conflicting_options: [:ipa, :apk],
conflict_block: proc do |value|
UI.user_error!("You can't use 'aab' and '#{value.key}' options in one run")
end,
verify_block: proc do |value|
accepted_formats = [".aab"]
UI.user_error!("Only \".aab\" formats are allowed, you provided \"#{File.extname(value)}\"") unless accepted_formats.include? File.extname(value)
end),
FastlaneCore::ConfigItem.new(key: :ipa,
env_name: "APPCENTER_DISTRIBUTE_IPA",
description: "Build release path for ios build",
default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH],
optional: true,
type: String,
conflicting_options: [:apk],
conflicting_options: [:apk, :aab],
conflict_block: proc do |value|
UI.user_error!("You can't use 'ipa' and '#{value.key}' options in one run")
end,
@ -458,6 +474,19 @@ module Fastlane
dsym: "./app.dSYM.zip",
release_notes: "release notes",
notify_testers: false
)',
'appcenter_upload(
api_token: "...",
owner_name: "appcenter_owner",
app_name: "testing_app",
aab: "./app.aab",
destinations: "Alpha",
destination_type: "store",
build_number: "3",
version: "1.0.0",
mapping: "./mapping.txt",
release_notes: "release notes",
notify_testers: false
)'
]
end

Просмотреть файл

@ -184,7 +184,7 @@ module Fastlane
options = {}
options[:upload_id] = upload_id
# ipa field is used both for .apk and .ipa files
# ipa field is used for .apk, .aab and .ipa files
options[:ipa] = Faraday::UploadIO.new(file, 'application/octet-stream') if file && File.exist?(file)
response = connection.post do |req|

Просмотреть файл

@ -198,6 +198,22 @@ describe Fastlane::Actions::AppcenterUploadAction do
end.to raise_error("Couldn't find build file at path './nothing.apk'")
end
it "raises an error if given aab was not found" do
expect do
stub_check_app(200)
Fastlane::FastFile.new.parse("lane :test do
appcenter_upload({
api_token: 'xxx',
owner_name: 'owner',
app_name: 'app',
destinations: 'Testers',
destination_type: 'group',
aab: './nothing.aab'
})
end").runner.execute(:test)
end.to raise_error("Couldn't find build file at path './nothing.aab'")
end
it "raises an error if given ipa was not found" do
expect do
stub_check_app(200)
@ -229,6 +245,21 @@ describe Fastlane::Actions::AppcenterUploadAction do
end.to raise_error("Only \".apk\" formats are allowed, you provided \"\"")
end
it "raises an error if given file has invalid extension for aab" do
expect do
Fastlane::FastFile.new.parse("lane :test do
appcenter_upload({
api_token: 'xxx',
owner_name: 'owner',
app_name: 'app',
destinations: 'Testers',
destination_type: 'group',
aab: './spec/fixtures/appfiles/Appfile_empty'
})
end").runner.execute(:test)
end.to raise_error("Only \".aab\" formats are allowed, you provided \"\"")
end
it "raises an error if given file has invalid extension for ipa" do
expect do
Fastlane::FastFile.new.parse("lane :test do
@ -260,6 +291,38 @@ describe Fastlane::Actions::AppcenterUploadAction do
end.to raise_error("You can't use 'ipa' and 'apk' options in one run")
end
it "raises an error if both aab and apk provided" do
expect do
Fastlane::FastFile.new.parse("lane :test do
appcenter_upload({
api_token: 'xxx',
owner_name: 'owner',
app_name: 'app',
destinations: 'Testers',
destination_type: 'group',
aab: './spec/fixtures/appfiles/aab_file_empty.aab',
apk: './spec/fixtures/appfiles/apk_file_empty.apk'
})
end").runner.execute(:test)
end.to raise_error("You can't use 'aab' and 'apk' options in one run")
end
it "raises an error if both aab and ipa provided" do
expect do
Fastlane::FastFile.new.parse("lane :test do
appcenter_upload({
api_token: 'xxx',
owner_name: 'owner',
app_name: 'app',
destinations: 'Testers',
destination_type: 'group',
ipa: './spec/fixtures/appfiles/ipa_file_empty.ipa',
apk: './spec/fixtures/appfiles/apk_file_empty.apk'
})
end").runner.execute(:test)
end.to raise_error("You can't use 'ipa' and 'apk' options in one run")
end
it "raises an error if destination type is not group or store" do
expect do
Fastlane::FastFile.new.parse("lane :test do
@ -519,6 +582,28 @@ describe Fastlane::Actions::AppcenterUploadAction do
end").runner.execute(:test)
end
it "works with valid parameters for android app bundle" do
stub_check_app(200)
stub_create_release_upload(200)
stub_upload_build(200)
stub_update_release_upload(200, 'committed')
stub_update_release(200)
stub_get_destination(200)
stub_add_to_destination(200)
stub_get_release(200)
Fastlane::FastFile.new.parse("lane :test do
appcenter_upload({
api_token: 'xxx',
owner_name: 'owner',
app_name: 'app',
aab: './spec/fixtures/appfiles/aab_file_empty.aab',
destinations: 'Testers',
destination_type: 'group'
})
end").runner.execute(:test)
end
it "uses GRADLE_APK_OUTPUT_PATH as default for apk" do
stub_check_app(200)
stub_create_release_upload(200)
@ -544,6 +629,31 @@ describe Fastlane::Actions::AppcenterUploadAction do
expect(values[:apk]).to eq('./spec/fixtures/appfiles/apk_file_empty.apk')
end
it "uses GRADLE_AAB_OUTPUT_PATH as default for aab" do
stub_check_app(200)
stub_create_release_upload(200)
stub_upload_build(200)
stub_update_release_upload(200, 'committed')
stub_update_release(200)
stub_get_destination(200)
stub_add_to_destination(200)
stub_get_release(200)
values = Fastlane::FastFile.new.parse("lane :test do
Actions.lane_context[SharedValues::GRADLE_AAB_OUTPUT_PATH] = './spec/fixtures/appfiles/aab_file_empty.aab'
appcenter_upload({
api_token: 'xxx',
owner_name: 'owner',
app_name: 'app',
destinations: 'Testers',
destination_type: 'group'
})
end").runner.execute(:test)
expect(values[:aab]).to eq('./spec/fixtures/appfiles/aab_file_empty.aab')
end
it "uses IPA_OUTPUT_PATH as default for ipa" do
stub_check_app(200)
stub_create_release_upload(200)

0
spec/fixtures/appfiles/aab_file_empty.aab поставляемый Normal file
Просмотреть файл