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

[MBL-773] CircleCI Workspaces Integration #1821

Merged
merged 34 commits into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b65a05c
updating circle-ci to use workspaces
msadoon May 14, 2023
6cd40f2
trying spm ssh workaround to add permissions for restoring spm cache
msadoon May 14, 2023
f7108b6
syntax corrections
msadoon May 14, 2023
8d463df
update ruby version to 3.0.5
msadoon May 14, 2023
36cd4c7
move restore bundler before restore spm cache see if permissions issu…
msadoon May 14, 2023
724111d
update config.yml
msadoon May 14, 2023
ba826d6
removing restoring and saving cache steps
msadoon May 14, 2023
dbf1bb6
updated ios sim version in makefile - might cause the hang on the xco…
msadoon May 14, 2023
f9635e4
maybe make bootstrap needs to run first before make test
msadoon May 14, 2023
1b1e07f
removed unneeded step from test_job
msadoon May 15, 2023
875ffdd
added make bootstrap to build and cache step.
msadoon May 15, 2023
aa933d2
bootstrap spm added back to test job
msadoon May 15, 2023
1fceac7
updated circleci config merge conflicts - merging main
msadoon May 15, 2023
243fd81
trying to see if other make cmds run
msadoon May 15, 2023
4b3c359
no need for make steps, confirmed no PWD is set in env.
msadoon May 15, 2023
d22014c
using executor
msadoon May 15, 2023
cba5eec
explicitly setting the work directory for each test job and removing …
msadoon May 15, 2023
bb24c69
adding a recommended orb for running shell cmds, which is what the ma…
msadoon May 16, 2023
9abdafc
trying to override default login shell before make test
msadoon May 16, 2023
647d531
oops forgot to remove the login option
msadoon May 16, 2023
91785c9
git clone was preventing the native-secrets rep from being cloned.
msadoon May 16, 2023
1aa3954
replaced preload_simulator with orb run step
msadoon May 16, 2023
8a5a57f
update config.yml with create step on test job
msadoon May 16, 2023
9f36ba6
updated device name - might fix issue
msadoon May 16, 2023
e53e7cf
xcode cannot identify name of simulator if it contains the version
msadoon May 16, 2023
a7f387d
update ios-certificate urls in fastfile to match format that doesn't …
msadoon May 17, 2023
bb4046a
testing just alpha dist
msadoon May 17, 2023
5ba5eee
commented out other jobs just to validate config
msadoon May 17, 2023
2f06dfa
making build and cache req for deploy alpha
msadoon May 17, 2023
aa0c041
updated xcode version from 13.3.1 to 14.2 in fastfile
msadoon May 17, 2023
595df5f
fix cleanup step login issue, comment back in tests
msadoon May 17, 2023
e6ad921
Merge branch 'main' into feature/integration-circleci-workspaces
msadoon May 17, 2023
525f8f7
Merge branch 'main' into feature/integration-circleci-workspaces
msadoon May 17, 2023
a4ac6bd
re-triggering to get code coverage checked again
msadoon May 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
124 changes: 28 additions & 96 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ aws_cli_setup: &aws_cli_setup

xcode_version: &xcode_version 14.2
iphone_name: &iphone_name iPhone 8
preload_simulator: &preload_simulator xcrun instruments -w "iPhone 8 (15.5) [" || true

