Skip to content

Commit

Permalink
Add size test (#2140)
Browse files Browse the repository at this point in the history
  • Loading branch information
noahsmartin authored Aug 15, 2023
1 parent 25b87a8 commit e2582dc
Show file tree
Hide file tree
Showing 17 changed files with 698 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ jobs:
name: TestArtifacts
path: Tests/Artifacts

emerge-upload:
name: "Emerge Upload"
runs-on: macos-13
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/setup
- name: Build Package
run: bundle exec rake emerge:upload
env:
EMERGE_API_TOKEN: ${{ secrets.EMERGE_API_TOKEN }}
PR_NUMBER: ${{ github.event.number }}

build-xcframework:
name: "Build XCFramework"
runs-on: macos-12
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
source 'https://rubygems.org' do
gem 'cocoapods', '~> 1.11.0'
gem "rake", "~> 13.0.0"
gem 'git', '~> 1.18'
end
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ GEM
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
git (1.18.0)
addressable (~> 2.8)
rchardet (~> 1.8)
httpclient (2.8.3)
i18n (1.8.11)
concurrent-ruby (~> 1.0)
Expand All @@ -76,6 +79,7 @@ GEM
netrc (0.11.0)
public_suffix (4.0.6)
rake (13.0.6)
rchardet (1.8.0)
rexml (3.2.5)
ruby-macho (2.5.1)
typhoeus (1.4.0)
Expand All @@ -96,6 +100,7 @@ PLATFORMS

DEPENDENCIES
cocoapods (~> 1.11.0)!
git (~> 1.18)!
rake (~> 13.0.0)!

BUNDLED WITH
Expand Down
31 changes: 31 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
require 'json'
require 'git'

namespace :build do
desc 'Builds all packages and executables'
task all: ['package:all', 'example:all', 'xcframework']
Expand Down Expand Up @@ -145,6 +148,34 @@ namespace :format do
end
end

namespace :emerge do
desc 'Uploads to emerge'
task :upload do
xcodebuild('build -scheme "SizeTest" -destination generic/platform=iOS -project script/SizeTest/SizeTest.xcodeproj -archivePath test.xcarchive archive CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO')
sh "zip -r -qq test.zip test.xcarchive"

g = Git.open('.')

upload_data = {
repoName: 'airbnb/lottie-ios',
filename: 'test.zip'
}
if ENV["PR_NUMBER"] != "" && ENV["PR_NUMBER"] != "false"
# TODO: Enable PR uploads
next
else
upload_data[:sha] = g.log[0].sha
upload_data[:buildType] = 'master'
end
api_token_header = "X-API-Token: #{ENV['EMERGE_API_TOKEN']}"
url = "https://api.emergetools.com/upload"
cmd = "curl --fail -s --request POST --url #{url} --header 'Accept: application/json' --header 'Content-Type: application/json' --header '#{api_token_header}' --data '#{upload_data.to_json}'"
upload_json = %x(#{cmd})
upload_url = JSON.parse(upload_json)['uploadURL']
%x(curl --fail -s -H 'Content-Type: application/zip' -T test.zip '#{upload_url}')
end
end

def xcodebuild(command)
# Check if the mint tool is installed -- if so, pipe the xcodebuild output through xcbeautify
`which mint`
Expand Down
Loading

0 comments on commit e2582dc

Please sign in to comment.