选择Git版本
README.md
.gitlab-ci.yml 1.36 KiB
image: cirrusci/flutter
stages:
- check
- build
- deploy
code_quality:
stage: check
before_script:
- flutter pub global activate flutter_analyze_reporter
- export PATH="$PATH:$HOME/.pub-cache/bin"
script:
- flutter pub get
- flutter_analyze_reporter --output=report.json --reporter=gitlab
artifacts:
reports:
codequality: report.json
check:
stage: check
script:
- sh ./scripts/check-all
coverage: '/lines\.*: \d+\.\d+\%/'
artifacts:
name: "test-coverage-report-$CI_COMMIT_SHORT_SHA"
paths:
- coverage
expire_in: 5 days
build-android:
extends: check
stage: build
script:
- flutter build apk --dart-define=REQUEST_ENV=prod_env
- export VERSION_APK=$(/opt/android-sdk-linux/build-tools/30.0.3/aapt2 dump badging build/app/outputs/flutter-apk/app-release.apk | grep "versionName" | sed -e "s/.*versionName='//" -e "s/' .*//")
artifacts:
paths:
- build/app/outputs/flutter-apk/app-release.apk
expire_in: 2 days
build-ios:
extends: check
stage: build
script:
# - flutter build ipa
- echo "Hello World."
upload-apk:
stage: deploy
script:
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build/app/outputs/flutter-apk/app-release.apk "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/jihu-gitlab-app/${VERSION_APK}/app-release.apk"'
only:
- main