generated from Desdaemon/flutter_rust_bridge_template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
118 lines (112 loc) · 3.86 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
stages:
- prepare
- test
- build
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
prepare:image:
stage: prepare
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
image: docker:24.0.5
services:
- name: docker:24.0.5-dind
alias: docker
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_TLS_CERTDIR: ""
DOCKER_CLI_EXPERIMENTAL: enabled
script:
- echo $IMAGE_TAG
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker manifest inspect $IMAGE_TAG || true
- |
if ! docker manifest inspect $IMAGE_TAG; then
docker build -t $IMAGE_TAG .
docker push $IMAGE_TAG
fi
test:
stage: test
needs: [prepare:image]
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
image: $IMAGE_TAG
script:
- git clone https://gitlab.com/fieldkit/libraries/rustfk.git
- cp -f env.template .env
- flutter test
build:android:
stage: build
needs: [test]
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
image: $IMAGE_TAG
script:
- curl --silent "https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer" | bash
- ln -sf $PWD/.secure_files/fk-release-key.keystore $PWD/android/app/fk-release-key.keystore
- ln -sf $PWD/.secure_files/key.properties $PWD/android/key.properties
- stat $PWD/android/key.properties
- stat $PWD/android/app/fk-release-key.keystore
- ls -alh android/app
- git clone https://gitlab.com/fieldkit/libraries/rustfk.git
- echo "CI_COMMIT_REF_NAME=${CI_COMMIT_REF_NAME}" > .env
- echo "CI_COMMIT_SHA=${CI_COMMIT_SHA}" >> .env
- cat .env
- flutter build apk && sccache --show-stats
- flutter build appbundle --release && sccache --show-stats
artifacts:
name: "fk-patina-android-${CI_COMMIT_REF_NAME}"
paths:
- build/app/outputs/flutter-apk/*.apk
- build/app/outputs/bundle/release/*.aab
.setup: &common
image: "ghcr.io/cirruslabs/flutter:3.19.5"
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
before_script:
# BEGIN Rust
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh
- sh rustup.sh -y
- export PATH="$HOME/.cargo/bin:$PATH"
- rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android i686-linux-android
- cargo install cargo-ndk
# END Rust
build:ios:
<<: *common
stage: build
needs: [test]
tags:
- mac-lab
script:
- git clone https://gitlab.com/fieldkit/libraries/rustfk.git
# BEGIN Signing
- curl --silent "https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer" | bash
- export KEYCHAIN_PASSWORD=`cat .secure_files/secure-lab-mac-keychain-pw.txt`
- security find-identity -p codesigning
- security list-keychains
- security unlock-keychain -p ${KEYCHAIN_PASSWORD} login.keychain
- security show-keychain-info login.keychain || true
# END Signing
# BEGIN flutter
- curl --silent -O https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_arm64_3.19.5-stable.zip
- unzip flutter_macos_arm64_3.19.5-stable.zip
- ls -alh
# END flutter
- echo "CI_COMMIT_REF_NAME=${CI_COMMIT_REF_NAME}" > .env
- echo "CI_COMMIT_SHA=${CI_COMMIT_SHA}" >> .env
- cat .env
- export PATH=$PWD/flutter/bin:$PATH
- flutter clean
- flutter build ipa --export-options-plist=ExportOptions.plist
artifacts:
name: "fk-patina-ios-${CI_COMMIT_REF_NAME}"
paths:
- build/ios/ipa/*