react-native/scripts/validate-ios-test-env.sh
Lorenzo Sciandra f1488db109 bump Node references from 12/14 to 14/16 (#32980)
Summary:
Node 16 has been the LTS for quite some time now ([Oct 2021](https://nodejs.org/en/blog/release/v16.13.0/)), so this PR just wants to bring the RN OSS CI up to speed.

(I realized that this was needed while doing the same for macos https://github.com/microsoft/react-native-macos/pull/997)

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Changed] - CI moved to Node 16.

Pull Request resolved: https://github.com/facebook/react-native/pull/32980

Test Plan: CI itself is the test � locally no significant changes were experienced.

Reviewed By: cortinico

Differential Revision: D33821288

Pulled By: ShikaSD

fbshipit-source-id: 4480ae1cb909e2b8d0b6abba4db76bbe71f0193e
2022-01-28 05:07:18 -08:00

48 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# This script validates that iOS is set up correctly for the
# testing environment.
#
# In particular, it checks that the minimum required Xcode version is installed.
# It also checks that the correct Node version is installed.
# Function used to compare dot separated version numbers
function version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; }
# Check that node is installed.
if [ -z "$(which node)" ]; then
echo "Could not find Node binary. Please check your nodejs install."
echo "See https://reactnative.dev/docs/getting-started for instructions."
exit 1
fi
# Check that the correct version of node is installed
NODE_VERSION="$(command node --version | sed 's/[-/a-zA-Z]//g' |sed 's/.\{2\}$//')"
if (( $(echo "${NODE_VERSION} < 14.0" | bc -l) )); then
echo "Node ${NODE_VERSION} detected. This version of Node is not supported."
echo "See https://reactnative.dev/docs/getting-started for instructions."
exit 1
fi
# Check that Xcode is installed.
if [ -z "$(which xcodebuild)" ]; then
echo "Could not find Xcode build tools. Please check your Xcode install."
echo "See https://reactnative.dev/docs/getting-started for instructions."
exit 1
fi
MIN_XCODE_VERSION=9.4
# Check that the correct version of Xcode is installed
XCODE_VERSION="$(command xcodebuild -version | sed '$ d' | sed 's/[-/a-zA-Z]//g')"
if (version_gt $MIN_XCODE_VERSION $XCODE_VERSION) && [ "$XCODE_VERSION" != "$MIN_XCODE_VERSION" ]; then
echo "Xcode ${XCODE_VERSION} detected. React Native requires ${MIN_XCODE_VERSION} or newer."
echo "Older versions of Xcode may cause cryptic build errors."
echo "See https://reactnative.dev/docs/getting-started for instructions."
exit 1
fi