Browse Source

Add jenkinsfile

Michael Kirk 10 months ago
parent
commit
2233d4c72c
6 changed files with 92 additions and 10 deletions
  1. 50 0
      Jenkinsfile
  2. 6 3
      Makefile
  3. 3 0
      fastlane/.gitignore
  4. 6 0
      fastlane/Appfile
  5. 27 0
      fastlane/Fastfile
  6. 0 7
      fastlane/Scanfile

+ 50 - 0
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}")
+                }
+            }
+        }
+
+        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}")
+                }
+            }
+        }
+    }
+}

+ 6 - 3
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) && \

+ 3 - 0
fastlane/.gitignore

@@ -1 +1,4 @@
+README.md
 test_output
+report.xml
+

+ 6 - 0
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

+ 27 - 0
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

+ 0 - 7
fastlane/Scanfile

@@ -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"]
-