經過 Travis CI 鏈接 GitHub 上的 Flutter 項目, 實現持續集成: 代碼掃描, 測試, 打包發佈 release.linux
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
複製代碼
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
複製代碼
script:
- flutter packages get
- flutter analyze --no-pub --no-current-package lib/ test/
- flutter test --no-pub test/
複製代碼
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.
複製代碼
Flutter4GitLab/.travis.ymlandroid