Skip to content

New-arch/MOB-11545-update-build-configurations-for-both-ios-and-andro #645

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

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

lposen
Copy link
Contributor

@lposen lposen commented Jun 4, 2025

🔹 JIRA Ticket(s) if any

✏️ Description

Please provide a brief description of what this pull request does.

Copy link

github-actions bot commented Jun 4, 2025

Lines Statements Branches Functions
Coverage: 38%
38.11% (178/467) 11.29% (20/177) 32.46% (50/154)

Comment on lines +57 to +71
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup

- name: Switch to new architecture
run: yarn switch-arch new

- name: Build package with new architecture
run: yarn build:new-arch

build-android-old-arch:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 4 days ago

To fix the issue, we need to add a permissions block to the workflow file. This block should specify the minimal permissions required for the workflow to function correctly. Based on the provided workflow, it appears that the jobs primarily involve checking out code, running setup scripts, linting, type-checking, testing, and building packages. These tasks typically require only contents: read permissions. Therefore, we will add a permissions block at the root level of the workflow to apply to all jobs.

Suggested changeset 1
.github/workflows/ci.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,2 +1,4 @@
 name: CI
+permissions:
+  contents: read
 on:
EOF
@@ -1,2 +1,4 @@
name: CI
permissions:
contents: read
on:
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +72 to +130
runs-on: ubuntu-latest
env:
TURBO_CACHE_DIR: .turbo/android-old
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup

- name: Switch to old architecture
run: yarn switch-arch old

- name: Cache turborepo for Android
uses: actions/cache@v3
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-turborepo-android-old-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-turborepo-android-old-

- name: Check turborepo cache for Android
run: |
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status")

if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
echo "turbo_cache_hit=1" >> $GITHUB_ENV
fi

- name: Install JDK
if: env.turbo_cache_hit != 1
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Finalize Android SDK
if: env.turbo_cache_hit != 1
run: |
/bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"

- name: Cache Gradle
if: env.turbo_cache_hit != 1
uses: actions/cache@v3
with:
path: |
~/.gradle/wrapper
~/.gradle/caches
key: ${{ runner.os }}-gradle-old-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-old-

- name: Build example for Android (Old Architecture)
env:
JAVA_OPTS: '-XX:MaxHeapSize=6g'
run: |
yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"

build-android-new-arch:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 4 days ago

To fix the issue, we need to add a permissions block to the workflow file. This block should specify the least privileges required for the workflow to function correctly. Since the workflow primarily involves linting, testing, building, and caching, the minimal permission contents: read is sufficient for most jobs. If specific jobs require additional permissions, they can be set individually.

The permissions block can be added at the root level of the workflow to apply to all jobs, or it can be added to individual jobs if different permissions are required for each job.


Suggested changeset 1
.github/workflows/ci.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,2 +1,4 @@
 name: CI
+permissions:
+  contents: read
 on:
EOF
@@ -1,2 +1,4 @@
name: CI
permissions:
contents: read
on:
Copilot is powered by AI and may make mistakes. Always verify output.
Copy link

codeclimate bot commented Jun 4, 2025

❌ 28 blocking issues (85 total)

Tool Category Rule Count
eslint Lint Replace useEffect,·useState with ·useEffect,·useState· 7
eslint Lint Expected style properties to be in ascending order. 'backgroundColor' should be before 'flex'. 6
eslint Lint Error loading TSDoc config file:
Error encountered for /home/runner/work/react-native-sdk/tsdoc.json:
Unable to resolve "extends" reference to "typedoc/tsdoc.json": Cannot find module 'typedoc/tsdoc.json' from '/home/runner/work/react-native-sdk'
3
eslint Lint Unexpected any. Specify a different type. 2
eslint Lint Color literal: { backgroundColor: '#F5F5F5' } 10
qlty Duplication Found 19 lines of similar code in 2 locations (mass = 71) 8
qlty Structure Function with many parameters (count = 4): initializeWithApiKey 24
qlty Structure Function with high complexity (count = 7): getIterableConfigFromMap 22
qlty Structure Function with many returns (count = 4): getIterableConfigFromMap 2
qlty Structure High total complexity (count = 103) 1

This is from Qlty Cloud, the successor to Code Climate Quality. Learn more.

}

@Override
public void initializeWithApiKey(String apiKey, ReadableMap config, String version, Promise promise) {
Copy link

Choose a reason for hiding this comment

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

Function with many parameters (count = 4): initializeWithApiKey [qlty:function-parameters]

}

@Override
public void initialize2WithApiKey(String apiKey, ReadableMap config, String apiEndPoint, String version, Promise promise) {
Copy link

Choose a reason for hiding this comment

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

Function with many parameters (count = 5): initialize2WithApiKey [qlty:function-parameters]

}

