diff --git a/.ruby-version b/.ruby-version index 437459cd9..e70b4523a 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.5.0 +2.6.0 diff --git a/Gemfile.lock b/Gemfile.lock index 1297e22dd..4ccf91405 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -52,21 +52,22 @@ GEM concurrent-ruby (1.1.3) declarative (0.0.10) declarative-option (0.1.0) + digest-crc (0.4.1) domain_name (0.5.20180417) unf (>= 0.0.5, < 1.0.0) dotenv (2.5.0) emoji_regex (0.1.1) escape (0.0.4) excon (0.62.0) - faraday (0.15.3) + faraday (0.15.4) multipart-post (>= 1.2, < 3) faraday-cookie_jar (0.0.6) faraday (>= 0.7.4) http-cookie (~> 1.0.0) faraday_middleware (0.12.2) faraday (>= 0.7.4, < 1.0) - fastimage (2.1.4) - fastlane (2.108.0) + fastimage (2.1.5) + fastlane (2.112.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.3, < 3.0.0) babosa (>= 1.0.2, < 2.0.0) @@ -82,6 +83,7 @@ GEM fastimage (>= 2.1.0, < 3.0.0) gh_inspector (>= 1.1.2, < 2.0.0) google-api-client (>= 0.21.2, < 0.24.0) + google-cloud-storage (>= 1.15.0, < 2.0.0) highline (>= 1.7.2, < 2.0.0) json (< 3.0.0) mini_magick (~> 4.5.1) @@ -113,6 +115,15 @@ GEM representable (~> 3.0) retriable (>= 2.0, < 4.0) signet (~> 0.9) + google-cloud-core (1.2.7) + google-cloud-env (~> 1.0) + google-cloud-env (1.0.5) + faraday (~> 0.11) + google-cloud-storage (1.15.0) + digest-crc (~> 0.4) + google-api-client (~> 0.23) + google-cloud-core (~> 1.2) + googleauth (~> 0.6.2) googleauth (0.6.7) faraday (~> 0.12) jwt (>= 1.4, < 3.0) @@ -143,7 +154,7 @@ GEM naturally (2.2.0) netrc (0.11.0) os (1.0.0) - plist (3.4.0) + plist (3.5.0) public_suffix (2.0.5) representable (3.0.4) declarative (< 0.1.0) @@ -169,15 +180,15 @@ GEM thread_safe (0.3.6) tty-cursor (0.6.0) tty-screen (0.6.5) - tty-spinner (0.8.0) - tty-cursor (>= 0.5.0) + tty-spinner (0.9.0) + tty-cursor (~> 0.6.0) tzinfo (1.2.5) thread_safe (~> 0.1) uber (0.1.0) unf (0.1.4) unf_ext unf_ext (0.0.7.5) - unicode-display_width (1.4.0) + unicode-display_width (1.4.1) word_wrap (1.0.0) xcodeproj (1.7.0) CFPropertyList (>= 2.3.3, < 4.0) @@ -198,4 +209,4 @@ DEPENDENCIES fastlane BUNDLED WITH - 1.16.6 + 1.17.2 diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..7ea1c2495 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,50 @@ +pipeline { + agent any + + environment { + LANG = "en_US.UTF-8" + LANGUAGE = "en_US.UTF-8" + LC_ALL = "en_US.UTF-8" + PATH = "PATH=$HOME/.rbenv/bin:$HOME/.rbenv/shims:/usr/local/bin/:$PATH" + } + + stages { + stage('env setup') { + steps { + sh 'make setup' + } + } + stage('build dependencies') { + steps { + sh 'make dependencies' + } + } + stage('test') { + steps { + ansiColor('xterm') { + sh 'make test' + } + } + } + } + + post { + success { + script { + // CHANGE_ID is set only for pull requests, so it is safe to access the pullRequest global variable + if (env.CHANGE_ID) { + def comment = pullRequest.comment("👍 Build PASSED commit: ${pullRequest.head}\nbuild: ${currentBuild.absoluteUrl}") + } + } + } + + failure { + script { + // CHANGE_ID is set only for pull requests, so it is safe to access the pullRequest global variable + if (env.CHANGE_ID) { + def comment = pullRequest.comment("💥 Build FAILED commit: ${pullRequest.head}\nbuild: ${currentBuild.absoluteUrl}") + } + } + } + } +} diff --git a/Makefile b/Makefile index 782a06539..a9a0e6163 100644 --- a/Makefile +++ b/Makefile @@ -10,12 +10,15 @@ XCODE_BUILD = xcrun xcodebuild -workspace $(SCHEME).xcworkspace -scheme $(SCHEME default: test -ci: dependencies test - update_dependencies: bundle exec pod update carthage update --platform iOS +setup: + rbenv install -s + gem install bundler + bundle install + dependencies: cd $(WORKING_DIR) && \ git submodule update --init @@ -27,7 +30,7 @@ build: dependencies $(XCODE_BUILD) build | xcpretty test: - bundle exec fastlane scan + bundle exec fastlane test clean: clean_carthage cd $(WORKING_DIR) && \ diff --git a/Signal/test/ViewControllers/ConversationViewItemTest.m b/Signal/test/ViewControllers/ConversationViewItemTest.m index 4dd0ca755..249837d8f 100644 --- a/Signal/test/ViewControllers/ConversationViewItemTest.m +++ b/Signal/test/ViewControllers/ConversationViewItemTest.m @@ -1,5 +1,5 @@ // -// Copyright (c) 2018 Open Whisper Systems. All rights reserved. +// Copyright (c) 2019 Open Whisper Systems. All rights reserved. // #import "ConversationViewItem.h" @@ -65,6 +65,7 @@ OWSAssertDebug([[NSFileManager defaultManager] fileExistsAtPath:filePath]); DataSource *dataSource = [DataSourcePath dataSourceWithFilePath:filePath shouldDeleteOnDeallocation:NO]; + dataSource.sourceFilename = filename; TSAttachmentStream *attachment = [AttachmentStreamFactory createWithContentType:mimeType dataSource:dataSource]; TSOutgoingMessage *message = diff --git a/SignalServiceKit/src/TestUtils/Factories.swift b/SignalServiceKit/src/TestUtils/Factories.swift index 34bb2cd19..256ac209b 100644 --- a/SignalServiceKit/src/TestUtils/Factories.swift +++ b/SignalServiceKit/src/TestUtils/Factories.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2018 Open Whisper Systems. All rights reserved. +// Copyright (c) 2019 Open Whisper Systems. All rights reserved. // import Foundation @@ -391,6 +391,7 @@ class AttachmentStreamFactory: NSObject, Factory { let factory = AttachmentStreamFactory() factory.contentTypeBuilder = { return contentType } factory.byteCountBuilder = { return UInt32(dataSource.dataLength()) } + factory.sourceFilenameBuilder = { return dataSource.sourceFilename ?? "fake-filename.dat" } let attachmentStream = factory.build(transaction: transaction) dataSource.write(toPath: attachmentStream.originalFilePath!) diff --git a/fastlane/.gitignore b/fastlane/.gitignore index 007b73ee6..54a42f915 100644 --- a/fastlane/.gitignore +++ b/fastlane/.gitignore @@ -1 +1,4 @@ +README.md test_output +report.xml + diff --git a/fastlane/Appfile b/fastlane/Appfile new file mode 100644 index 000000000..180306309 --- /dev/null +++ b/fastlane/Appfile @@ -0,0 +1,6 @@ +# app_identifier("[[APP_IDENTIFIER]]") # The bundle identifier of your app +# apple_id("[[APPLE_ID]]") # Your Apple email address + + +# For more information about the Appfile, see: +# https://docs.fastlane.tools/advanced/#appfile diff --git a/fastlane/Fastfile b/fastlane/Fastfile new file mode 100644 index 000000000..99a588575 --- /dev/null +++ b/fastlane/Fastfile @@ -0,0 +1,27 @@ +# This file contains the fastlane.tools configuration +# You can find the documentation at https://docs.fastlane.tools +# +# For a list of all available actions, check out +# +# https://docs.fastlane.tools/actions +# +# For a list of all available plugins, check out +# +# https://docs.fastlane.tools/plugins/available-plugins +# + +# Uncomment the line if you want fastlane to automatically update itself +# update_fastlane + +default_platform(:ios) + +platform :ios do + desc "Description of what the lane does" + lane :test do + run_tests( + workspace: "Signal.xcworkspace", + scheme: "Signal", + devices: ["iPhone SE"] + ) + end +end diff --git a/fastlane/Scanfile b/fastlane/Scanfile deleted file mode 100644 index a58da5440..000000000 --- a/fastlane/Scanfile +++ /dev/null @@ -1,7 +0,0 @@ -# For more information about this configuration visit -# https://github.com/fastlane/fastlane/tree/master/scan#scanfile - -workspace "Signal.xcworkspace" -scheme "Signal" -devices ["iPhone SE"] -