Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/xcframeworks #588

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,28 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
build-config:
- { scheme: 'SkeletonView iOS', destination: 'platform=iOS Simulator,name=iPhone 8', sdk: 'iphonesimulator' }
- { scheme: 'SkeletonView tvOS', destination: 'platform=tvOS Simulator,name=Apple TV', sdk: 'appletvsimulator' }
- { scheme: 'iOS Example', destination: 'platform=iOS Simulator,name=iPhone 8', sdk: 'iphonesimulator' }
- { scheme: 'tvOS Example', destination: 'platform=tvOS Simulator,name=Apple TV', sdk: 'appletvsimulator' }
build-config:
- {
scheme: "SkeletonView iOS",
destination: "platform=iOS Simulator,name=iPhone 15",
sdk: "iphonesimulator",
}
- {
scheme: "SkeletonView tvOS",
destination: "platform=tvOS Simulator,name=Apple TV",
sdk: "appletvsimulator",
}
- {
scheme: "iOS Example",
destination: "platform=iOS Simulator,name=iPhone 15",
sdk: "iphonesimulator",
}
- {
scheme: "tvOS Example",
destination: "platform=tvOS Simulator,name=Apple TV",
sdk: "appletvsimulator",
}
steps:
- uses: actions/checkout@v2
- name: Build
run: xcodebuild clean build -workspace 'SkeletonView.xcworkspace' -scheme '${{ matrix.build-config['scheme'] }}' -sdk '${{ matrix.build-config['sdk'] }}' -destination '${{ matrix.build-config['destination'] }}'

133 changes: 113 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,140 @@
name: Release
on: [workflow_dispatch]

jobs:
build:
name: Build XCFramework for Multiple Platforms
runs-on: macos-latest
strategy:
matrix:
build-config:
- {
scheme: "SkeletonView iOS",
destination: "generic/platform=iOS",
sdk: "iphoneos",
archive_path: "build/Release-iphoneos",
}
- {
scheme: "SkeletonView iOS",
destination: "generic/platform=iOS Simulator",
sdk: "iphonesimulator",
archive_path: "build/Release-iphonesimulator",
}
- {
scheme: "SkeletonView tvOS",
destination: "generic/platform=tvOS",
sdk: "appletvos",
archive_path: "build/Release-appletvos",
}
- {
scheme: "SkeletonView tvOS",
destination: "generic/platform=tvOS Simulator",
sdk: "appletvsimulator",
archive_path: "build/Release-appletvsimulator",
}

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

- name: Build framework
run: |
xcodebuild archive \
-scheme "${{ matrix.build-config.scheme }}" \
-destination "${{ matrix.build-config.destination }}" \
-sdk "${{ matrix.build-config.sdk }}" \
-archivePath "${{ matrix.build-config.archive_path }}/SkeletonView.xcarchive" \
SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES

create-xcframework:
name: Create XCFramework
needs: build
runs-on: macos-latest

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

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts

- name: Create XCFramework
run: |
xcodebuild -create-xcframework \
-framework build/Release-iphoneos/SkeletonView.xcarchive/Products/Library/Frameworks/SkeletonView.framework \
-framework build/Release-iphonesimulator/SkeletonView.xcarchive/Products/Library/Frameworks/SkeletonView.framework \
-framework build/Release-appletvos/SkeletonView.xcarchive/Products/Library/Frameworks/SkeletonView.framework \
-framework build/Release-appletvsimulator/SkeletonView.xcarchive/Products/Library/Frameworks/SkeletonView.framework \
-output build/XCFramework/SkeletonView.xcframework

- name: Verify XCFramework
run: |
if [ -d "build/XCFramework/SkeletonView.xcframework" ]; then
echo "XCFramework generated successfully."
else
echo "Failed to generate XCFramework." && exit 1
fi

- name: Upload XCFramework
uses: actions/upload-artifact@v4
with:
name: SkeletonView-XCFramework
path: build/XCFramework/SkeletonView.xcframework

release_version:
runs-on: macOS-latest
name: Release Version
needs: create-xcframework
runs-on: macos-latest

