Skip to content
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

chore: add expo to test matrix #1132

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 != 'true'
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 == 'true'
run: npx create-expo-app test_project -t expo-template-blank-typescript --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 || 'false'}}

- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@ -135,6 +136,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 iOS
uses: actions/cache@v3
Expand Down Expand Up @@ -172,5 +174,67 @@ jobs:
NO_FLIPPER: 1

- name: Build test_project for iOS
if: env.turbo_cache_hit != 1
run: |
yarn turbo run test:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"

prebuild-expo:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
configurations: [{ react_native_version: 'expo', node_version: 18, is_expo: 'true' }]
env:
TURBO_CACHE_DIR: .turbo/android
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 Android
uses: actions/cache@v3
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-${{ matrix.configurations.react_native_version }}-turborepo-android-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.configurations.react_native_version }}-turborepo-android-

- name: Check turborepo cache for Expo
run: |
TURBO_CACHE_STATUS=$(node -p "($(yarn --silent turbo run test:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'test: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: '11'

- 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 }}-${{ matrix.configurations.react_native_version }}-gradle-${{ hashFiles('test_project/android/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-${{ matrix.configurations.react_native_version }}-gradle-

- name: Prebuild example for expo
run: yarn turbo run test:expo --cache-dir="${{ env.TURBO_CACHE_DIR }}"
Loading