Skip to content

Commit

Permalink
chore: codepush ci refactor, check native code command (#9338)
Browse files Browse the repository at this point in the history
* add command to check native code

* try making codepush deploy part of test-build-deploy flow

* refactor job to not install deps unless necessary

* remove now unused script

* try m1 for this

* try installing ruby

* chore: use m1 machines in ci (#9262)

* use m1 machines in ci

* is it because ruby version does not match?

* how was this working before

* missed a spot

* try using 2.7.8 to workaround ruby install issue

* turn off early quit for now

* try installing rosetta

* Revert "turn off early quit for now"

This reverts commit 5f12fb4.

* remove unnecessary ruby install

* make sure jq is installed

* avoid re-executed the deployment check script

* try to specify ruby version, fail hard in scripts

* try using xcode 14.3.1

* add verbose output

* maybe it is this?

* i dk man

* which one of you broke everything

* was it you relay?

* was it you codepush cli?

* i think it was you jq

* remove dev changes

* missed podfile change

* increment native code version

* try updating the simulator used

* update failing snapshot image
  • Loading branch information
brainbicycle authored Sep 27, 2023
1 parent 901898c commit 6fb3b81
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 40 deletions.
58 changes: 38 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ orbs:
node: circleci/[email protected]
queue: eddiewebb/[email protected]
horizon: artsy/[email protected]
jq: circleci/[email protected]
macos: circleci/[email protected]

commands:
Expand Down Expand Up @@ -183,7 +182,7 @@ jobs:
BUNDLE_PATH: .vendor # path to install gems and use for caching

macos:
xcode: 14.1.0
xcode: 14.3.1
resource_class: macos.m1.medium.gen1

steps:
Expand All @@ -195,21 +194,42 @@ jobs:

check-and-deploy:
environment:
BUNDLE_PATH: .vendor # path to install gems and use for caching
BUNDLE_PATH: .vendor

macos:
xcode: 14.1.0
resource_class: macos.x86.medium.gen2
xcode: 14.3.1
resource_class: macos.m1.medium.gen1

steps:
- checkout
- install-node
- install-gems
- run:
name: Check if native code has changed
command: ./scripts/codepush/check-native-code.sh
name: Install jq
command: brew install jq
- run:
name: Deploy or notify
command: ./scripts/codepush/deploy-or-notify.sh
name: Determine Deployment Type
command: |
DEPLOYMENT_TYPE=$(./scripts/codepush/determine-deployment-type.sh)
echo "export DEPLOYMENT_TYPE=$DEPLOYMENT_TYPE" >> $BASH_ENV
- run:
name: Handle Deployment for beta
command: |
if [ "$DEPLOYMENT_TYPE" == "beta" ]; then
echo "Native code changed, notifying new beta needed!"
bundle exec fastlane notify_beta_needed
circleci-agent step halt
fi
- install-node-modules
- run:
name: Install CodePush CLI
command: yarn global add appcenter-cli
- run-relay-compiler
- run:
name: Handle Deployment for codepush
command: |
echo "Triggering CodePush deployment..."
./scripts/codepush/deploy-to-codepush.sh Staging
test-js:
parallelism: 8
Expand Down Expand Up @@ -289,7 +309,7 @@ jobs:
BUNDLE_PATH: .vendor # path to install gems and use for caching

macos:
xcode: 14.1.0
xcode: 14.3.1
resource_class: macos.m1.medium.gen1

steps:
Expand Down Expand Up @@ -339,7 +359,7 @@ jobs:
BUNDLE_PATH: .vendor # path to install gems and use for caching

macos:
xcode: 14.1.0
xcode: 14.3.1
resource_class: macos.m1.medium.gen1

steps:
Expand Down Expand Up @@ -433,7 +453,7 @@ jobs:
environment:
BUNDLE_PATH: .vendor # path to install gems and use for caching
macos:
xcode: 14.1.0
xcode: 14.3.1
resource_class: macos.m1.medium.gen1
steps:
- checkout
Expand All @@ -455,14 +475,6 @@ workflows:
jobs:
- deploy-nightly-beta

deploy:
jobs:
- check-and-deploy:
filters:
branches:
only:
- main

flag-check:
triggers:
- schedule:
Expand Down Expand Up @@ -520,6 +532,12 @@ workflows:
- app_store_submission
- play_store_submission

- check-and-deploy:
filters:
branches:
only:
- main

- test-js:
filters:
branches:
Expand Down
Binary file modified ...enceImages/ARTextViewSpec/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions ios/ArtsyTests/Supporting_Files/ARTestHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ - (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:
{
NSOperatingSystemVersion version = [NSProcessInfo processInfo].operatingSystemVersion;

NSAssert(version.majorVersion == 16 && version.minorVersion == 1,
@"The tests should be run on iOS 16.1, not %ld.%ld", version.majorVersion, version.minorVersion);
NSAssert(version.majorVersion == 16 && version.minorVersion == 4,
@"The tests should be run on iOS 16.4, not %ld.%ld", version.majorVersion, version.minorVersion);

CGSize nativeResolution = [UIScreen mainScreen].nativeBounds.size;
NSAssert([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone && CGSizeEqualToSize(nativeResolution, CGSizeMake(1179, 2556)),
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"clean-android": "cd android; ./gradlew clean; cd -",
"clean-ios": "yarn rimraf ~/Library/Developer/Xcode/DerivedData",
"codepush:deploy": "./scripts/codepush/deploy-to-codepush.sh",
"codepush:check-native-code": "./scripts/codepush/check-native-code.sh",
"codepush:increment-native-code": "./scripts/codepush/increment-native-code.sh",
"danger": "danger",
"dead-code": "./scripts/check-dead-code.sh",
Expand Down
1 change: 1 addition & 0 deletions scripts/codepush/calculate-native-hash.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -euxo pipefail

# Directory paths to be checked for changes
declare -a android_paths_to_check=("./android/app/src")
Expand Down
1 change: 1 addition & 0 deletions scripts/codepush/check-native-code.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -euxo pipefail

# Get the directory of the currently executing script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
Expand Down
17 changes: 0 additions & 17 deletions scripts/codepush/deploy-or-notify.sh

This file was deleted.

1 change: 1 addition & 0 deletions scripts/codepush/determine-deployment-type.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -euxo pipefail

# Get the native code version before the merge (from the main branch)
pre_merge_native_code_version=$(git show main:app.json | jq -r '.nativeCodeVersion | to_entries | reduce .[] as $item (0; . as $key | if $item.key | tonumber > $key then $item.key | tonumber else $key end)')
Expand Down
1 change: 1 addition & 0 deletions scripts/codepush/increment-native-code.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -euxo pipefail

# Get the directory of the currently executing script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
Expand Down
2 changes: 1 addition & 1 deletion scripts/source-for-bash-env
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export LOCAL_BRANCH
export WORKSPACE="ios/Artsy.xcworkspace"
export SCHEME="Artsy"
export DEVICE_HOST_PLAT="iOS Simulator"
export DEVICE_HOST_OS="16.1"
export DEVICE_HOST_OS="16.4"
export DEVICE_HOST_NAME="iPhone 14 Pro"
export DERIVED_DATA_PATH="derived_data"
export CONFIGURATION="Release"

0 comments on commit 6fb3b81

Please sign in to comment.