chore: Using Namespace.so for MacOS Runners (#1500)

* chore: update CI workflows to include Java setup and modify runner environments

- Added Java installation checks and setup steps to multiple CI workflows to ensure Java is available for builds.
- Changed runner environments for iOS builds from `macos-latest-large` to `namespace-profile-apple-silicon-6cpu` for better resource management.
- Updated push triggers for CI workflows to include specific branches and paths for more controlled execution.

* refactor: streamline AES-GCM encryption tag validation in encryptAES256GCM function

- Removed redundant checks for the AES-GCM authentication tag, simplifying the code while maintaining functionality.
- Updated the return structure to directly convert the authentication tag to a binary format, enhancing clarity and efficiency.

* chore: add Actionlint configuration for custom runner labels

* chore: update mobile deployment workflows for testing configuration

* chore: included a step to set the INSTALL_JAVA environment variable to false

* chore: update logging in setup-native-source script for improved debugging

* chore: simplify mobile CI workflow by removing redundant iOS and Android build steps

- Removed extensive iOS and Android build steps from the mobile CI workflow, as build verification is now handled by the mobile-e2e.yml workflow.

* chore: update mobile workflows to remove push triggers for improved clarity

- Removed push triggers from mobile CI, E2E, and bundle analysis workflows to streamline execution and focus on pull request events.
- This change enhances workflow clarity and reduces unnecessary runs on branch pushes.

* Revert "chore: simplify mobile CI workflow by removing redundant iOS and Android build steps"

This reverts commit 30d5f585c2.

* Updated the conditions for running iOS and Android build jobs to only trigger on workflow dispatch events, reducing unnecessary executions.

* chore: enhance mobile CI workflows with push triggers for improved execution control

- Added push triggers for dev, staging, and main branches in mobile bundle analysis, E2E, and demo E2E workflows to ensure builds are triggered on relevant changes.
- Included conditions for running iOS E2E tests based on issue comments, allowing for more flexible testing workflows.

* Addind workflow_dispatch option

* chore: refine mobile E2E workflows by removing issue comment triggers

- Eliminated issue comment event triggers from mobile E2E workflows to streamline execution and focus on workflow dispatch and push events.
- This change enhances clarity and reduces unnecessary complexity in the CI process.

* chore: remove checkout action from npm publish workflow

- Eliminated the checkout action from the npm publish workflow to streamline the process and reduce unnecessary steps.
- This change aims to enhance the efficiency of the CI pipeline.
This commit is contained in:
Javier Cortejoso
2025-12-22 17:15:37 +01:00
committed by GitHub
parent b783f56d70
commit 2a092f5571
10 changed files with 244 additions and 31 deletions

View File

@@ -52,9 +52,9 @@ if [ -d "$MOBILE_SDK_NATIVE" ]; then
rm -f "dist/android/mobile-sdk-alpha-release.aar"
fi
# Update submodule to latest
echo "🔄 Updating submodule to latest..."
git submodule update --init --recursive mobile-sdk-native
# Setup and update submodule using the setup script
echo "🔄 Setting up and updating submodule..."
node scripts/setup-native-source.cjs
# Navigate to android directory
cd android

View File

@@ -9,6 +9,7 @@ const path = require('path');
// Constants
const SCRIPT_DIR = __dirname;
const SDK_DIR = path.dirname(SCRIPT_DIR);
const REPO_ROOT = path.resolve(SDK_DIR, '../../');
const PRIVATE_MODULE_PATH = path.join(SDK_DIR, 'mobile-sdk-native');
const GITHUB_ORG = 'selfxyz';
@@ -34,10 +35,10 @@ function log(message, type = 'info') {
console.log(`${prefix} ${message}`);
}
function runCommand(command, options = {}) {
function runCommand(command, options = {}, cwd = SDK_DIR) {
const defaultOptions = {
stdio: isDryRun ? 'pipe' : 'inherit',
cwd: SDK_DIR,
cwd: cwd,
encoding: 'utf8',
...options,
};
@@ -112,18 +113,98 @@ function setupSubmodule() {
}
try {
// Check if submodule already exists
if (fs.existsSync(PRIVATE_MODULE_PATH)) {
log('Submodule already exists, updating...', 'info');
runCommand(`git submodule update --init --recursive mobile-sdk-native`);
// Check if submodule is registered in .gitmodules (at repo root)
const gitmodulesPath = path.join(REPO_ROOT, '.gitmodules');
const gitmodulesExists = fs.existsSync(gitmodulesPath);
const gitmodulesContent = gitmodulesExists ? fs.readFileSync(gitmodulesPath, 'utf8') : '';
const isSubmoduleRegistered =
gitmodulesExists && gitmodulesContent.includes('[submodule "packages/mobile-sdk-alpha/mobile-sdk-native"]');
if (process.env.DEBUG_SETUP === 'true') {
log(`Environment: CI=${isCI}, hasAppToken=${!!appToken}, hasRepoToken=${!!repoToken}`, 'info');
log(`Submodule registered: ${isSubmoduleRegistered}`, 'info');
}
// Check if submodule directory exists and has content
const submoduleExists = fs.existsSync(PRIVATE_MODULE_PATH);
let submoduleHasContent = false;
try {
submoduleHasContent = submoduleExists && fs.readdirSync(PRIVATE_MODULE_PATH).length > 0;
} catch {
// Directory might not be readable, treat as empty
submoduleHasContent = false;
}
log(`Submodule directory exists: ${submoduleExists}, has content: ${submoduleHasContent}`, 'info');
// If submodule is registered, update its URL first (important for CI where we switch from SSH to HTTPS)
if (isSubmoduleRegistered) {
log(`Submodule is registered, updating URL from SSH to HTTPS...`, 'info');
log(`Target URL: ${submoduleUrl}`, 'info');
// Update submodule URL using git submodule set-url (Git 2.25+)
try {
const setUrlResult = runCommand(
`git submodule set-url packages/mobile-sdk-alpha/mobile-sdk-native "${submoduleUrl}"`,
{ stdio: 'pipe' },
REPO_ROOT,
);
log('Updated submodule URL using git submodule set-url', 'success');
log(`Command result: ${setUrlResult}`, 'info');
} catch (error) {
log(`git submodule set-url failed: ${error.message}`, 'warning');
// Fallback: Update .gitmodules file directly
try {
let gitmodulesContent = fs.readFileSync(gitmodulesPath, 'utf8');
log(`Current .gitmodules content:\n${gitmodulesContent}`, 'info');
// Replace the URL for mobile-sdk-native submodule
const oldContent = gitmodulesContent;
gitmodulesContent = gitmodulesContent.replace(
/(\[submodule\s+"packages\/mobile-sdk-alpha\/mobile-sdk-native"\]\s+path\s*=\s*packages\/mobile-sdk-alpha\/mobile-sdk-native\s+url\s*=\s*)[^\s]+/,
`$1${submoduleUrl}`,
);
if (oldContent !== gitmodulesContent) {
fs.writeFileSync(gitmodulesPath, gitmodulesContent, 'utf8');
log('Updated .gitmodules with new submodule URL', 'success');
log(`New .gitmodules content:\n${gitmodulesContent}`, 'info');
} else {
log('No changes made to .gitmodules - regex may not match', 'warning');
}
} catch (fallbackError) {
log(`Could not update .gitmodules: ${fallbackError.message}`, 'error');
}
}
}
// If directory exists but is empty, remove it so we can re-initialize
if (submoduleExists && !submoduleHasContent) {
log('Submodule directory exists but is empty, removing...', 'info');
runCommand(`rm -rf "${path.relative(REPO_ROOT, PRIVATE_MODULE_PATH)}"`, { stdio: 'pipe' }, REPO_ROOT);
}
if (isSubmoduleRegistered) {
// Submodule is registered, update/init it
log('Updating and initializing submodule...', 'info');
try {
const updateResult = runCommand(
`git submodule update --init --recursive packages/mobile-sdk-alpha/mobile-sdk-native`,
{},
REPO_ROOT,
);
log(`Submodule update completed: ${updateResult}`, 'success');
} catch (error) {
log(`Submodule update failed: ${error.message}`, 'error');
throw error;
}
} else {
// Add submodule
const addCommand = `git submodule add -b ${BRANCH} "${submoduleUrl}" mobile-sdk-native`;
// Submodule not registered, add it
log('Adding submodule...', 'info');
const addCommand = `git submodule add -b ${BRANCH} "${submoduleUrl}" packages/mobile-sdk-alpha/mobile-sdk-native`;
if (isCI && (appToken || repoToken)) {
// Security: Run command silently to avoid token exposure in logs
runCommand(addCommand, { stdio: 'pipe' });
runCommand(addCommand, { stdio: 'pipe' }, REPO_ROOT);
} else {
runCommand(addCommand);
runCommand(addCommand, {}, REPO_ROOT);
}
}