Fastfile 3.62 KB
Newer Older
1
ENV["MATCH_GIT_URL"] = "ssh://git@gitlab.akamu.de:26/vorstand/ios-match-certificate.git"
2
ENV["FASTLANE_OUTPUT_DIRECTORY"] = "fastlane/output"
3
4
5
6
7
8

@output_directory = ENV["FASTLANE_OUTPUT_DIRECTORY"]
# git url of match
@match_git_url = ENV["MATCH_GIT_URL"]

REQUIRED_XCODE_VERSION = "11.3"
9
10
11
12
default_platform(:ios)

platform :ios do

13
14
  def badge_version_string(version_number, build_number, color)
    "#{version_number}-#{build_number}-#{color}"
15
16
  end

17
  def build_and_upload_beta()  
18
    gym(
19
      scheme: "Akamu-QA-PROD",
20
      clean: true,
21
      output_directory: @output_directory,
22
      #xcargs: "FIREBASE_PLIST=#{firebase_plist}",
23
      silent: true,
24
      configuration: "Release (QA)",
25
26
27
      export_options: {
        signingStyle: "manual", # or manual , automatic
        provisioningProfiles: {
28
        "de.akamu.tudarmstadt.gameclientakamu" => "match AppStore de.akamu.tudarmstadt.gameclientakamu"
29
30
31
32
33
        }
      },
      sdk: "iphoneos"
    )

34
    # internal test flight upload
35
    pilot(
36
      username: "dev@akamu.de",
37
      ipa: "#{@output_directory}/Akamu_iOS.ipa",
38
      skip_waiting_for_build_processing: true, 
39
40
      # reduces CI time but is not possible to use with distribute external
      distribute_external: false,
41
    )
42
43
  end

44
  def upload_debug_symbols(version_number, build_number)
45
46
47
48
49
50
51
52
    download_dsyms(
      username: "dev@akamu.de",
      app_identifier: "de.akamu.tudarmstadt.gameclientakamu",
      build_number: build_number,
      version: version_number,
      wait_for_dsym_processing: true,
      wait_timeout: 360
    )
53

54
    upload_symbols_to_crashlytics(
55
      binary_path: "./fbScripts/upload-symbols",
56
      dsym_path: "./de.akamu.tudarmstadt.gameclientakamu-#{version_number}-#{build_number}.dSYM.zip"
57
    )
58
59
60
61
62
63
64
65
66
  end

  private_lane :verify_xcode_version do
    ensure_xcode_version(version: REQUIRED_XCODE_VERSION)
  end

  lane :lint do
    sh("mv ../Mintfile ./Mintfile")
    sh("mint bootstrap")
67
    sh("mv ./Mintfile ../Mintfile")
68
    
69
    SWIFTLINT_PATH = sh("mint which swiftlint -m ../Mintfile | tr -d '\n'")  
70

71
    swiftlint(
72
      executable: "#{SWIFTLINT_PATH}",
73
74
75
76
77
78
79
      reporter: "html",
      output_file: "fastlane/swiftlint.html"
    )
  end

  lane :test do
    scan(
80
      scheme: 'Akamu-QA-PROD', # Project scheme name
81
      clean: true, # Clean project folder before test execution
82
83
      device: 'iPhone 8', # Simulator for testing
      reset_simulator: true,
84
      configuration: "Debug (Development)"
85
86
87
    )
  end

88
  lane :beta do |options|
89
90
91
92
93
94

    match(git_url: @match_git_url,
    type: "appstore",
    app_identifier: "de.akamu.tudarmstadt.gameclientakamu",
    readonly: true)

95
    version_number = options[:version_number] || get_version_number(target: "Akamu_iOS")
96
97
98
99
100
    bump_version_number = !!options[:version_number]
    if bump_version_number
      version_number = increment_version_number(version_number: version_number)
    end

101
    # increase build number everytime when packaging a new build
102
    build_number = increment_build_number(build_number: latest_testflight_build_number(version: version_number, username: "dev@akamu.de", app_identifier: "de.akamu.tudarmstadt.gameclientakamu") + 1)
103

Maurice Kraus's avatar
Maurice Kraus committed
104
105
106
107
108
    version_string = badge_version_string(version_number, build_number, "blue")

    puts "VERSION: #{version_string}"

    add_badge(shield: version_string, dark: true)
109

110
    build_and_upload_beta
111

112
113
114

  end

115

116
117
118
119
120
121
122
123
124
  lane :upload_debug_symbols do |options|

    version_number = options[:version_number]

    build_number = "#{latest_testflight_build_number(
      version: version_number,
      username: "dev@akamu.de",
      app_identifier: "de.akamu.tudarmstadt.gameclientakamu")}"

125
    upload_debug_symbols(version_number, build_number)
126
127
128
  end


129
end