@Override
public void trackPushOpen(double campaignId, Double templateId, String messageId, boolean appAlreadyRunning, ReadableMap dataFields) {
Copy link

Choose a reason for hiding this comment

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

Function with many parameters (count = 5): trackPushOpen [qlty:function-parameters]

}

@Override
public void trackInAppClose(String messageId, double location, double source, String clickedUrl) {
Copy link

Choose a reason for hiding this comment

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

Function with many parameters (count = 4): trackInAppClose [qlty:function-parameters]

Comment on lines +262 to +323
private IterableConfig getIterableConfigFromMap(ReadableMap config) {
IterableConfig.Builder builder = new IterableConfig.Builder();

if (config.hasKey("pushIntegrationName")) {
builder.setPushIntegrationName(config.getString("pushIntegrationName"));
}

if (config.hasKey("autoPushRegistration")) {
builder.setAutoPushRegistration(config.getBoolean("autoPushRegistration"));
}

if (config.hasKey("logLevel")) {
builder.setLogLevel(config.getInt("logLevel"));
}

if (config.hasKey("inAppDisplayInterval")) {
builder.setInAppDisplayInterval(config.getDouble("inAppDisplayInterval"));
}

if (config.hasKey("urlHandler")) {
ReadableMap urlHandler = config.getMap("urlHandler");
builder.setUrlHandler(url -> {
sendEvent("urlHandler", url);
return urlHandler.getBoolean("shouldOpenInNewWindow");
});
}

if (config.hasKey("customActionHandler")) {
ReadableMap customActionHandler = config.getMap("customActionHandler");
builder.setCustomActionHandler((action, context) -> {
sendEvent("customActionHandler", action.getType());
return customActionHandler.getBoolean("shouldHandleCustomAction");
});
}

if (config.hasKey("inAppHandler")) {
ReadableMap inAppHandler = config.getMap("inAppHandler");
builder.setInAppHandler(new IterableConfig.InAppHandler() {
@Override
public boolean onInAppReceived(IterableInAppMessage message) {
sendEvent("inAppReceived", message.getMessageId());
return inAppHandler.getBoolean("shouldShowInApp");
}

@Override
public void onInAppDisplayed(IterableInAppMessage message) {
sendEvent("inAppDisplayed", message.getMessageId());
}

@Override
public void onInAppDismissed(IterableInAppMessage message) {
sendEvent("inAppDismissed", message.getMessageId());
}

@Override
public void onInAppClicked(IterableInAppMessage message, String clickedUrl) {
sendEvent("inAppClicked", message.getMessageId());
}
});
}

return builder.build();
Copy link

Choose a reason for hiding this comment

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

Found 2 issues:

1. Function with high complexity (count = 7): getIterableConfigFromMap [qlty:function-complexity]


2. Function with many returns (count = 4): getIterableConfigFromMap [qlty:return-statements]

Comment on lines +162 to +164
height: 300,
backgroundColor: '#FFFFFF',
borderRadius: 8,
Copy link

Choose a reason for hiding this comment

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

Expected style properties to be in ascending order. 'backgroundColor' should be before 'height'. [eslint:react-native/sort-styles]

Suggested change
height: 300,
backgroundColor: '#FFFFFF',
borderRadius: 8,
backgroundColor: '#FFFFFF',
borderRadius: 8,
height: 300,

Comment on lines +166 to +170
messageCard: {
padding: 12,
backgroundColor: '#F8F8F8',
borderRadius: 6,
marginBottom: 8,
Copy link

Choose a reason for hiding this comment

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

Color literal: { backgroundColor: '#F8F8F8' } [eslint:react-native/no-color-literals]

Comment on lines +167 to +170
padding: 12,
backgroundColor: '#F8F8F8',
borderRadius: 6,
marginBottom: 8,
Copy link

Choose a reason for hiding this comment

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

Expected style properties to be in ascending order. 'backgroundColor' should be before 'padding'. [eslint:react-native/sort-styles]

Suggested change
padding: 12,
backgroundColor: '#F8F8F8',
borderRadius: 6,
marginBottom: 8,
backgroundColor: '#F8F8F8',
borderRadius: 6,
marginBottom: 8,
padding: 12,

Comment on lines +172 to +176
messageTitle: {
fontSize: 16,
fontWeight: 'bold',
color: '#333333',
marginBottom: 4,
Copy link

Choose a reason for hiding this comment

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

Color literal: { color: '#333333' } [eslint:react-native/no-color-literals]

Comment on lines +173 to +175
fontSize: 16,
fontWeight: 'bold',
color: '#333333',
Copy link

Choose a reason for hiding this comment

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

Expected style properties to be in ascending order. 'color' should be before 'fontWeight'. [eslint:react-native/sort-styles]

Suggested change
fontSize: 16,
fontWeight: 'bold',
color: '#333333',
color: '#333333',
fontSize: 16,
fontWeight: 'bold',

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant