Skip to content
This repository has been archived by the owner on Dec 3, 2021. It is now read-only.

Commit

Permalink
feat: Add Fastlane (Alpha)
Browse files Browse the repository at this point in the history
  • Loading branch information
aoudiamoncef committed May 6, 2018
1 parent eb244b0 commit 0ff0d11
Show file tree
Hide file tree
Showing 11 changed files with 223 additions and 23 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,9 @@ configuration\.tar
\.idea/caches/build_file_checksums\.ser

\.idea/caches/

play_store_credentials\.json

fastlane/README\.md

fastlane/report\.xml
13 changes: 7 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ before_install:
- mkdir "$ANDROID_HOME/licenses" || true
- echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
- echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
- openssl aes-256-cbc -K $encrypted_8906d6504312_key -iv $encrypted_8906d6504312_iv -in configuration.tar.enc -out configuration.tar -d
- openssl aes-256-cbc -K $encrypted_3fe6ca7ef0d3_key -iv $encrypted_3fe6ca7ef0d3_iv -in configuration.tar.enc -out configuration.tar -d
- tar xvf configuration.tar
- mv ${TRAVIS_BUILD_DIR}/google-services.json ${TRAVIS_BUILD_DIR}/app/google-services.json
- cp local.properties.ci local.properties
- ls -all
- source scripts/writeEnvVariables.sh && copyEnvVarsToManifest && copyEnvVarsToSigningProperties
- source scripts/writeEnvVariables.sh && copyEnvVarsToManifest && copyEnvVarsToSigningProperties && copyEnvVarsToFastlaneConfiguration
- docker pull influxdb
- docker run --name=influxdb -d -p 127.0.0.1:8086:8086 influxdb
- docker ps -a
Expand All @@ -50,15 +50,16 @@ script:
- curl -i -XPOST http://127.0.0.1:8086/query --data-urlencode "q=CREATE DATABASE test"
- ./gradlew clean test build
before_deploy:
- bundle install && bundle update fastlane
- cd app/build/outputs/apk/release
- jarsigner -verbose -tsa http://timestamp.comodoca.com/rfc3161 -sigalg SHA1withRSA -digestalg SHA1 -keystore ${TRAVIS_BUILD_DIR}/ApollineKeystore.jks -storepass $STORE_PASSWORD -keypass $KEY_PASSWORD app-release-unsigned.apk $KEY_ALIAS
- jarsigner -verify app-release-unsigned.apk
- ${ANDROID_HOME}/build-tools/${ANDROID_BUILD_TOOLS}/zipalign -v 4 app-release-unsigned.apk Apolline.apk
- ls -all
- bundle exec fastlane supply --apk Apolline*.apk
- mv Apolline*.apk Apolline.apk
deploy:
provider: releases
skip_cleanup: true
file: Apolline.apk
api_key: $GH_TOKEN
on:
repo: Apolline-Lille/apolline-android
tags: true
tags: true
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gem "fastlane"
152 changes: 152 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.0)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
atomos (0.1.2)
babosa (1.0.2)
claide (1.0.2)
colored (1.2)
colored2 (3.1.2)
commander-fastlane (4.4.6)
highline (~> 1.7.2)
declarative (0.0.10)
declarative-option (0.1.0)
domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0)
dotenv (2.4.0)
emoji_regex (0.1.1)
excon (0.62.0)
faraday (0.15.0)
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.1)
fastlane (2.93.1)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.3, < 3.0.0)
babosa (>= 1.0.2, < 2.0.0)
bundler (>= 1.12.0, < 2.0.0)
colored
commander-fastlane (>= 4.4.6, < 5.0.0)
dotenv (>= 2.1.1, < 3.0.0)
emoji_regex (~> 0.1)
excon (>= 0.45.0, < 1.0.0)
faraday (~> 0.9)
faraday-cookie_jar (~> 0.0.6)
faraday_middleware (~> 0.9)
fastimage (>= 2.1.0, < 3.0.0)
gh_inspector (>= 1.1.2, < 2.0.0)
google-api-client (>= 0.13.1, < 0.14.0)
highline (>= 1.7.2, < 2.0.0)
json (< 3.0.0)
mini_magick (~> 4.5.1)
multi_json
multi_xml (~> 0.5)
multipart-post (~> 2.0.0)
plist (>= 3.1.0, < 4.0.0)
public_suffix (~> 2.0.0)
rubyzip (>= 1.1.0, < 2.0.0)
security (= 0.1.3)
simctl (~> 1.6.3)
slack-notifier (>= 2.0.0, < 3.0.0)
terminal-notifier (>= 1.6.2, < 2.0.0)
terminal-table (>= 1.4.5, < 2.0.0)
tty-screen (>= 0.6.3, < 1.0.0)
tty-spinner (>= 0.8.0, < 1.0.0)
word_wrap (~> 1.0.0)
xcodeproj (>= 1.5.7, < 2.0.0)
xcpretty (>= 0.2.4, < 1.0.0)
xcpretty-travis-formatter (>= 0.0.3)
gh_inspector (1.1.3)
google-api-client (0.13.6)
addressable (~> 2.5, >= 2.5.1)
googleauth (~> 0.5)
httpclient (>= 2.8.1, < 3.0)
mime-types (~> 3.0)
representable (~> 3.0)
retriable (>= 2.0, < 4.0)
googleauth (0.6.2)
faraday (~> 0.12)
jwt (>= 1.4, < 3.0)
logging (~> 2.0)
memoist (~> 0.12)
multi_json (~> 1.11)
os (~> 0.9)
signet (~> 0.7)
highline (1.7.10)
http-cookie (1.0.3)
domain_name (~> 0.5)
httpclient (2.8.3)
json (2.1.0)
jwt (2.1.0)
little-plugger (1.1.4)
logging (2.2.2)
little-plugger (~> 1.1)
multi_json (~> 1.10)
memoist (0.16.0)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_magick (4.5.1)
multi_json (1.13.1)
multi_xml (0.6.0)
multipart-post (2.0.0)
nanaimo (0.2.5)
naturally (2.1.0)
os (0.9.6)
plist (3.4.0)
public_suffix (2.0.5)
representable (3.0.4)
declarative (< 0.1.0)
declarative-option (< 0.2.0)
uber (< 0.2.0)
retriable (3.1.1)
rouge (2.0.7)
rubyzip (1.2.1)
security (0.1.3)
signet (0.8.1)
addressable (~> 2.3)
faraday (~> 0.9)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
simctl (1.6.4)
CFPropertyList
naturally
slack-notifier (2.3.2)
terminal-notifier (1.8.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
tty-cursor (0.5.0)
tty-screen (0.6.4)
tty-spinner (0.8.0)
tty-cursor (>= 0.5.0)
uber (0.1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
unicode-display_width (1.3.2)
word_wrap (1.0.0)
xcodeproj (1.5.7)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.2)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.2.4)
xcpretty (0.2.8)
rouge (~> 2.0.7)
xcpretty-travis-formatter (1.0.0)
xcpretty (~> 0.2, >= 0.0.7)

