diff --git a/.github/workflows/publish_ios.yml b/.github/workflows/publish_ios.yml index c4e9b20..fbd1cce 100644 --- a/.github/workflows/publish_ios.yml +++ b/.github/workflows/publish_ios.yml @@ -1,25 +1,62 @@ name: Publish-iOS -on: - push: - # Pattern matched against refs/tags - tags: - - "*" # Push events to every tag not containing / +on: workflow_dispatch jobs: publish-ios: runs-on: macos-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + toolchain: nightly-2023-10-13 + override: true + components: rustfmt, clippy + + - name: Install iOS target + run: > + rustup target add + aarch64-apple-ios + + - name: Add macOS rust std + run: > + rustup component add rust-src --toolchain nightly-2023-10-13-x86_64-apple-darwin + + - name: Build xcframework + working-directory: ./ios + run: b_ios.sh + + - name: Get last tag + run: | + git fetch --tags + LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) + echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV + echo "Latest git tag: $LATEST_TAG" + + - name: Zip + working-directory: ./ios + run: | + mkdir build + pushd framework + zip -r ../build/ezlog_${{ env.LATEST_TAG }}_xcframework.zip ezlog.xcframework + + - name: Upload xcframework + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ env.LATEST_TAG }} + name: apple:${{ env.LATEST_TAG }} + files: | + ./ios/build/* + - name: Install Cocoapods run: gem install cocoapods - name: Deploy to Cocoapods - run: | - set -eo pipefail - chmod +x ./publish_ios.sh - ./publish_ios.sh + # pod lib lint EZLog.podspec --verbose + run: pod trunk push EZLog.podspec --allow-warnings shell: bash env: COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} diff --git a/ios/EZLog.podspec b/EZLog.podspec similarity index 55% rename from ios/EZLog.podspec rename to EZLog.podspec index 34ae509..eda6b8d 100644 --- a/ios/EZLog.podspec +++ b/EZLog.podspec @@ -17,12 +17,28 @@ Pod::Spec.new do |s| DESC s.homepage = 'https://github.com/s1rius/ezlog' - s.license = { :type => 'MIT', :file => 'LICENSE' } + s.license = { :type => 'MIT', :file => 'LICENSE-MIT' } s.author = { 's1rius' => 's1rius.noone@gmail.com' } - s.source = { :git => 'https://github.com/s1rius/ezlog.git', :tag => s.version.to_s } + s.source = { :git => 'https://github.com/s1rius/ezlog.git', :tag => '0.2.0' } s.ios.deployment_target = '13.0' - + s.prepare_command = <<-CMD + if [ -d "./ios/framework/" ] && [ "$(find ./ios/framework/ -mindepth 1 -print -quit)" ]; then + echo "framework folder exists and is not empty, exit" + exit 0 + fi + echo "download framework from internet" + mkdir ./ios/build + curl -L -o ./ios/build/ezlog.xcframework.zip "https://github.com/s1rius/ezlog/releases/download/0.2.0/ezlog_0.2.0_xcframework.zip" + if [ -s "./ios/build/ezlog.xcframework.zip" ]; then + echo "unzip xcframework" + unzip -o ./ios/build/ezlog.xcframework.zip -d ./ios/framework + else + echo "xcframework build from source" + pushd ios + sh b_ios.sh + fi + CMD s.source_files = 'ios/EZLog/Sources/**/*' s.ios.vendored_frameworks = 'ios/framework/ezlog.xcframework' end diff --git a/bump.sh b/bump.sh index 2280765..6bc45f2 100755 --- a/bump.sh +++ b/bump.sh @@ -1,4 +1,6 @@ #!/bin/bash +# usage ./bump.sh 2.0.0 2.0.1 + set -e EXCLUDE_DIR='./target' diff --git a/ios/.gitignore b/ios/.gitignore index 394af2c..e969c0c 100644 --- a/ios/.gitignore +++ b/ios/.gitignore @@ -89,4 +89,6 @@ fastlane/test_output # https://github.com/johnno1962/injectionforxcode iOSInjectionProject/ -Pods/ \ No newline at end of file +Pods/ + +framework/ \ No newline at end of file diff --git a/ios/Podfile b/ios/Podfile index 69d0988..7e9735e 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -5,7 +5,7 @@ target 'demo' do # Comment the next line if you don't want to use dynamic frameworks use_frameworks! - # Pods for demo + platform :ios, '14.0' end @@ -13,7 +13,7 @@ target 'EZLog' do # Comment the next line if you don't want to use dynamic frameworks use_frameworks! - # Pods for ezlog + platform :ios, '13.0' end @@ -25,7 +25,7 @@ target 'benchmark' do # Pods for benchmark - pod 'Logan', '~> 1.2.7' + pod 'Logan', '~> 1.2.9' end diff --git a/ios/Podfile.lock b/ios/Podfile.lock index e21a4b8..2357114 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,18 +1,18 @@ PODS: - - Logan (1.2.7): - - Logan/mbedtls (= 1.2.7) - - Logan/mbedtls (1.2.7) + - Logan (1.2.9): + - Logan/mbedtls (= 1.2.9) + - Logan/mbedtls (1.2.9) DEPENDENCIES: - - Logan (~> 1.2.7) + - Logan (~> 1.2.9) SPEC REPOS: trunk: - Logan SPEC CHECKSUMS: - Logan: d7e508f88d596b186e9cdcc0cf35b45c89bbc22f + Logan: bbfd2c6d9b88d5048145f832751ef32052bfe530 -PODFILE CHECKSUM: b0d6f635dfe42a64aae58a146db3096d2e027e01 +PODFILE CHECKSUM: 200da04e775c91e5c5b67a8458f5cc9ce8980ca6 -COCOAPODS: 1.12.1 +COCOAPODS: 1.14.2 diff --git a/ios/framework/ezlog.xcframework/Info.plist b/ios/framework/ezlog.xcframework/Info.plist deleted file mode 100644 index fdc9180..0000000 --- a/ios/framework/ezlog.xcframework/Info.plist +++ /dev/null @@ -1,48 +0,0 @@ - - - - - AvailableLibraries - - - BinaryPath - libezlog.a - HeadersPath - Headers - LibraryIdentifier - ios-arm64_x86_64-simulator - LibraryPath - libezlog.a - SupportedArchitectures - - arm64 - x86_64 - - SupportedPlatform - ios - SupportedPlatformVariant - simulator - - - BinaryPath - libezlog.a - HeadersPath - Headers - LibraryIdentifier - ios-arm64 - LibraryPath - libezlog.a - SupportedArchitectures - - arm64 - - SupportedPlatform - ios - - - CFBundlePackageType - XFWK - XCFrameworkFormatVersion - 1.0 - - diff --git a/ios/framework/ezlog.xcframework/ios-arm64/Headers b/ios/framework/ezlog.xcframework/ios-arm64/Headers deleted file mode 100644 index 4ae7ced..0000000 --- a/ios/framework/ezlog.xcframework/ios-arm64/Headers +++ /dev/null @@ -1,86 +0,0 @@ -#include -#include -#include -#include - -/** - * map to c Callback stuct - */ -typedef struct Callback { - const void* _Nonnull successPoint; - const void(* _Nonnull onLogsFetchSuccess)(void* _Nonnull, - const char* _Nonnull, - const char* _Nonnull, - const int8_t* _Nonnull const* _Nonnull, - int32_t); - const void* _Nonnull failPoint; - const void (* _Nonnull onLogsFetchFail)(void* _Nonnull, - const char* _Nonnull, - const char* _Nonnull, - const char* _Nonnull); -} Callback; - -/** - * Init ezlog, must call before any other function - */ -void ezlog_init(bool enable_trace); - -/** - * Flush target log which name is `c_log_name` - */ -void ezlog_flush(const char * _Nonnull c_log_name); - -/** - * Flush all logger - */ -void ezlog_flush_all(void); - -/** - * Create a new log wtih config options - */ -void ezlog_create_log(const char * _Nonnull c_log_name, - unsigned char c_level, - const char * _Nonnull c_dir_path, - unsigned int c_keep_days, - unsigned char c_compress, - unsigned char c_compress_level, - unsigned char c_cipher, - const unsigned char * _Nonnull c_cipher_key, - uintptr_t c_key_len, - const unsigned char * _Nonnull c_cipher_nonce, - uintptr_t c_nonce_len, - unsigned int c_rotate_duration, - const char * _Nonnull c_extra - -); - -/** - * Write log to file - */ -void ezlog_log(const char * _Nonnull c_log_name, - unsigned char c_level, - const char * _Nonnull c_target, - const char * _Nonnull c_content); - -/** - * Trim out of date log files - */ -void ezlog_trim(void); - -/** - * Register callback function for get logger's file path asynchronously - */ -void ezlog_register_callback(struct Callback callback); - -/** - * Request logger's files path array by specified date - * before call this function, you should register a callback - * call - * - * ```swift - * ezlog_register_callback(callback); - * ``` - */ -void ezlog_request_log_files_for_date(const char * _Nonnull c_log_name, - int64_t c_start_time, - int64_t c_end_time); diff --git a/ios/framework/ezlog.xcframework/ios-arm64/libezlog.a b/ios/framework/ezlog.xcframework/ios-arm64/libezlog.a deleted file mode 100644 index 51f2857..0000000 Binary files a/ios/framework/ezlog.xcframework/ios-arm64/libezlog.a and /dev/null differ diff --git a/ios/framework/ezlog.xcframework/ios-arm64_x86_64-simulator/Headers b/ios/framework/ezlog.xcframework/ios-arm64_x86_64-simulator/Headers deleted file mode 100644 index 4ae7ced..0000000 --- a/ios/framework/ezlog.xcframework/ios-arm64_x86_64-simulator/Headers +++ /dev/null @@ -1,86 +0,0 @@ -#include -#include -#include -#include - -/** - * map to c Callback stuct - */ -typedef struct Callback { - const void* _Nonnull successPoint; - const void(* _Nonnull onLogsFetchSuccess)(void* _Nonnull, - const char* _Nonnull, - const char* _Nonnull, - const int8_t* _Nonnull const* _Nonnull, - int32_t); - const void* _Nonnull failPoint; - const void (* _Nonnull onLogsFetchFail)(void* _Nonnull, - const char* _Nonnull, - const char* _Nonnull, - const char* _Nonnull); -} Callback; - -/** - * Init ezlog, must call before any other function - */ -void ezlog_init(bool enable_trace); - -/** - * Flush target log which name is `c_log_name` - */ -void ezlog_flush(const char * _Nonnull c_log_name); - -/** - * Flush all logger - */ -void ezlog_flush_all(void); - -/** - * Create a new log wtih config options - */ -void ezlog_create_log(const char * _Nonnull c_log_name, - unsigned char c_level, - const char * _Nonnull c_dir_path, - unsigned int c_keep_days, - unsigned char c_compress, - unsigned char c_compress_level, - unsigned char c_cipher, - const unsigned char * _Nonnull c_cipher_key, - uintptr_t c_key_len, - const unsigned char * _Nonnull c_cipher_nonce, - uintptr_t c_nonce_len, - unsigned int c_rotate_duration, - const char * _Nonnull c_extra - -); - -/** - * Write log to file - */ -void ezlog_log(const char * _Nonnull c_log_name, - unsigned char c_level, - const char * _Nonnull c_target, - const char * _Nonnull c_content); - -/** - * Trim out of date log files - */ -void ezlog_trim(void); - -/** - * Register callback function for get logger's file path asynchronously - */ -void ezlog_register_callback(struct Callback callback); - -/** - * Request logger's files path array by specified date - * before call this function, you should register a callback - * call - * - * ```swift - * ezlog_register_callback(callback); - * ``` - */ -void ezlog_request_log_files_for_date(const char * _Nonnull c_log_name, - int64_t c_start_time, - int64_t c_end_time); diff --git a/ios/framework/ezlog.xcframework/ios-arm64_x86_64-simulator/libezlog.a b/ios/framework/ezlog.xcframework/ios-arm64_x86_64-simulator/libezlog.a deleted file mode 100644 index 8e85359..0000000 Binary files a/ios/framework/ezlog.xcframework/ios-arm64_x86_64-simulator/libezlog.a and /dev/null differ diff --git a/publish_ios.sh b/publish_ios.sh deleted file mode 100644 index 36d4d92..0000000 --- a/publish_ios.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -set -e - -echo ios publish -pushd ios -# pod lib lint EZLog.podspec -pod trunk push EZLog.podspec --allow-warnings -popd \ No newline at end of file