- Added .pnpmrc for pnpm 10 configuration, enabling peer dependencies and lifecycle scripts. - Updated package.json to reflect pnpm version change to 10.11.1 and added onlyBuiltDependencies. - Update pipelines to reflect pnpm version update to 10.11.1 ## Upgrading your pnpm version Now to upgrade your `pnpm` version you can run `pnpm migrate-to-pnpm-version 10`. Which would upgrade your `pnpm` and it will run the upgrade script. Later on if you want to upgrade to pnpm v11 you can run `pnpm migrate-to-pnpm-version 11`. Additionally, if you just want to upgrade to the version that is inside of `package.json` you would run `pnpm migrate-to-pnpm-version` without passing in a major version.
317 lines
10 KiB
YAML
317 lines
10 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- '[0-9]+.[0-9]+.x'
|
|
pull_request:
|
|
branches:
|
|
- "**"
|
|
|
|
env:
|
|
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
|
|
PNPM_HOME: ~/.pnpm
|
|
|
|
jobs:
|
|
main-linux:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
NX_E2E_CI_CACHE_KEY: e2e-github-linux
|
|
NX_DAEMON: 'true'
|
|
NX_PERF_LOGGING: 'false'
|
|
NX_VERBOSE_LOGGING: 'false'
|
|
NX_NATIVE_LOGGING: 'false'
|
|
NX_E2E_RUN_E2E: 'true'
|
|
NX_CI_EXECUTION_ENV: 'linux'
|
|
NX_CLOUD_NO_TIMEOUTS: 'true'
|
|
NX_ALLOW_NON_CACHEABLE_DTE: 'true'
|
|
NX_CLOUD_USE_NEW_TASK_APIS: 'true'
|
|
NX_CLOUD_USE_NEW_STREAM_OUTPUT: 'true'
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
filter: tree:0
|
|
|
|
- name: Fetch Master
|
|
run: git fetch origin master:master
|
|
if: ${{ github.event_name == 'pull_request' }}
|
|
|
|
- name: Set SHAs
|
|
uses: nrwl/nx-set-shas@v4
|
|
with:
|
|
main-branch-name: 'master'
|
|
|
|
- name: Start CI Run
|
|
run: npx nx-cloud@next start-ci-run --distribute-on="./.nx/workflows/dynamic-changesets.yaml" --stop-agents-after="e2e"
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y ca-certificates lsof libvips-dev libglib2.0-dev libgirepository1.0-dev
|
|
|
|
- name: Install Chrome
|
|
uses: browser-actions/setup-chrome@v1
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
name: Install pnpm
|
|
with:
|
|
version: 10.11.1
|
|
run_install: false
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: 'pnpm'
|
|
|
|
- name: Cache Rust toolchain and cargo registry
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
target/
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-cargo-
|
|
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Setup Java
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: 17
|
|
|
|
- name: Setup Gradle
|
|
uses: gradle/actions/setup-gradle@v4
|
|
|
|
- name: Install project dependencies
|
|
run: |
|
|
pnpm install --frozen-lockfile
|
|
pnpm playwright install --with-deps
|
|
|
|
- name: Check Documentation
|
|
run: pnpm nx documentation
|
|
timeout-minutes: 20
|
|
|
|
- name: Run Checks/Lint/Test/Build
|
|
run: |
|
|
pids=()
|
|
|
|
pnpm nx-cloud record -- nx format:check &
|
|
pids+=($!)
|
|
|
|
pnpm nx-cloud record -- nx sync:check
|
|
pids+=($!)
|
|
|
|
pnpm nx-cloud record -- nx-cloud conformance:check
|
|
pids+=($!)
|
|
|
|
pnpm nx run-many -t check-imports check-commit check-lock-files check-codeowners --parallel=1 --no-dte &
|
|
pids+=($!)
|
|
|
|
pnpm nx affected --targets=lint,test,build,e2e,e2e-ci,format-native,lint-native &
|
|
pids+=($!)
|
|
|
|
for pid in "${pids[@]}"; do
|
|
wait "$pid"
|
|
done
|
|
timeout-minutes: 100
|
|
|
|
main-macos:
|
|
runs-on: macos-latest
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}${{ contains(github.event_name, 'push') && format('-{0}', github.sha) || '' }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
NX_E2E_CI_CACHE_KEY: e2e-github-macos
|
|
NX_PERF_LOGGING: 'false'
|
|
NX_CI_EXECUTION_ENV: 'macos'
|
|
SELECTED_PM: 'npm'
|
|
steps:
|
|
|
|
- name: Log concurrency info
|
|
run: |
|
|
echo "Concurrency group: ${{ github.workflow }}-${{ github.ref }}${{ contains(github.event_name, 'push') && format('-{0}', github.sha) || '' }}"
|
|
echo "Concurrency cancel-in-progress: ${{ !contains(github.event_name, 'push') }}"
|
|
echo "Concurrency cancel-event-name: ${{ github.event_name }}"
|
|
if: always()
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
filter: tree:0
|
|
|
|
- name: Fetch Master
|
|
run: git fetch origin master:master
|
|
if: ${{ github.event_name == 'pull_request' }}
|
|
|
|
- name: Restore Homebrew packages
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
/opt/homebrew
|
|
~/Library/Caches/Homebrew
|
|
key: nrwl-nx-homebrew-packages
|
|
|
|
- name: Configure Detox Environment, Install applesimutils
|
|
run: |
|
|
# Ensure Xcode command line tools are installed and configured
|
|
xcode-select --print-path || sudo xcode-select --reset
|
|
sudo xcode-select -s /Applications/Xcode.app
|
|
|
|
# Install or update applesimutils with error handling
|
|
if ! brew list applesimutils &>/dev/null; then
|
|
echo "Installing applesimutils..."
|
|
HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew >/dev/null
|
|
HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils >/dev/null || {
|
|
echo "Failed to install applesimutils, retrying with update..."
|
|
brew update
|
|
HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils
|
|
}
|
|
else
|
|
echo "Updating applesimutils..."
|
|
HOMEBREW_NO_AUTO_UPDATE=1 brew upgrade applesimutils || true
|
|
fi
|
|
|
|
# Verify applesimutils installation
|
|
applesimutils --version || (echo "applesimutils installation failed" && exit 1)
|
|
|
|
# Configure environment for M-series Mac
|
|
echo "DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer" >> $GITHUB_ENV
|
|
echo "PLATFORM_NAME=iOS Simulator" >> $GITHUB_ENV
|
|
|
|
# Set additional environment variables for better debugging
|
|
echo "DETOX_DISABLE_TELEMETRY=1" >> $GITHUB_ENV
|
|
echo "DETOX_LOG_LEVEL=trace" >> $GITHUB_ENV
|
|
|
|
# Verify Xcode installation
|
|
xcodebuild -version
|
|
|
|
# List available simulators
|
|
xcrun simctl list devices available
|
|
timeout-minutes: 10
|
|
continue-on-error: false
|
|
|
|
- name: Reset iOS Simulators
|
|
id: reset-simulators
|
|
run: |
|
|
echo "Resetting iOS Simulators..."
|
|
|
|
# Kill simulator processes
|
|
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService 2>/dev/null || true
|
|
killall "Simulator" 2>/dev/null || true
|
|
killall "iOS Simulator" 2>/dev/null || true
|
|
|
|
# Wait for processes to terminate
|
|
sleep 3
|
|
|
|
# Shutdown and erase all simulators (ignore failures)
|
|
xcrun simctl shutdown all 2>/dev/null || true
|
|
sleep 5
|
|
xcrun simctl erase all 2>/dev/null || true
|
|
|
|
# If erase failed, try the nuclear option
|
|
if xcrun simctl list devices | grep -q "Booted" 2>/dev/null; then
|
|
echo "Standard reset failed, using nuclear option..."
|
|
rm -rf ~/Library/Developer/CoreSimulator/Devices/* 2>/dev/null || true
|
|
launchctl remove com.apple.CoreSimulator.CoreSimulatorService 2>/dev/null || true
|
|
sleep 3
|
|
fi
|
|
|
|
# Clean up additional directories
|
|
rm -rf ~/Library/Developer/CoreSimulator/Caches/* 2>/dev/null || true
|
|
rm -rf ~/Library/Logs/CoreSimulator/* 2>/dev/null || true
|
|
rm -rf ~/Library/Developer/Xcode/DerivedData/* 2>/dev/null || true
|
|
|
|
echo "Simulator reset completed"
|
|
timeout-minutes: 5
|
|
continue-on-error: true
|
|
|
|
- name: Verify Simulator Reset
|
|
if: ${{ steps.reset-simulators.outcome == 'success' }}
|
|
run: |
|
|
# Verify CoreSimulator service restarted
|
|
pgrep -fl "CoreSimulator" || (echo "CoreSimulator service not running" && exit 1)
|
|
|
|
# Check simulator list is clean
|
|
xcrun simctl list devices
|
|
|
|
# Verify simulator runtime paths exist and are writable
|
|
test -d ~/Library/Developer/CoreSimulator/Devices || (echo "Simulator devices directory missing" && exit 1)
|
|
touch ~/Library/Developer/CoreSimulator/Devices/test || (echo "Simulator devices directory not writable" && exit 1)
|
|
rm ~/Library/Developer/CoreSimulator/Devices/test
|
|
timeout-minutes: 5
|
|
|
|
- name: Diagnose Simulator Reset Failure
|
|
if: ${{ steps.reset-simulators.outcome == 'failure' }}
|
|
run: |
|
|
echo "Simulator reset failed. Collecting diagnostic information..."
|
|
xcrun simctl list
|
|
echo "Checking simulator logs..."
|
|
ls -la ~/Library/Logs/CoreSimulator/ || echo "No simulator logs found"
|
|
|
|
- name: Save Homebrew Cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
/opt/homebrew
|
|
~/Library/Caches/Homebrew
|
|
key: nrwl-nx-homebrew-packages
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
name: Install pnpm
|
|
with:
|
|
version: 10.11.1
|
|
run_install: false
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: 'pnpm'
|
|
|
|
- name: Cache Rust toolchain and cargo registry
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
target/
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-cargo-
|
|
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Install project dependencies
|
|
run: |
|
|
pnpm install --frozen-lockfile
|
|
pnpm playwright install --with-deps
|
|
|
|
- name: Set SHAs
|
|
uses: nrwl/nx-set-shas@v4
|
|
with:
|
|
main-branch-name: 'master'
|
|
|
|
- name: Run E2E Tests for macOS
|
|
run: |
|
|
HAS_CHANGED=$(node ./scripts/check-react-native-changes.js $NX_BASE $NX_HEAD);
|
|
if $HAS_CHANGED; then
|
|
pnpm nx affected -t e2e-macos-local --parallel=1 --base=$NX_BASE --head=$NX_HEAD
|
|
else
|
|
echo "Skip E2E tests for macOS as there are no changes in React Native projects."
|
|
fi
|