Skip to content

Commit

Permalink
Set up CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-amisha-i authored Mar 5, 2024
1 parent 86696fb commit 8c79e9d
Show file tree
Hide file tree
Showing 26 changed files with 755 additions and 244 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build

on: push

jobs:
build:
runs-on: macos-13

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- name: Set Xcode Version
run: |
sudo xcode-select -switch /Applications/Xcode_15.2.app
- name: Display Xcode Version
run: /usr/bin/xcodebuild -version

- name: Cache DerivedData
uses: actions/cache@v2
with:
path: |
DerivedData
key: ${{ runner.os }}-derived-data-${{ hashFiles('**/*.xcworkspace') }}
restore-keys: |
${{ runner.os }}-derived-data-
- name: Cache CocoaPods
uses: actions/cache@v2
with:
path: |
Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install CocoaPods
run: |
if [ -f "Podfile.lock" ] && [ -f "${{ runner.workspace }}/Podfile.lock" ] && cmp -s Podfile.lock "${{ runner.workspace }}/Podfile.lock"; then
echo "Podfile.lock unchanged. Skipping pod installs."
else
gem install cocoapods
pod install --repo-update
fi
- name: Run SwiftLint
run: |
if git diff --name-only ${{ github.sha }} | grep -q '\.swift$'; then
Pods/SwiftLint/swiftlint Splito
else
echo "No Swift files changed. Skipping SwiftLint."
fi
- name: Build Project
run: |
xcodebuild -workspace Splito.xcworkspace -scheme "Splito" clean build -sdk iphoneos CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED="NO" -destination generic/platform=iOS OTHER_CFLAGS="-Wno-deprecated-builtins" | xcpretty --color
101 changes: 101 additions & 0 deletions .github/workflows/Deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Deploy

on:
push:
branches:
- main

jobs:
deploy:
runs-on: macos-13

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- name: Set Xcode Version
run: |
sudo xcode-select -switch /Applications/Xcode_15.2.app
- name: Display Xcode Version
run: /usr/bin/xcodebuild -version

# - name: Install Apple Certificate and Provisioning Profile
# run: |
# chmod +x install_dist_certs.sh && ./install_dist_certs.sh
# chmod +x install_dist_profile.sh && ./install_dist_profile.sh

# - name: Cache DerivedData
# uses: actions/cache@v2
# with:
# path: |
# DerivedData
# key: ${{ runner.os }}-derived-data-${{ hashFiles('**/*.xcworkspace') }}
# restore-keys: |
# ${{ runner.os }}-derived-data-

# - name: Cache CocoaPods
# uses: actions/cache@v2
# with:
# path: |
# Pods
# key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
# restore-keys: |
# ${{ runner.os }}-pods-

# - name: Install CocoaPods
# run: |
# if [ -f "Podfile.lock" ] && [ -f "${{ runner.workspace }}/Podfile.lock" ] && cmp -s Podfile.lock "${{ runner.workspace }}/Podfile.lock"; then
# echo "Podfile.lock unchanged. Skipping pod installs."
# else
# gem install cocoapods
# pod install --repo-update
# fi

# - name: Run SwiftLint
# run: |
# if git diff --name-only ${{ github.sha }} | grep -q '\.swift$'; then
# Pods/SwiftLint/swiftlint Splito
# else
# echo "No Swift files changed. Skipping SwiftLint."
# fi

# - name: Get Build Version
# run: |
# file='Splito/VERSION'
# fileData=`cat $file`
# IFS='.'
# read -a versionValue <<< "$fileData"
# buildNumber=$(expr `expr ${versionValue[0]} \* 1000000` + `expr ${versionValue[1]} \* 10000` + ${CI_PIPELINE_IID})
# IFS=''
# buildName="${versionValue[0]}.${versionValue[1]}.$CI_PIPELINE_IID"
# echo "Uploading build $buildName"

# - name: Build and Archive Project
# run: |
# ARCHIVE_PATH="$HOME/Library/Developer/Xcode/Archives/Splito/${CI_COMMIT_SHA}/${CI_JOB_ID}.xcarchive"
# xcodebuild app_version_code=${buildNumber} app_version_name=${buildName} -workspace Splito.xcworkspace -scheme "Splito" clean archive -sdk iphoneos -archivePath $ARCHIVE_PATH | xcpretty --color

# - name: Export Archive
# run: |
# EXPORT_PATH="$HOME/Library/Developer/Xcode/Archives/Splito/${CI_COMMIT_SHA}/${CI_JOB_ID}"
# xcodebuild -exportArchive -archivePath $ARCHIVE_PATH -exportPath $EXPORT_PATH -exportOptionsPlist ExportOptions.plist | xcpretty --color

# - name: Store IPA
# run: |
# echo "Collecting artifacts.."
# cp -R "${ARCHIVE_PATH}/dSYMs" .
# IPA="${EXPORT_PATH}Splito.ipa"
# echo $IPA

# - name: Deploy to App Store Connect
# run: |
# rm -rf $ARCHIVE_PATH
# rm -rf $EXPORT_PATH
# echo "Uploading app to iTC..."
# xcrun altool --upload-app -t ios -f $IPA -u $ITC_USER_NAME -p $ITC_USER_PASSWORD
28 changes: 0 additions & 28 deletions .github/workflows/build.yml

This file was deleted.

13 changes: 8 additions & 5 deletions BaseStyle/BaseStyle.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@
buildPhases = (
15E144B950823D0362E9BB2B /* [CP] Check Pods Manifest.lock */,
D8D42A382B85CC85009B345D /* Headers */,
D8D42A882B85D322009B345D /* Swiftlint */,
D8D42A392B85CC85009B345D /* Sources */,
D8D42A882B85D322009B345D /* Swiftlint */,
D8D42A3A2B85CC85009B345D /* Frameworks */,
D8D42A3B2B85CC85009B345D /* Resources */,
);
Expand Down Expand Up @@ -456,6 +456,7 @@
};
D8D42A882B85D322009B345D /* Swiftlint */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down Expand Up @@ -651,10 +652,10 @@
baseConfigurationReference = E0B1A6930B9FF35E9142463B /* Pods-BaseStyle.debug.xcconfig */;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = S985H2T7J8;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -675,6 +676,7 @@
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20";
PRODUCT_BUNDLE_IDENTIFIER = com.canopas.splito.BaseStyle;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -688,10 +690,10 @@
baseConfigurationReference = 2CE85328C46B183FC3F074A3 /* Pods-BaseStyle.release.xcconfig */;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = S985H2T7J8;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -712,6 +714,7 @@
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20";
PRODUCT_BUNDLE_IDENTIFIER = com.canopas.splito.BaseStyle;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
Expand Down
15 changes: 15 additions & 0 deletions Data/.swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
disabled_rules: # rule identifiers to exclude from running
- nesting
- type_name
- force_cast
- line_length
- large_tuple
- identifier_name
- type_body_length
- function_body_length
- orphaned_doc_comment
- void_function_in_ternary

file_length:
warning: 400
error: 500
Loading

0 comments on commit 8c79e9d

Please sign in to comment.