Deployment script and CI improvements (#1402)

* Update text to reflect latest GitHub design

* Add check for changelog

* Update fastlane

* Allow lowercase placeholders

* Check current version in changelog

* Use checksum for cache keys

* Simulate version mismatch

* Simulate version placeholder

* Cleanup
This commit is contained in:
ramont-stripe 2022-09-01 15:19:41 -04:00 committed by GitHub
parent c22fc89681
commit ced95e8564
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 92 additions and 48 deletions

View File

@ -18,11 +18,12 @@ commands:
- run: "brew upgrade carthage"
- run: git clone --depth 1 "$CIRCLE_REPOSITORY_URL" --branch "$CIRCLE_BRANCH" .
- run: "bundle config set path 'vendor/bundle'"
- run: "bundle config set frozen 'true'"
- restore_cache:
key: v14-stp-bundle-xcode-132-cache # Update this if bundle dependencies or Xcode version change
key: v1-{{ checksum "Gemfile.lock" }}-stp-bundle-xcode-132-cache # Update this if Xcode version change
- run: "bundle install"
- save_cache:
key: v14-stp-bundle-xcode-132-cache
key: v1-{{ checksum "Gemfile.lock" }}-stp-bundle-xcode-132-cache
paths:
- vendor
prep_clone:
@ -33,18 +34,19 @@ commands:
description: "Prep the build environment, bundler, and carthage"
steps:
- run: "bundle config set path 'vendor/bundle'"
- run: "bundle config set frozen 'true'"
- restore_cache:
key: v14-stp-carthage-xcode-133-cache # Update this if Carthage dependencies or Xcode version change
key: v1-{{ checksum "Cartfile.resolved" }}-stp-carthage-xcode-133-cache # Update this if Xcode version change
- restore_cache:
key: v14-stp-bundle-xcode-133-cache # Update this if bundle dependencies or Xcode version change
key: v1-{{ checksum "Gemfile.lock" }}-stp-bundle-xcode-133-cache # Update this if Xcode version change
- run: "bundle install"
- run: "carthage bootstrap --platform iOS --configuration Release --no-use-binaries --cache-builds --use-xcframeworks"
- save_cache:
key: v14-stp-carthage-xcode-133-cache
key: v1-{{ checksum "Cartfile.resolved" }}-stp-carthage-xcode-133-cache
paths:
- Carthage
- save_cache:
key: v14-stp-bundle-xcode-133-cache
key: v1-{{ checksum "Gemfile.lock" }}-stp-bundle-xcode-133-cache
paths:
- vendor
prep_environment:
@ -130,6 +132,7 @@ jobs:
steps:
- prep_all
- run: "bundle exec fastlane check_changelog"
- run: "bundle exec fastlane build_extras"
- run: "bundle exec fastlane analyze"
- run: "bundle exec fastlane objc_symbol_check"

View File

@ -9,28 +9,28 @@ GEM
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.2.0)
aws-partitions (1.558.0)
aws-sdk-core (3.127.0)
aws-partitions (1.624.0)
aws-sdk-core (3.138.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.525.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-sdk-kms (1.55.0)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.58.0)
aws-sdk-core (~> 3, >= 3.127.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.113.0)
aws-sdk-s3 (1.114.0)
aws-sdk-core (~> 3, >= 3.127.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4)
aws-sigv4 (1.4.0)
aws-sigv4 (1.5.1)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
claide (1.0.3)
@ -82,14 +82,14 @@ GEM
rake (>= 12.0.0, < 14.0.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
dotenv (2.7.6)
dotenv (2.8.1)
dotstrings (0.2.0)
emoji_regex (3.2.3)
escape (0.0.4)
ethon (0.14.0)
ffi (>= 1.15.0)
excon (0.91.0)
faraday (1.10.0)
excon (0.92.4)
faraday (1.10.2)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
@ -108,8 +108,8 @@ GEM
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.3)
multipart-post (>= 1.2, < 3)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
@ -118,7 +118,7 @@ GEM
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.2.6)
fastlane (2.204.3)
fastlane (2.209.1)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
@ -161,9 +161,9 @@ GEM
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.16.0)
google-apis-core (>= 0.4, < 2.a)
google-apis-core (0.4.2)
google-apis-androidpublisher_v3 (0.25.0)
google-apis-core (>= 0.7, < 2.a)
google-apis-core (0.7.0)
addressable (~> 2.5, >= 2.5.1)
googleauth (>= 0.16.2, < 2.a)
httpclient (>= 2.8.1, < 3.a)
@ -172,27 +172,27 @@ GEM
retriable (>= 2.0, < 4.a)
rexml
webrick
google-apis-iamcredentials_v1 (0.10.0)
google-apis-core (>= 0.4, < 2.a)
google-apis-playcustomapp_v1 (0.7.0)
google-apis-core (>= 0.4, < 2.a)
google-apis-storage_v1 (0.11.0)
google-apis-core (>= 0.4, < 2.a)
google-apis-iamcredentials_v1 (0.13.0)
google-apis-core (>= 0.7, < 2.a)
google-apis-playcustomapp_v1 (0.10.0)
google-apis-core (>= 0.7, < 2.a)
google-apis-storage_v1 (0.17.0)
google-apis-core (>= 0.7, < 2.a)
google-cloud-core (1.6.0)
google-cloud-env (~> 1.0)
google-cloud-errors (~> 1.0)
google-cloud-env (1.5.0)
faraday (>= 0.17.3, < 2.0)
google-cloud-env (1.6.0)
faraday (>= 0.17.3, < 3.0)
google-cloud-errors (1.2.0)
google-cloud-storage (1.36.1)
google-cloud-storage (1.39.0)
addressable (~> 2.8)
digest-crc (~> 0.4)
google-apis-iamcredentials_v1 (~> 0.1)
google-apis-storage_v1 (~> 0.1)
google-apis-storage_v1 (~> 0.17.0)
google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
mini_mime (~> 1.0)
googleauth (1.1.2)
googleauth (1.2.0)
faraday (>= 0.17.3, < 3.a)
jwt (>= 1.4, < 3.0)
memoist (~> 0.16)
@ -200,7 +200,7 @@ GEM
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
highline (2.0.3)
http-cookie (1.0.4)
http-cookie (1.0.5)
domain_name (~> 0.5)
httpclient (2.8.3)
i18n (1.8.10)
@ -215,9 +215,9 @@ GEM
sassc (~> 2.1)
sqlite3 (~> 1.3)
xcinvoke (~> 0.3.0)
jmespath (1.6.0)
json (2.6.1)
jwt (2.3.0)
jmespath (1.6.1)
json (2.6.2)
jwt (2.5.0)
liferaft (0.0.6)
mail (2.7.1)
mini_mime (>= 0.1.1)
@ -243,10 +243,10 @@ GEM
optparse (0.1.1)
os (1.1.4)
plist (3.6.0)
public_suffix (4.0.6)
public_suffix (4.0.7)
rake (13.0.6)
redcarpet (3.5.1)
representable (3.1.1)
representable (3.2.0)
declarative (< 0.1.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
@ -262,9 +262,9 @@ GEM
addressable (>= 2.3.5)
faraday (> 0.8, < 2.0)
security (0.1.3)
signet (0.16.1)
signet (0.17.0)
addressable (~> 2.8)
faraday (>= 0.17.5, < 3.0)
faraday (>= 0.17.5, < 3.a)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
simctl (1.6.8)
@ -286,7 +286,7 @@ GEM
uber (0.1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.8)
unf_ext (0.0.8.2)
unicode-display_width (1.8.0)
webrick (1.7.0)
word_wrap (1.0.0)
@ -295,7 +295,7 @@ GEM
xcode-install (2.6.8)
claide (>= 0.9.1, < 1.1.0)
fastlane (>= 2.1.0, < 3.0.0)
xcodeproj (1.21.0)
xcodeproj (1.22.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)

27
ci_scripts/check_changelog.rb Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
current_version = File.open('VERSION', &:readline).strip
LATEST_RELEASE_HEADING_PATTERN = Regexp.new(
"^## #{current_version} \\d{4}-\\d{2}-\\d{2}"
)
PLACEHOLDER_HEADING_PATTERN = /^## (X.Y.Z|X.X.X)/i.freeze
first_line = File.open('CHANGELOG.md', &:readline)
unless first_line.match(LATEST_RELEASE_HEADING_PATTERN) ||
first_line.match(PLACEHOLDER_HEADING_PATTERN)
abort(
<<~MESSAGE
ERR: First line of CHANGELOG.md must be in the following format:
## [CURRENT VERSION] [ISO 8601 DATE]
For unreleased versions use the following placeholder:
## X.Y.Z
MESSAGE
)
end

View File

@ -40,7 +40,7 @@ end
def fast_forward_master
rputs 'About to fast-forward public/master to origin/private.'
rputs 'Disable "include administrators" in the stripe-ios master branch protection settings: https://github.com/stripe/stripe-ios/settings/branch_protection_rules/193653'
rputs 'Disable "Do not allow bypassing the above settings" in the stripe-ios master branch protection settings: https://github.com/stripe/stripe-ios/settings/branch_protection_rules/193653'
rputs '(Make sure to re-enable this when done!)'
notify_user
@ -49,7 +49,7 @@ def fast_forward_master
run_command('git merge --ff-only origin/private')
run_command('git push public HEAD:master') unless @is_dry_run
rputs 'Re-enable "include administrators" in the stripe-ios master branch protection settings: https://github.com/stripe/stripe-ios/settings/branch_protection_rules/193653'
rputs 'Re-enable "Do not allow bypassing the above settings" in the stripe-ios master branch protection settings: https://github.com/stripe/stripe-ios/settings/branch_protection_rules/193653'
notify_user
end

View File

@ -104,7 +104,7 @@ end
def update_placeholder(version, filename)
changelog = IO.readlines(filename).map do |line|
if line.start_with?('## X')
if line.upcase.start_with?('## X')
"## #{version} #{Time.now.strftime('%Y-%m-%d')}\n"
elsif line.start_with?('## Migrating from versions < X')
"## Migrating from versions < #{version}\n"

View File

@ -255,6 +255,12 @@ platform :ios do
Dir.chdir("..") do
sh("./ci_scripts/objc_bridging_checker.rb")
end
end
end
lane :check_changelog do
Dir.chdir("..") do
sh("./ci_scripts/check_changelog.rb")
end
end
end

View File

@ -255,6 +255,14 @@ Generate new localized screenshots
### ios check_changelog
```sh
[bundle exec] fastlane ios check_changelog
```
----
This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.