1 Star 0 Fork 0

Fred的技术笔记 / fastlane_auto_project

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Gitlab+Fastlane+Cocopods+Bundler+CI/CD部署自动化测试发布项目

安装bundler

安装fastlane

安装cocopods

安装gitlab-runner

自定义脚本.gitlab.yml

stages:
  - setup       #编译前环境配置
  - oclint      #objc 代码检查
  - swiftlint   #swift代码检查
  - test        #单元测试
  - build       #编译项目
  - upload_pgy  #上传到蒲公英
  - upload_testflight #上传到testflight
  - release           #上传到appstore
variables:
  LC_ALL: "en_US.UTF-8"
  LANG: "en_US.UTF-8"

setup_job:
    stage: setup
    script:
      - bundle install
    tags:
      - my-ios-gitlab-runner
   
oclint_job:
    stage: oclint
    script:
      - bundle exec fastlane objectlint
    artifacts:
      paths:
        - fastlane/oclint/objectlint.html
    tags:
      - my-ios-gitlab-runner
 
swiftlint_job:
    stage: swiftlint
    script:
      - bundle exec fastlane swiftylint
    artifacts:
      paths:
        - fastlane/swiftlint.html
    tags:
      - my-ios-gitlab-runner
 
test_job:
    stage: test
    script:
      - bundle exec fastlane test
    tags:
      - my-ios-gitlab-runner

build_job:
    stage: build
    script:
      - bundle exec fastlane build
    tags:
      - my-ios-gitlab-runner
