WIP: Add macOS builds for drone #15

Closed
JonasFranz wants to merge 25 commits from feature/drone-ios into master
8 changed files with 144 additions and 1 deletions

View File

@ -8,6 +8,16 @@ clone:
tags: true
pipeline:
upload_to_macos:
image: appleboy/drone-scp
host: home.jonasfranz.software
secrets: [ ssh_username, ssh_key ]
port: 2222
source: ./
target: /tmp/drone_build_${DRONE_BUILD_NUMBER}
when:
event: [ push, tag]
test:
image: nathansamson/flutter-builder-docker:v0.6.0
pull: true
@ -18,6 +28,7 @@ pipeline:
build:
image: nathansamson/flutter-builder-docker:v0.6.0
group: build
pull: true
commands:
- flutter packages get
@ -26,6 +37,32 @@ pipeline:
- mv build/app/outputs/apk/*/*/*.apk apks
when:
event: [ push, tag ]
build_ios:
image: appleboy/drone-ssh
group: build
host: home.jonasfranz.software
port: 2222
secrets: [ ssh_username, ssh_key ]
command_timeout: 900
script:
- source ~/.bash_profile
- export EXPANDED_CODE_SIGN_IDENTITY=""
- cd /tmp/drone_build_${DRONE_BUILD_NUMBER}/ios
- pod install
- cd ..
- flutter packages get
- make build-ios-all
when:
event: [ push, tag ]
download_ios_artifacts:
image: vikunja/scp
secrets: [ ssh_username, ssh_key ]
commands:
- echo $ssh_key | scp -P 2222 -i /dev/stdin ${ssh_username}@home.jonasfranz.software:/tmp/drone_build_${DRONE_BUILD_NUMBER}/build/ios/iphoneos/* apks/
when:
event: [ push, tag ]
# Push the releases to our pseudo-s3-bucket
release:
@ -55,3 +92,14 @@ pipeline:
when:
event: [ push ]
branch: [ master ]
clean_ios:
image: appleboy/drone-ssh
host: home.jonasfranz.software
port: 2222
secrets: [ ssh_username, ssh_key ]
script:
- rm -rf /tmp/drone_build_${DRONE_BUILD_NUMBER}
when:
status: [ failure, success ]
event: [ push, tag]

Binary file not shown.

View File

@ -0,0 +1,2 @@
#Sat Sep 15 16:48:22 CEST 2018
gradle.version=4.4

3
Dockerfile.scp Normal file
View File

@ -0,0 +1,3 @@
FROM alpine
RUN apk add --no-cache openssh-client
RUN mkdir ~/.ssh && ssh-keyscan -H home.jonasfranz.software -P 2222 >> ~/.ssh/known_hosts

View File

@ -28,3 +28,20 @@ build-debug:
.PHONY: build-profile
build-profile:
flutter build apk --profile --build-name=$(VERSION) --flavor unsigned
.PHONY: build-ios-all
build-ios-all: build-ios-release build-ios-debug build-ios-profile
.PHONY: build-ios-release
build-ios-release:
flutter build ios --release --build-name=$(VERSION) --no-codesign
.PHONY: build-ios-debug
build-ios-debug:
flutter build ios --debug --build-name=$(VERSION) --no-codesign
mv build/ios/iphoneos/Runner.app build/ios/iphoneos/Runner-debug.app
.PHONY: build-ios-profile
build-ios-profile:
flutter build ios --profile --build-name=$(VERSION) --no-codesign
mv build/ios/iphoneos/Runner.app build/ios/iphoneos/Runner-profile.app

65
ios/Podfile Normal file
View File

@ -0,0 +1,65 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
def parse_KV_file(file, separator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return [];
end
pods_ary = []
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) { |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
pods_ary.push({:name => podname, :path => podpath});
else
puts "Invalid plugin specification: #{line}"
end
}
return pods_ary
end
target 'Runner' do
use_frameworks!
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
# Flutter Pods
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
if generated_xcode_build_settings.empty?
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
end
generated_xcode_build_settings.map { |p|
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
symlink = File.join('.symlinks', 'flutter')
File.symlink(File.dirname(p[:path]), symlink)
pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
end
}
# Plugin Pods
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.map { |p|
symlink = File.join('.symlinks', 'plugins', p[:name])
File.symlink(p[:path], symlink)
pod p[:name], :path => File.join(symlink, 'ios')
}
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end

View File

@ -14,7 +14,7 @@
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>