flutter_app/.drone.yml

264 lines
9.0 KiB
YAML
Raw Permalink Normal View History

2021-03-26 00:44:03 +00:00
---
kind: pipeline
type: docker
2021-04-13 20:23:18 +00:00
name: linux-android-test
2021-03-26 00:44:03 +00:00
2021-05-03 23:22:16 +00:00
clone:
disable: true
2021-03-26 00:44:03 +00:00
steps:
2021-05-03 23:22:16 +00:00
- name: clone
image: cirrusci/flutter:dev
2021-05-03 23:22:16 +00:00
environment:
2021-05-04 00:09:49 +00:00
buildbot_key_b64:
from_secret: buildbot_key_b64
2021-05-03 23:22:16 +00:00
commands:
- mkdir ~/.ssh
- echo $buildbot_key_b64 > ~/.ssh/id_rsa.b64
2021-05-04 00:11:09 +00:00
- base64 -d ~/.ssh/id_rsa.b64 > ~/.ssh/id_rsa
- chmod 400 ~/.ssh/id_rsa
# force by pass of ssh host key check, less secure
2021-05-04 00:44:03 +00:00
- ssh-keyscan -H git.openprivacy.ca >> ~/.ssh/known_hosts
2021-05-03 23:22:16 +00:00
- git clone gogs@git.openprivacy.ca:flutter/flutter_app.git .
- git checkout $DRONE_COMMIT
2021-03-26 00:44:03 +00:00
- name: fetch
2021-03-26 23:10:48 +00:00
image: cirrusci/flutter:dev
2021-03-27 00:10:37 +00:00
volumes:
- name: deps
path: /root/.pub-cache
2021-03-26 00:44:03 +00:00
commands:
- wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/tor
- wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/torrc
- chmod a+x tor
- echo `git describe --tags` > VERSION
- echo `date +%G-%m-%d-%H-%M` > BUILDDATE
2021-03-27 00:02:13 +00:00
- flutter pub get
2021-03-27 01:00:43 +00:00
- mkdir deploy
2021-04-28 21:10:45 +00:00
- ./fetch-libcwtch-go.sh
2021-03-26 00:44:03 +00:00
#- name: quality
# image: golang
# volumes:
# - name: deps
# path: /go
# commands:
# - go list ./... | xargs go vet
# - go list ./... | xargs golint
# #Todo: fix all the lint errors and add `-set_exit_status` above to enforce linting
- name: build-linux
image: openpriv/flutter-desktop:linux-dev
2021-03-27 00:10:37 +00:00
volumes:
- name: deps
path: /root/.pub-cache
2021-03-26 00:44:03 +00:00
commands:
- flutter build linux --dart-define BUILD_VER=`cat VERSION` --dart-define BUILD_DATE=`cat BUILDDATE`
- mkdir deploy/linux
- cp -r build/linux/x64/release/bundle/* deploy/linux
2021-05-19 23:08:16 +00:00
- cp linux/cwtch.desktop deploy/linux
- cp linux/cwtch.png deploy/linux
2021-05-19 23:09:39 +00:00
- cp linux/libCwtch.so deploy/linux/lib/
# should not be needed, should be in data/flutter_assets and work from there
#- cp /sdks/flutter/bin/cache/artifacts/engine/linux-x64/icudtl.dat deploy/linux
2021-06-01 20:29:45 +00:00
- cp tor deploy/linux
- cd deploy
- mv linux cwtch
2021-05-31 22:46:58 +00:00
- tar -czf cwtch-`cat ../VERSION`.tar.gz cwtch
- rm -r cwtch
2021-03-26 00:44:03 +00:00
- name: build-android
2021-03-26 23:10:48 +00:00
image: cirrusci/flutter:dev
2021-05-08 00:15:53 +00:00
when:
event: push
environment:
2021-05-08 15:32:57 +00:00
upload_jks_file_b64:
from_secret: upload_jks_file_b64
2021-05-08 00:15:53 +00:00
upload_jks_pass:
from_secret: upload_jks_pass
2021-03-27 00:10:37 +00:00
volumes:
- name: deps
path: /root/.pub-cache
2021-03-26 00:44:03 +00:00
commands:
2021-05-08 15:32:57 +00:00
- echo $upload_jks_file_b64 > upload-keystore.jks.b64
2021-05-08 16:13:28 +00:00
- base64 -i --decode upload-keystore.jks.b64 > android/app/upload-keystore.jks
2021-05-08 00:15:53 +00:00
- sed -i "s/%jks-password%/$upload_jks_pass/g" android/key.properties
- flutter build appbundle --dart-define BUILD_VER=`cat VERSION` --dart-define BUILD_DATE=`cat BUILDDATE`
2021-05-06 19:42:27 +00:00
# cant do debug for final release, this is just a stop gap
- flutter build apk --dart-define BUILD_VER=`cat VERSION` --dart-define BUILD_DATE=`cat BUILDDATE`
# or build apk --split-per-abi ?
- cp build/app/outputs/bundle/release/app-release.aab deploy/
- cp build/app/outputs/apk/release/app-release.apk deploy/
2021-05-11 00:39:02 +00:00
#- cp build/app/outputs/flutter-apk/app-debug.apk deploy/android
2021-03-26 00:44:03 +00:00
2021-03-30 19:21:54 +00:00
- name: widget-tests
image: cirrusci/flutter:dev
volumes:
- name: deps
path: /root/.pub-cache
commands:
# - flutter config --enable-linux-desktop
2021-03-30 19:21:54 +00:00
- flutter test --coverage
- genhtml coverage/lcov.info -o coverage/html
2021-03-26 20:15:15 +00:00
# Todo: gonna need more work on container
# https://flutter.dev/desktop
# requirements: Visual Studio 2019 (not to be confused with Visual Studio Code) with the “Desktop development with C++” workload installed, including all of its default components
#- name: build-windows
2021-03-26 23:10:48 +00:00
# image: cirrusci/flutter:dev
2021-03-27 00:10:37 +00:00
#- volumes:
# - name: deps
# path: /root/.pub-cache
2021-03-26 20:15:15 +00:00
# commands:
# - flutter config --enable-windows-desktop
# - flutter build windows
2021-03-26 00:44:03 +00:00
- name: deploy-buildfiles
image: kroniak/ssh-client
environment:
BUILDFILES_KEY:
from_secret: buildfiles_key
secrets: [gogs_account_token]
when:
event: push
status: [ success ]
commands:
- echo $BUILDFILES_KEY > ~/id_rsab64
- base64 -d ~/id_rsab64 > ~/id_rsa
- chmod 400 ~/id_rsa
2021-03-27 01:00:43 +00:00
- export DIR=flwtch-`cat VERSION`-`cat BUILDDATE`
- mv deploy $DIR
2021-03-30 19:21:54 +00:00
- cp -r coverage/html $DIR/coverage-tests
2021-03-30 19:48:00 +00:00
- cp -r test/failures $DIR/test-failures || true
2021-03-26 00:44:03 +00:00
- cd $DIR
2021-03-27 01:00:43 +00:00
- find . -type f -exec sha256sum {} \; > ./../sha256s.txt
- mv ./../sha256s.txt .
2021-03-26 00:44:03 +00:00
- cd ..
# TODO: do deployment once files actaully compile
2021-03-27 01:00:43 +00:00
- scp -r -o StrictHostKeyChecking=no -i ~/id_rsa $DIR buildfiles@openprivacy.ca:/home/buildfiles/buildfiles/
2021-03-26 00:44:03 +00:00
- name: notify-email
image: drillster/drone-email
2021-03-30 21:11:48 +00:00
settings:
host: build.openprivacy.ca
port: 25
skip_verify: true
from: drone@openprivacy.ca
2021-03-26 00:44:03 +00:00
when:
status: [ failure ]
- name: notify-gogs
image: openpriv/drone-gogs
when:
event: pull_request
status: [ success, changed, failure ]
2021-03-26 19:50:26 +00:00
environment:
GOGS_ACCOUNT_TOKEN:
from_secret: gogs_account_token
settings:
gogs_url: https://git.openprivacy.ca
2021-03-26 00:44:03 +00:00
2021-03-27 00:10:37 +00:00
volumes:
- name: deps
temp: {}
2021-03-26 00:44:03 +00:00
trigger:
2021-03-26 19:50:26 +00:00
repo: flutter/flutter_app
2021-03-26 00:44:03 +00:00
branch: trunk
event:
- push
- pull_request
2021-04-13 20:23:18 +00:00
2021-04-21 00:28:22 +00:00
---
kind: pipeline
type: docker
2021-04-13 20:23:18 +00:00
name: windows
platform:
os: windows
#arch: amd64
version: 1809
2021-04-13 20:23:18 +00:00
clone:
disable: true
2021-04-13 20:23:18 +00:00
steps:
- name: clone
2021-06-01 18:38:17 +00:00
image: openpriv/flutter-desktop:windows-sdk30-fdev2.3rc
2021-05-06 21:46:28 +00:00
environment:
buildbot_key_b64:
from_secret: buildbot_key_b64
commands:
2021-05-06 22:16:30 +00:00
#- # force by pass of ssh host key check, less secure
#- ssh-keyscan -H git.openprivacy.ca >> ..\known_hosts
2021-05-06 21:51:14 +00:00
- echo $Env:buildbot_key_b64 > ..\id_rsa.b64
2021-05-06 21:47:06 +00:00
- certutil -decode ..\id_rsa.b64 ..\id_rsa
2021-05-06 21:51:14 +00:00
- git init
2021-05-06 22:16:30 +00:00
# -o UserKnownHostsFile=../known_hosts
- git config core.sshCommand 'ssh -o StrictHostKeyChecking=no -i ../id_rsa'
2021-05-06 21:51:14 +00:00
- git remote add origin gogs@git.openprivacy.ca:flutter/flutter_app.git
2021-05-06 22:03:59 +00:00
- git pull origin trunk
2021-05-06 22:41:08 +00:00
- git fetch --tags
- git checkout $DRONE_COMMIT
2021-04-13 20:23:18 +00:00
- name: fetch
2021-06-01 18:38:17 +00:00
image: openpriv/flutter-desktop:windows-sdk30-fdev2.3rc
2021-04-13 20:27:15 +00:00
commands:
- powershell -command "Invoke-WebRequest -Uri https://www.torproject.org/dist/torbrowser/10.0.16/tor-win32-0.4.5.7.zip -OutFile tor.zip"
2021-05-12 21:41:49 +00:00
- powershell -command "if ((Get-FileHash tor.zip -Algorithm sha512).Hash -ne '2b7d683f036d0fec149f1d2bdfcf5b7ef4c337005a2b685c056b00047fdb2b57d4c25b8559ad7ef5c7a030b273934be82a9f83ef6e391f5d7d13d8d6c83e8048' ) { Write-Error 'tor.zip sha512sum mismatch' }"
2021-05-06 22:32:02 +00:00
- git describe --tags > VERSION
- powershell -command "Get-Date -Format 'yyyy-MM-dd-HH-mm'" > BUILDDATE
- .\fetch-libcwtch-go.ps1
2021-05-13 16:03:08 +00:00
-
2021-04-13 20:23:18 +00:00
- name: build-windows
2021-06-01 18:38:17 +00:00
image: openpriv/flutter-desktop:windows-sdk30-fdev2.3rc
2021-04-13 20:27:15 +00:00
commands:
- flutter pub get
2021-04-20 22:07:37 +00:00
# flwtch-`cat VERSION`-`cat BUILDDATE`
2021-05-12 22:23:39 +00:00
- $Env:buildname = 'flwtch-win-'
- $Env:version += type .\VERSION
- $Env:buildname += $Env:version
2021-05-12 22:23:39 +00:00
- $Env:buildname += '-'
- $Env:builddate += type .\BUILDDATE
- $Env:buildname += $Env:builddate
2021-05-12 22:23:39 +00:00
- $Env:builddir += $Env:buildname
2021-05-31 22:45:23 +00:00
- $Env:zip = 'cwtch-'
- $Env:zip += $Env:version
- $Env:zip += '.zip'
2021-05-12 23:30:22 +00:00
- $Env:sha = $Env:zip
- $Env:sha += '.sha512'
- flutter build windows --dart-define BUILD_VER=$Env:version --dart-define BUILD_DATE=$Env:builddate
2021-04-14 00:13:00 +00:00
- mkdir deploy
- move build\\windows\\runner\\Release $Env:builddir
2021-05-13 00:25:29 +00:00
- copy windows\libCwtch.dll $Env:builddir
# flutter hasn't worked out it's packaging of required dll's so we have to resort to this manual nonsense
# https://github.com/google/flutter-desktop-embedding/issues/587
# https://github.com/flutter/flutter/issues/53167
- copy C:\BuildTools\VC\Redist\MSVC\14.29.30036\x64\Microsoft.VC142.CRT\vcruntime140.dll $Env:builddir
- copy C:\BuildTools\VC\Redist\MSVC\14.29.30036\x64\Microsoft.VC142.CRT\vcruntime140_1.dll $Env:builddir
- copy C:\BuildTools\VC\Redist\MSVC\14.29.30036\x64\Microsoft.VC142.CRT\msvcp140.dll $Env:builddir
- powershell -command "Expand-Archive -Path tor.zip -DestinationPath $Env:builddir\Tor"
2021-05-12 22:42:04 +00:00
- powershell -command "Compress-Archive -Path $Env:builddir -DestinationPath $Env:zip"
2021-05-12 23:39:58 +00:00
- powershell -command "(Get-FileHash *.zip -Algorithm sha512).Hash" > $Env:sha
2021-05-12 23:30:22 +00:00
- mkdir deploy\$Env:builddir
- move $Env:zip deploy\$Env:builddir
- move $Env:sha deploy\$Env:builddir
2021-05-13 16:03:08 +00:00
2021-04-20 22:07:37 +00:00
- name: deploy-windows
2021-06-01 18:38:17 +00:00
image: openpriv/flutter-desktop:windows-sdk30-fdev2.3rc
when:
2021-04-20 22:07:37 +00:00
event: push
status: [ success ]
environment:
BUILDFILES_KEY:
from_secret: buildfiles_key
commands:
- echo $Env:BUILDFILES_KEY > id_rsab64
- certutil -decode id_rsab64 id_rsa
- scp -r -o StrictHostKeyChecking=no -i id_rsa deploy\\* buildfiles@openprivacy.ca:/home/buildfiles/buildfiles/
2021-04-13 20:23:18 +00:00
trigger:
repo: flutter/flutter_app
branch: trunk
event:
- push