Skip to content

Commit

Permalink
chore: add expo to test matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
dimninik committed Nov 9, 2023
1 parent baf25a9 commit 74056b0
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 26,306 deletions.
26 changes: 24 additions & 2 deletions .github/actions/setup_test_project/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ inputs:
NODE_VERSION:
description: Node version to use # https://github.com/actions/setup-node#supported-version-syntax
required: false
IS_EXPO:
description: Should template use expo
required: false
default: 'false'

runs:
using: composite
Expand All @@ -16,10 +20,24 @@ runs:
with:
node-version: ${{ inputs.NODE_VERSION }}

- name: Initialize project template
- name: Display current inputs
run: echo REACT_NATIVE_VERSION $REACT_NATIVE_VERSION & echo NODE_VERSION $NODE_VERSION & echo IS_EXPO $IS_EXPO
shell: bash
env:
REACT_NATIVE_VERSION: ${{ inputs.REACT_NATIVE_VERSION }}
NODE_VERSION: ${{ inputs.NODE_VERSION }}
IS_EXPO: ${{ inputs.IS_EXPO }}

- name: Initialize project default template
if: '${{ inputs.IS_EXPO || false }}'
run: npx react-native@latest init BlePlxExample --version ${{ inputs.REACT_NATIVE_VERSION }} --directory test_project --skip-install --verbose
shell: bash

- name: Initialize project expo template
if: '${{ inputs.IS_EXPO || false }}'
run: npx create-expo-app test_project --no-install
shell: bash

- name: Cache dependencies
id: yarn-cache
uses: actions/cache@v3
Expand All @@ -32,8 +50,12 @@ runs:
${{ runner.os }}-${{ inputs.REACT_NATIVE_VERSION }}-yarn-
- name: Copy project files
run: REACT_NATIVE_VERSION=${{ inputs.REACT_NATIVE_VERSION }} node ./scripts/copyExampleProjectFiles.js
run: node ./scripts/copyExampleProjectFiles.js
shell: bash
env:
REACT_NATIVE_VERSION: ${{ inputs.REACT_NATIVE_VERSION }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
IS_EXPO: ${{ inputs.IS_EXPO }}

- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
Expand Down
141 changes: 76 additions & 65 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ jobs:
strategy:
fail-fast: false
matrix:
configurations:
[
configurations: [
{ react_native_version: '0.72.6', node_version: 18 },
{ react_native_version: '0.71.14', node_version: 16 },
{ react_native_version: '0.70.13', node_version: 16 }
# { react_native_version: '0.71.14', node_version: 16 },
{ react_native_version: '0.70.13', node_version: 16 },
{ react_native_version: 'expo', node_version: 18, is_expo: true }
]
env:
TURBO_CACHE_DIR: .turbo/android
Expand All @@ -69,6 +69,7 @@ jobs:
with:
REACT_NATIVE_VERSION: ${{ matrix.configurations.react_native_version }}
NODE_VERSION: ${{ matrix.configurations.node_version }}
IS_EXPO: ${{ matrix.configurations.is_expo }}

- name: Cache turborepo for Android
uses: actions/cache@v3
Expand Down Expand Up @@ -110,67 +111,77 @@ jobs:
${{ runner.os }}-${{ matrix.configurations.react_native_version }}-gradle-
- name: Build example for Android
if: '${{ matrix.configurations.is_expo == false }}'
run: |
yarn turbo run test:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"
build-ios:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
configurations:
[
{ react_native_version: '0.72.6', node_version: 18 },
{ react_native_version: '0.71.14', node_version: 16 },
{ react_native_version: '0.70.13', node_version: 16 }
]
env:
TURBO_CACHE_DIR: .turbo/ios
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup_test_project
with:
REACT_NATIVE_VERSION: ${{ matrix.configurations.react_native_version }}
NODE_VERSION: ${{ matrix.configurations.node_version }}

- name: Cache turborepo for iOS
uses: actions/cache@v3
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-${{ matrix.configurations.react_native_version }}-turborepo-ios-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.configurations.react_native_version }}-turborepo-ios-
- name: Check turborepo cache for iOS
run: |
TURBO_CACHE_STATUS=$(node -p "($(yarn --silent turbo run test:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'test:ios').cache.status")
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
echo "turbo_cache_hit=1" >> $GITHUB_ENV
fi
- name: Cache cocoapods
if: env.turbo_cache_hit != 1
id: cocoapods-cache
uses: actions/cache@v3
with:
path: |
**/ios/Pods
key: ${{ runner.os }}-${{ matrix.configurations.react_native_version }}-cocoapods-${{ hashFiles('test_project/ios/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.configurations.react_native_version }}-cocoapods-
- name: Install cocoapods
if: env.turbo_cache_hit != 1
run: |
cd test_project/ios
pod install --verbose
env:
NO_FLIPPER: 1

- name: Build test_project for iOS
run: |
yarn turbo run test:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
- name: Build example for expo Android
if: '${{ matrix.configurations.is_expo == true }}'
run: cd test_project && npx expo run:android

# build-ios:
# runs-on: macos-latest
# strategy:
# fail-fast: false
# matrix:
# configurations: []
# # { react_native_version: '0.72.6', node_version: 18 },
# # { react_native_version: '0.71.14', node_version: 16 },
# # { react_native_version: '0.70.13', node_version: 16 },
# # { react_native_version: 'expo', node_version: 18, is_expo: true }
# env:
# TURBO_CACHE_DIR: .turbo/ios
# steps:
# - name: Checkout
# uses: actions/checkout@v3

# - name: Setup
# uses: ./.github/actions/setup_test_project
# with:
# REACT_NATIVE_VERSION: ${{ matrix.configurations.react_native_version }}
# NODE_VERSION: ${{ matrix.configurations.node_version }}
# IS_EXPO: ${{ matrix.configurations.is_expo }}

# - name: Cache turborepo for iOS
# uses: actions/cache@v3
# with:
# path: ${{ env.TURBO_CACHE_DIR }}
# key: ${{ runner.os }}-${{ matrix.configurations.react_native_version }}-turborepo-ios-${{ hashFiles('**/yarn.lock') }}
# restore-keys: |
# ${{ runner.os }}-${{ matrix.configurations.react_native_version }}-turborepo-ios-

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

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

# - name: Cache cocoapods
# if: env.turbo_cache_hit != 1
# id: cocoapods-cache
# uses: actions/cache@v3
# with:
# path: |
# **/ios/Pods
# key: ${{ runner.os }}-${{ matrix.configurations.react_native_version }}-cocoapods-${{ hashFiles('test_project/ios/Podfile.lock') }}
# restore-keys: |
# ${{ runner.os }}-${{ matrix.configurations.react_native_version }}-cocoapods-

# - name: Install cocoapods
# if: env.turbo_cache_hit != 1
# run: |
# cd test_project/ios
# pod install --verbose
# env:
# NO_FLIPPER: 1

# - name: Build test_project for iOS
# if: env.turbo_cache_hit != 1 && '${{ matrix.configurations.is_expo == false }}'
# run: |
# yarn turbo run test:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"

# - name: Build test_project for expo iOS
# if: env.turbo_cache_hit != 1 && '${{ matrix.configurations.is_expo == true }}'
# run: yarn turbo run test:iosExpo --cache-dir="${{ env.TURBO_CACHE_DIR }}"
Loading

0 comments on commit 74056b0

Please sign in to comment.