upload_pgy_job:
    stage: upload_pgy
    script:
      - bundle exec fastlane pgy_upload
    artifacts:
      paths:
        - fastlane/pgy/*.ipa
    tags:
      - my-ios-gitlab-runner
upload_tf_job:
    stage: upload_testflight
    script:
      - bundle exec fastlane tf_upload
    artifacts:
      paths:
        - fastlane/tf/*.ipa
    tags:
      - my-ios-gitlab-runner
release_job:
    stage: release
    script:
      - bundle exec fastlane release
    tags:
      - my-ios-gitlab-runner
    only:
      - tags

fastlane脚本


# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane

fastlane_require 'dotenv'

default_platform(:ios)

before_all do
      Dotenv.overload '.env.secret'
      Dotenv.overload '.env.default'
end

lane :objectlint do
    oclint(
      compile_commands: "compile_commands.json",    # The JSON compilation database, use xctool reporter "json-compilation-database"
      select_regex: /ViewController.m/,     # Select all files matching this regex
      exclude_regex: /Test.m/,    # Exclude all files matching this regex
      report_type: "html",         # The type of the report (default: html)
      report_path: "fastlane/oclint/objectlint.html",
      max_priority_1: 8,         # The max allowed number of priority 1 violations
      max_priority_2: 9,        # The max allowed number of priority 2 violations
      max_priority_3: 10,       # The max allowed number of priority 3 violations
      thresholds: [     # Override the default behavior of rules
        "LONG_LINE=200",
        "LONG_METHOD=200"
      ],
      enable_rules: [   # List of rules to pick explicitly
        "DoubleNegative",
        "SwitchStatementsDon'TNeedDefaultWhenFullyCovered"
      ],
      disable_rules: ["GotoStatement"],     # List of rules to disable
      list_enabled_rules: true,   # List enabled rules
      enable_clang_static_analyzer: true,   # Enable Clang Static Analyzer, and integrate results into OCLint report
      enable_global_analysis: true,         # Compile every source, and analyze across global contexts (depends on number of source files, could results in high memory load)
      allow_duplicated_violations: true,    # Allow duplicated violations in the OCLint report
      extra_arg: "-Wno-everything"# Additional argument to append to the compiler command line
)
end

lane :swiftylint do
     swiftlint(
         reporter: "html",
         output_file: "fastlane/swiftlint.html",
      ignore_exit_status: true
              )
end

lane :test do
  
     scan(
         scheme: ENV['XCODE_SCHEME'],
         output_directory: "fastlane/tests",
         clean: true
         )
end


lane :build do

     # incerment the build number
     increment_build_number(
         build_number: ENV['CI_JOBENV_ID'],
         xcodeproj: ENV['XCODE_PROJECT']
         )

     # BUILD
     gym(
         scheme: ENV['XCODE_SCHEME'],
         configuration: ENV['DEVELOP_CONFIGURATION'],
         export_method: ENV['DEVELOP_EXPORT_METHOD'],
         #export_xargs: ENV['DEVELOP_XARGS'],
         silent: true,
         clean: true,
      codesigning_identity: "Apple Distribution: yangui xi (9S6T5CVY8R)",
      export_options: {
          provisioningProfiles: {
            "com.xyg.fastlane" => "home_distrib"
        }
      }
         )

  end
  
lane :pgy_upload do
    # incerment the build number
  increment_build_number(
         build_number: ENV['CI_JOBENV_ID'],
         xcodeproj: ENV['XCODE_PROJECT']
         )
  build_app(
      #workspace: "MyApp.xcworkspace",
      configuration: "Debug",
      scheme: ENV['XCODE_SCHEME'],
      silent: true,
      clean: true,
      output_directory: "fastlane/pgy", # Destination directory. Defaults to current directory.
      output_name: "pgy_debug.ipa",       # specify the name of the .ipa file to generate (including file extension)
      sdk: "iOS 15.2"        # use SDK as the name or path of the base SDK when building the project.
)
  pgyer(api_key: "10deff014b5276d83f1c368a662071d1", user_key: "b0bc3076c06dc48532eb58bb7b236b2d")
end


lane :tf_upload do
  # incerment the build number
  increment_build_number(
         build_number: ENV['CI_JOBENV_ID'],
         xcodeproj: ENV['XCODE_PROJECT']
         )
  gym(
          clean: true,
          output_directory: './fastlane/tf',
          output_name:"testflight.ipa",
          scheme: ENV['XCODE_SCHEME'],
          configuration: ENV['DEVELOP_CONFIGURATION'],###########
          include_bitcode: true,
          include_symbols: true,
          codesigning_identity:"Apple Distribution: yangui xi (9S6T5CVY8R)",
          export_options: {
            method: 'app-store',
            provisioningProfiles: {
               "com.xyg.fastlane" => "home_distrib"
            },
          }
    )
    notification(app_icon:"./fastlane/icon.png",title:"LoanManager",subtitle: "打包成功,已导出安装包>>>>>>>>", message: "准备发布中....")
    api_key = app_store_connect_api_key(
        key_id: "UU657JJ8N5",
        issuer_id: "ffa427b7-d74d-4a21-8993-8f0477176e7d",
        key_filepath: "./fastlane/AuthKey_UU657JJ8N5.p8",
        duration: 1200, # optional (maximum 1200)
        in_house: false # optional but may be required if using match/sigh
      )
      
    upload_to_testflight(
      api_key: api_key,
      skip_waiting_for_build_processing: true,
      # username: "1xxxx@163.com",
      # app_identifier: "com.sxx.xxx",
      ipa: "./fastlane/tf/testflight.ipa",
      skip_submission:true
     )
end



platform :ios do
  desc "Description of what the lane does"
  lane :custom_lane do
    # add actions here: https://docs.fastlane.tools/actions
  end
end

To make it easy for you to get started with GitLab, here's a list of recommended next steps.

Already a pro? Just edit this README.md and make it your own. Want to make it easy? Use the template at the bottom!

Add your files

cd existing_repo
git remote add origin https://gitlab.com/XYGDeveloper/demo.git
git branch -M main
git push -uf origin main

Integrate with your tools

Collaborate with your team

Test and Deploy

Use the built-in continuous integration in GitLab.


Editing this README

When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to makeareadme.com for this template.

Suggestions for a good README

Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.

Name

Choose a self-explaining name for your project.

Description

Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.

Badges

On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.

Visuals

Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.

Installation

Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.

Usage

Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.

Support

Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.

Roadmap

If you have ideas for releases in the future, it is a good idea to list them in the README.

Contributing

State if you are open to contributions and what your requirements are for accepting them.

For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.

You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.

Authors and acknowledgment

Show your appreciation to those who have contributed to the project.

License

For open source projects, say how it is licensed.

Project status

If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.

MIT License Copyright (c) 2022 xiyg Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
Swift 等 4 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Swift
1
https://gitee.com/xiyg/fastlane_auto_project.git
git@gitee.com:xiyg/fastlane_auto_project.git
xiyg
fastlane_auto_project
fastlane_auto_project
master

搜索帮助