PLATFORMS
ruby

DEPENDENCIES
fastlane

BUNDLED WITH
1.16.1
8 changes: 8 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

signingConfig signingConfigs.release

android.applicationVariants.all { variant ->
variant.outputs.all {
def date = new Date()
def formattedDate = date.format('dd-MM-yyyy')
outputFileName = "Apolline-${variant.versionName}-${formattedDate}.apk"
}
}
}

}
Expand Down
15 changes: 2 additions & 13 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />


<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
Expand Down Expand Up @@ -49,26 +48,16 @@
android:hardwareAccelerated="true"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>


<meta-data
android:name="io.fabric.ApiKey"
android:value="${fabric_api_key}" />

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
android:value="${fabric_api_key}"/>

<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="${google_map_api_key}" />


<meta-data
android:name="firebase_performance_logcat_enabled"
android:value="true" />
Expand Down Expand Up @@ -106,4 +95,4 @@
</activity>
</application>

</manifest>
</manifest>
Binary file modified configuration.tar.enc
Binary file not shown.
2 changes: 2 additions & 0 deletions fastlane/Appfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
json_key_file("${secret_credentials}")
package_name("science.apolline")
34 changes: 34 additions & 0 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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
#

# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane

default_platform(:android)

platform :android do
desc "Runs all the tests"
lane :test do
gradle(task: "test")
end

desc "Submit a new Beta Build to Crashlytics Beta"
lane :beta do
gradle(task: "clean assembleRelease")
crashlytics

# sh "your_script.sh"
# You can also use other beta testing services here
end

desc "Deploy a new version to the Google Play"
lane :deploy do
gradle(task: "clean assembleRelease")
upload_to_play_store
end
end
2 changes: 1 addition & 1 deletion keystore.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
storePassword=myStorePassword
keyPassword=mykeyPassword
keyPassword=myKeyPassword
keyAlias=myKeyAlias
storeFile=myStoreFile
11 changes: 8 additions & 3 deletions scripts/writeEnvVariables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

function copyEnvVarsToManifest {
ANDROID_MANIFEST=${TRAVIS_BUILD_DIR}"/app/src/main/AndroidManifest.xml"

export ANDROID_MANIFEST
echo "AndroidManifest should exist at $ANDROID_MANIFEST"
sed -i -e "s/\"\${google_map_api_key}\"/"\"$GOOGLE_MAP_API_KEY\""/g" $ANDROID_MANIFEST
Expand All @@ -11,11 +10,17 @@ function copyEnvVarsToManifest {

function copyEnvVarsToSigningProperties {
KEYSTORE_AUTH=${TRAVIS_BUILD_DIR}"/keystore.properties"

export KEYSTORE_AUTH
echo "keystore.properties should exist at $KEYSTORE_AUTH"
sed -i -e "s/myStorePassword/"$STORE_PASSWORD"/g" $KEYSTORE_AUTH
sed -i -e "s/mykeyPassword/"$KEY_PASSWORD"/g" $KEYSTORE_AUTH
sed -i -e "s/myKeyPassword/"$KEY_PASSWORD"/g" $KEYSTORE_AUTH
sed -i -e "s/myKeyAlias/"$KEY_ALIAS"/g" $KEYSTORE_AUTH
sed -i -e "s_myStoreFile_"${TRAVIS_BUILD_DIR}/${STORE_FILE}"_g" $KEYSTORE_AUTH
}

function copyEnvVarsToFastlaneConfiguration {
FASTLANE_CREDENTIAL=${TRAVIS_BUILD_DIR}"/fastlane/Appfile"
export FASTLANE_CREDENTIAL
echo "Appfile should exist at $FASTLANE_CREDENTIAL"
sed -i -e "s/\"\${secret_credentials}\"/"\"$FASTLANE_FILE\""/g" $FASTLANE_CREDENTIAL
}

0 comments on commit 0ff0d11

Please sign in to comment.