steps:
- uses: actions/checkout@v2

- uses: actions/checkout@v4

- name: Download XCFramework
uses: actions/download-artifact@v3
with:
name: SkeletonView-XCFramework

- name: Publish release
id: publish_release
uses: release-drafter/release-drafter@v5
with:
with:
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update podspec
- name: Update podspec with XCFramework
run: |
sed -i '' 's|vendored_frameworks = .*|vendored_frameworks = "build/XCFramework/SkeletonView.xcframework"|' SkeletonView.podspec

- name: Update version in podspec
run: fastlane bump_version next_version:${{ steps.publish_release.outputs.tag_name }}

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: 'main'
commit_message: 'Bump version ${{ steps.publish_release.outputs.tag_name }}'
branch: "main"
commit_message: "Bump version ${{ steps.publish_release.outputs.tag_name }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy to Cocoapods
- name: Deploy to CocoaPods
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
run: |
set -eo pipefail
pod lib lint --allow-warnings
pod trunk push --allow-warnings
pod trunk push --allow-warnings

- name: Tweet the release
uses: ethomson/send-tweet-action@v1
uses: nearform-actions/github-action-notify-twitter@master
with:
consumer-key: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
consumer-secret: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }}
access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
status: |
message: |
🎉 New release ${{ steps.publish_release.outputs.tag_name }} is out 🚀
Check out all the changes here:
${{ steps.publish_release.outputs.html_url }}
${{ steps.publish_release.outputs.html_url }}
twitter-app-key: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
twitter-app-secret: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
twitter-access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }}
twitter-access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
27 changes: 9 additions & 18 deletions .github/workflows/validations.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,25 @@
name: Validations

on:
on:
pull_request_target:
branches: [main]
types: [opened, reoneped, edited, synchronized]

# workflow_dispatch:
# inputs:
# commit hash:
# description: "Commit hash"
# required: true
# default: ""

jobs:
lint:
runs-on: macos-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run SwiftLint
run: swiftlint lint --reporter github-actions-logging
- uses: actions/checkout@v1
- name: GitHub Action for SwiftLint with --strict
uses: norio-nomura/[email protected]

danger:
danger:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Danger
uses: docker://frmeloni/danger-swift-with-swiftlint:1.3.1
uses: 417-72KI/danger-swiftlint@v5.10 # Look at the `Note for version`
with:
args: --failOnErrors --verbose
args: --failOnErrors --verbose
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


1 change: 1 addition & 0 deletions SkeletonView.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ Pod::Spec.new do |s|
s.swift_version = "5.0"
s.source = { :git => "https://github.com/Juanpe/SkeletonView.git", :tag => s.version.to_s }
s.source_files = "SkeletonViewCore/Sources/**/*.{swift,h}"
s.resource_bundles = {"SkeletonView" => ["SkeletonViewCore/Sources/Supporting Files/PrivacyInfo.xcprivacy"]}
end
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@ public class SkeletonAnimationBuilder {
let animGroup = CAAnimationGroup()
animGroup.animations = [startPointAnim, endPointAnim]
animGroup.duration = duration
animGroup.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeIn)
animGroup.repeatCount = .infinity
animGroup.autoreverses = autoreverses
animGroup.isRemovedOnCompletion = false

if #available(iOS 12.0, *) {
animGroup.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeIn)
} else {
animGroup.timingFunction = CAMediaTimingFunction(controlPoints: 0.42, 0.0, 1.0, 1.0)
}

return animGroup
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@ public extension CALayer {
// swiftlint:disable:next force_unwrapping
pulseAnimation.toValue = UIColor(cgColor: backgroundColor!).complementaryColor.cgColor
pulseAnimation.duration = 1
pulseAnimation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
pulseAnimation.autoreverses = true
pulseAnimation.repeatCount = .infinity
pulseAnimation.isRemovedOnCompletion = false

if #available(iOS 12.0, *) {
pulseAnimation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
} else {
pulseAnimation.timingFunction = CAMediaTimingFunction(controlPoints: 0.42, 0.0, 0.58, 1.0)
}
return pulseAnimation
}

Expand Down
Loading