Flutter GitHub Travis CI 搭建

通过 Travis CI 连接 GitHub 上的 Flutter 项目, 实现持续集成: 代码扫描, 测试, 打包发布 release.

Install Android SDK

os: linux

language: android

licenses:
- android-sdk-preview-license-.+
- android-sdk-license-.+
- google-gdk-license-.+

android:
  components:
  - tools
  - platform-tools
  - build-tools-28.0.3
  - android-28 # match your targetVersion

jdk: oraclejdk8

sudo: false

addons:
  apt:
    # Flutter depends on /usr/lib/x86_64-linux-gnu/libstdc++.so.6 version GLIBCXX_3.4.18
    sources:
    - ubuntu-toolchain-r-test
    packages:
    - libstdc++6
    - fonts-droid
复制代码

Install Flutter

cache:
  directories:
  - "$HOME/.pub-cache"


install:
- git clone https://github.com/flutter/flutter.git -b stable --depth 1
- export PATH=./flutter/bin:$PATH
- flutter doctor
复制代码

Test & Analyze Flutter Code

script:
- flutter packages get
- flutter analyze --no-pub --no-current-package lib/ test/
- flutter test --no-pub test/
复制代码

Push Release To GitHub

env:
 - BUILD_TIME=$(date +'%Y%m%d%H%M%S') APK_NAME="${TRAVIS_TAG}_${BUILD_TIME}_F4Lab.apk"

before_deploy:
- flutter build apk
- mv build/app/outputs/apk/release/app-release.apk $APK_NAME

deploy:
  provider: releases
  api_key:
    secure: $github_deploy_api_key
  file: $APK_NAME
  skip_cleanup: true
  overwrite: true
  on:
    repo: stefanJi/Flutter4GitLab
    branch: master
    condition: $TRAVIS_TAG =~ /^release-v\d+\.\d+\.\d+/ # when tag match release-vx.x.x, then push a relase and upload apk.
复制代码

Full Config

Flutter4GitLab/.travis.yml

转载于:https://juejin.im/post/5ca21e306fb9a05e5b2ac971

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值