# Works around an issue in xcodebuild where it requires GitHub to have been added to the known_hosts in order for it to clone dependencies.
spm_ssh_workaround: &spm_ssh_workaround for ip in $(dig @1.1.1.1 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts
Expand All @@ -34,46 +33,19 @@ base_job: &base_job

test_job: &test_job
steps:
- checkout
- run:
name: SPM SSH Workaround
command: *spm_ssh_workaround
- run:
name: Store Xcode Version
command: xcodebuild -version > xcode_version.txt
- restore_cache:
name: Restore SPM Cache
keys:
- spm-cache-v1-{{ checksum "./Kickstarter.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved" }}-{{ checksum "xcode_version.txt" }}
- run:
name: Bootstrap SPM
command: xcodebuild -resolvePackageDependencies -clonedSourcePackagesDirPath SourcePackages
- run:
name: Bootstrap
command: make bootstrap
- run:
name: Download GraphQL Schema
command: bin/apollo-schema-download.sh
- attach_workspace:
at: .
- run:
name: Pre-install simulator
command: xcrun simctl create "iPhone 8 (15.5)" com.apple.CoreSimulator.SimDeviceType.iPhone-8 com.apple.CoreSimulator.SimRuntime.iOS-15-5
- run:
name: Pre-load simulator
command: *preload_simulator
name: Create iPhone 8 iOS 15.5 Simulator
command: xcrun simctl create "iPhone 8" com.apple.CoreSimulator.SimDeviceType.iPhone-8 com.apple.CoreSimulator.SimRuntime.iOS-15-5
- macos/preboot-simulator:
version: "15.5"
platform: "iOS"
device: "iPhone 8"
- run:
name: Run tests
command: make test
no_output_timeout: "20m" # 20 minutes
- restore_cache:
name: Restore Bundler
keys:
- v1-gems-{{ checksum "Gemfile.lock" }}
- run:
name: Install Bundler
command: bundle check || bundle install
environment:
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
- run:
name: Generate Slather coverage report
command: bundle exec slather coverage -x --scheme $SCHEME ./Kickstarter.xcodeproj
Expand All @@ -82,38 +54,10 @@ test_job: &test_job

distribute_job: &distribute_job
steps:
- checkout
- attach_workspace:
at: .
- aws-cli/setup:
<<: *aws_cli_setup
- run:
name: SPM SSH Workaround
command: *spm_ssh_workaround
- run:
name: Store Xcode Version
command: xcodebuild -version > xcode_version.txt
- restore_cache:
name: Restore SPM Cache
keys:
- spm-cache-v1-{{ checksum "./Kickstarter.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved" }}-{{ checksum "xcode_version.txt" }}
- run:
name: Bootstrap SPM
command: xcodebuild -resolvePackageDependencies -clonedSourcePackagesDirPath SourcePackages
- run:
name: Bootstrap
command: make bootstrap
- restore_cache:
keys:
- v1-gems-{{ checksum "Gemfile.lock" }}
- run:
name: Bundle install
command: bundle check || bundle install
environment:
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
- save_cache:
key: v1-gems-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
- run:
name: Increment build number
command: agvtool new-version -all $(($(date +%s)/1000))
Expand All @@ -136,8 +80,7 @@ distribute_job: &distribute_job
path: output

all_jobs: &all_jobs
- build-and-cache
- kickstarter-tests
- kickstarter-tests
- library-tests
- ksapi-tests

Expand All @@ -156,39 +99,28 @@ jobs:
- run:
name: Store Xcode Version
command: xcodebuild -version > xcode_version.txt
- restore_cache:
name: Restore SPM Cache
keys:
- spm-cache-v1-{{ checksum "./Kickstarter.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved" }}-{{ checksum "xcode_version.txt" }}
- run:
name: Bootstrap SPM
command: xcodebuild -resolvePackageDependencies -clonedSourcePackagesDirPath SourcePackages
- run:
name: Bootstrap
command: make bootstrap
- save_cache:
name: Cache SPM
key: spm-cache-v1-{{ checksum "./Kickstarter.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved" }}-{{ checksum "xcode_version.txt" }}
paths:
- SourcePackages
- restore_cache:
name: Restore Bundler
keys:
- v1-gems-{{ checksum "Gemfile.lock" }}
- run:
name: Install Bundler
command: bundle check || bundle install
environment:
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
- save_cache:
name: Cache Bundler
key: v1-gems-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
- run:
name: Download GraphQL Schema
command: bin/apollo-schema-download.sh
- run:
name: Danger
command: bin/danger.sh
- persist_to_workspace:
root: .
paths:
- .

# Kickstarter tests
kickstarter-tests:
Expand Down Expand Up @@ -268,19 +200,12 @@ jobs:
- run:
name: Secrets
command: make secrets
- restore_cache:
keys:
- v1-gems-{{ checksum "Gemfile.lock" }}
- run:
name: Bundle install
command: bundle check || bundle install
environment:
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
- save_cache:
key: v1-gems-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
- run:
name: Download dSYMs and upload to Crashlytics
command: bundle exec fastlane refresh_dsyms
Expand All @@ -302,9 +227,16 @@ workflows:
# Matches all_jobs
jobs:
- build-and-cache
- kickstarter-tests
- library-tests
- ksapi-tests
- kickstarter-tests:
requires:
- build-and-cache
- library-tests:
requires:
- build-and-cache
- ksapi-tests:
requires:
- build-and-cache

# ** Refreshing dSYMs disabled until a suitable workaround is found for App Store Connect 2FA authentication
# or Fastlane implements API key support in this Fastlane action. Uncomment below to re-enable.
# See: https://docs.fastlane.tools/app-store-connect-api/
Expand Down
8 changes: 4 additions & 4 deletions .fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ platform :ios do
match(
app_identifier: ["com.kickstarter.kickstarter"],
type: "appstore",
git_url: "https://github.com/kickstarter/ios-certificates",
git_url: "git@github.com:kickstarter/ios-certificates",
team_id: "48YBP49Y5N",
git_branch: "ksr",
username: ENV["ITUNES_CONNECT_ACCOUNT"]
Expand All @@ -40,7 +40,7 @@ platform :ios do
"com.kickstarter.kickstarter.debug"
],
type: "development",
git_url: "https://github.com/kickstarter/ios-certificates",
git_url: "git@github.com:kickstarter/ios-certificates",
team_id: "48YBP49Y5N",
git_branch: "ksr",
username: ENV["ITUNES_CONNECT_ACCOUNT"],
Expand All @@ -56,7 +56,7 @@ platform :ios do
"com.kickstarter.kickstarter.kickalpha"
],
type: "enterprise",
git_url: "https://github.com/kickstarter/ios-certificates",
git_url: "git@github.com:kickstarter/ios-certificates",
team_id: "5DAN4UM3NC",
git_branch: "ksr-enterprise",
username: ENV["ITUNES_CONNECT_ACCOUNT"],
Expand Down Expand Up @@ -226,7 +226,7 @@ platform :ios do
end

private_lane :xcode_check do
xcodes(version: "13.3.1", select_for_current_build_only: true)
xcodes(version: "14.2", select_for_current_build_only: true)
end

private_lane :build_the_app do |options|
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ sync:

cleanup:
@echo "Adding remotes..."
@git remote add oss https://github.com/kickstarter/ios-oss
@git remote add private https://github.com/kickstarter/ios-private
@git remote add oss git@github.com:kickstarter/ios-oss
@git remote add private git@github.com:kickstarter/ios-private

@echo "Deleting temporary branch: $(CIRCLE_BRANCH)"

Expand All @@ -132,7 +132,7 @@ strings:

secrets:
-@rm -rf Frameworks/native-secrets
-@git clone https://github.com/kickstarter/native-secrets Frameworks/native-secrets 2>/dev/null || echo '(Skipping secrets.)'
-@git clone git@github.com:kickstarter/native-secrets Frameworks/native-secrets 2>/dev/null || echo '(Skipping secrets.)'
if [ ! -d Frameworks/native-secrets ]; \
then \
mkdir -p Frameworks/native-secrets/ios \
Expand Down