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

Apple Silicon CI Resource Class #434

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
70 changes: 57 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ version: 2.1

jobs:
danger:
executor: xcode-12
executor: xcode-14
steps:
- setup
- setup-apple-silicon
- run:
name: Install xchtmlreport
command: |
Expand Down Expand Up @@ -48,26 +48,32 @@ jobs:
name: Danger
when: always
command: |
if [ -n "$DANGER_GITHUB_API_TOKEN" ]; then bundle exec danger; else echo "Skipping Danger for forked pull request."; fi
if [ -n "$DANGER_GITHUB_API_TOKEN" ]; then bundle exec danger --verbose; else echo "Skipping Danger for forked pull request."; fi
- run:
name: Upload to Codecov
when: always
command: bash <(curl -s https://codecov.io/bash) -f build/BonMot-iOS/slather/cobertura.xml -X coveragepy -X gcov -X xcode

swift-package:
executor: xcode-12
executor: xcode-14
steps:
- setup
- setup-apple-silicon
- run: swift build
- run: swift test
- run: swift test --verbose

lint-pod:
executor: xcode-12
executor: xcode-14
steps:
- setup
- setup-apple-silicon
- lint-pod

fastlane-tests:
executor: xcode-14
steps:
- setup-apple-silicon
- run: bundle exec fastlane test_all --verbose

fastlane-tests-xcode-12:
executor: xcode-12
steps:
- setup
Expand All @@ -80,7 +86,7 @@ jobs:
- run: bundle exec fastlane test_all

carthage-build:
executor: xcode-12
executor: xcode-14
steps:
- checkout
- run:
Expand All @@ -93,7 +99,7 @@ jobs:
# - run: carthage build --no-skip-current && for platform in Mac iOS tvOS watchOS; do test -d Carthage/Build/${platform}/BonMot.framework || exit 1; done

deploy-to-cocoapods:
executor: xcode-12
executor: xcode-14
steps:
- setup
- run: bundle exec pod trunk push
Expand All @@ -109,14 +115,47 @@ executors:
shell: /bin/bash --login -eo pipefail
xcode-13:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can safely ditch Xcode 13 and just test 14.

macos:
xcode: "13.0.0"
xcode: "13.4.1"
environment:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
HOMEBREW_NO_AUTO_UPDATE: 1
shell: /bin/bash --login -eo pipefail
xcode-14:
macos:
xcode: "14.3.1"
resource_class: macos.m1.large.gen1
environment:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
HOMEBREW_NO_AUTO_UPDATE: 1
shell: /bin/bash --login -eo pipefail

commands:

setup-apple-silicon:
description: "Shared Apple Silicon setup"
steps:
- checkout
- restore-gems-apple-silicon

restore-gems-apple-silicon:
description: "Restore Ruby Gems: Apple Silicon"
steps:
- run:
name: Ruby Setup
command: bash ./.circleci/ruby_setup.sh
- run:
name: Set Ruby Version
command: bash ./.circleci/ruby_version.sh
- restore_cache:
key: 1-gems-{{ checksum "Gemfile.lock" }}
- run: bundle check || bundle install --path vendor/bundle
- save_cache:
key: 1-gems-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle

setup:
description: "Shared setup"
steps:
Expand All @@ -127,8 +166,8 @@ commands:
description: "Restore Ruby Gems"
steps:
- run:
name: Set Ruby Version
command: echo "ruby-2.5" > ~/.ruby-version
name: Set Ruby Version
command: echo "ruby-2.5" > ~/.ruby-version
- restore_cache:
key: 1-gems-{{ checksum "Gemfile.lock" }}
- run: bundle check || bundle install --path vendor/bundle
Expand Down Expand Up @@ -166,6 +205,10 @@ workflows:
filters:
tags:
only: /.*/
- fastlane-tests-xcode-12:
filters:
tags:
only: /.*/
- lint-pod:
filters:
tags:
Expand All @@ -181,6 +224,7 @@ workflows:
- swift-package
- fastlane-tests
- fastlane-tests-xcode-13
- fastlane-tests-xcode-12
- lint-pod
- carthage-build
filters:
Expand Down
47 changes: 47 additions & 0 deletions .circleci/ruby_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash -eo pipefail

# Ensure any error stops the script
set -e

# Check if Homebrew is installed
if ! command -v brew &> /dev/null; then
echo "Homebrew not found. Please install it first."
exit 1
fi

# Check if rbenv is installed; if not, install it
if ! command -v rbenv &> /dev/null; then
echo "Installing rbenv..."
brew install rbenv
# Check if rbenv init line is already present in .bash_profile, if not, add it
if ! grep -q 'eval "$(rbenv init -)"' ~/.bash_profile; then
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
fi

source ~/.bash_profile
else
echo "rbenv is already installed."
fi

# Check if ruby-build is installed; if not, install it
if ! brew list ruby-build &> /dev/null; then
echo "Installing ruby-build..."
brew install ruby-build
else
echo "ruby-build is already installed."
fi

# Ensure ruby-build is up-to-date
brew update && brew upgrade ruby-build

# Check if Ruby 3.0.6 is already installed; if not, install it
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We reference Ruby 3.0.6 a bunch of times in this file and the next. Can we use a standard .ruby-version file in the project, which rbenv will respect, so we don't need to manually reference it everywhere?

if ! rbenv versions | grep -q 3.0.6; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might be able to avoid a lot of (all of?) this script because it looks like Circle has support for switching between modern rubies: https://circleci.com/docs/testing-ios/#using-ruby

echo "Installing Ruby 3.0.6..."
rbenv install 3.0.6
else
echo "Ruby 3.0.6 is already installed."
fi

# Set the global Ruby version to 3.0.6
echo "Setting global Ruby version to 3.0.6..."
rbenv global 3.0.6
17 changes: 17 additions & 0 deletions .circleci/ruby_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash -eo pipefail

# Ensure any error stops the script
set -e

# Ensure rbenv is properly initialized
if ! command -v rbenv &> /dev/null; then
echo "rbenv not found. Please install it first."
exit 1
fi

echo "Initializing rbenv..."
source ~/.bash_profile

# Set the global Ruby version to 3.0.6
echo "Setting global Ruby version to 3.0.6..."
rbenv global 3.0.6
44 changes: 22 additions & 22 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,33 @@ GEM
specs:
CFPropertyList (3.0.6)
rexml
activesupport (7.0.5)
activesupport (7.0.7)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
addressable (2.8.4)
addressable (2.8.5)
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.777.0)
aws-sdk-core (3.174.0)
aws-partitions (1.805.0)
aws-sdk-core (3.180.3)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.66.0)
aws-sdk-core (~> 3, >= 3.174.0)
aws-sdk-kms (1.71.0)
aws-sdk-core (~> 3, >= 3.177.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.123.1)
aws-sdk-core (~> 3, >= 3.174.0)
aws-sdk-s3 (1.132.1)
aws-sdk-core (~> 3, >= 3.179.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4)
aws-sigv4 (1.5.2)
aws-sigv4 (~> 1.6)
aws-sigv4 (1.6.0)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
circleci (2.1.0)
Expand Down Expand Up @@ -109,7 +109,7 @@ GEM
danger (>= 2.1)
xcov (>= 1.7.3)
declarative (0.0.20)
digest-crc (0.6.4)
digest-crc (0.6.5)
rake (>= 12.0.0, < 14.0.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
Expand Down Expand Up @@ -150,7 +150,7 @@ GEM
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.2.7)
fastlane (2.213.0)
fastlane (2.214.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
Expand Down Expand Up @@ -196,9 +196,9 @@ GEM
git (1.18.0)
addressable (~> 2.8)
rchardet (~> 1.8)
google-apis-androidpublisher_v3 (0.43.0)
google-apis-androidpublisher_v3 (0.48.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-core (0.11.0)
google-apis-core (0.11.1)
addressable (~> 2.5, >= 2.5.1)
googleauth (>= 0.16.2, < 2.a)
httpclient (>= 2.8.1, < 3.a)
Expand Down Expand Up @@ -227,7 +227,7 @@ GEM
google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
mini_mime (~> 1.0)
googleauth (1.5.2)
googleauth (1.7.0)
faraday (>= 0.17.3, < 3.a)
jwt (>= 1.4, < 3.0)
memoist (~> 0.16)
Expand All @@ -249,9 +249,9 @@ GEM
kramdown (~> 2.0)
memoist (0.16.2)
mini_magick (4.12.0)
mini_mime (1.1.2)
mini_portile2 (2.8.2)
minitest (5.18.0)
mini_mime (1.1.5)
mini_portile2 (2.8.4)
minitest (5.19.0)
molinillo (0.8.0)
multi_json (1.15.0)
multipart-post (2.3.0)
Expand All @@ -260,7 +260,7 @@ GEM
naturally (2.2.1)
netrc (0.11.0)
no_proxy_fix (0.1.2)
nokogiri (1.15.2)
nokogiri (1.15.4)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
octokit (6.1.1)
Expand All @@ -269,18 +269,18 @@ GEM
open4 (1.3.4)
optparse (0.1.1)
os (1.1.4)
ox (2.14.16)
ox (2.14.17)
plist (3.7.0)
public_suffix (4.0.7)
racc (1.7.0)
racc (1.7.1)
rake (13.0.6)
rchardet (1.8.0)
representable (3.2.0)
declarative (< 0.1.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.2.5)
rexml (3.2.6)
rouge (2.0.7)
ruby-macho (2.5.1)
ruby2_keywords (0.0.5)
Expand Down