Skip to content

Commit

Permalink
Merge pull request #254 from klarna/update-testapp-reactnative
Browse files Browse the repository at this point in the history
Update testapp reactnative version and optimize workflows
  • Loading branch information
NMGuner authored Jun 13, 2024
2 parents 83af24a + 395b580 commit ac2f8e7
Show file tree
Hide file tree
Showing 57 changed files with 22,025 additions and 15,665 deletions.
20 changes: 20 additions & 0 deletions .github/actions/prepare-android/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Prepare Android
description: Prepare Android environment

runs:
using: composite
steps:
- name: Set up our JDK environment
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
cache-dependency-path: |
**/*.gradle*
**/gradle-wrapper.properties
- name: Finalize Android SDK
shell: bash
run: |
/bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
15 changes: 15 additions & 0 deletions .github/actions/prepare-ios/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Prepare iOS
description: Prepare iOS environment

runs:
using: composite
steps:
- name: Cache Pods
uses: actions/cache@v4
with:
path: |
ios/Pods
TestApp/ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
7 changes: 5 additions & 2 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ description: Setup Node.js and install dependencies
runs:
using: composite
steps:
- name: Enable corepack
shell: bash
run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18.17.1'
cache: 'yarn'
Expand All @@ -24,6 +27,6 @@ runs:
- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: |
yarn install --cwd TestApp --frozen-lockfile
yarn install --frozen-lockfile
(cd TestApp;yarn install --frozen-lockfile)
shell: bash
90 changes: 0 additions & 90 deletions .github/workflows/integration_tests.yml

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Lint files
run: |
yarn lint
yarn TestApp lint
(cd TestApp;yarn lint)
- name: Typecheck files
run: yarn typecheck
Expand All @@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup
Expand All @@ -38,7 +38,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup
Expand Down
127 changes: 35 additions & 92 deletions .github/workflows/native_tests_and_apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,133 +9,76 @@ on:
- master

jobs:
build-android:
test-native-android:
runs-on: ubuntu-latest
env:
TURBO_CACHE_DIR: .turbo/android
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Cache turborepo for Android
uses: actions/cache@v3
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-turborepo-android-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-turborepo-android-
- name: Check turborepo cache for Android
run: |
TURBO_CACHE_STATUS=$(node -p "($(yarn --silent turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status")
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
echo "turbo_cache_hit=1" >> $GITHUB_ENV
fi
# setup JDK environment
- name: Set up our JDK environment
uses: actions/setup-java@v3
with:
distribution: temurin
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 }}-gradle-${{ hashFiles('TestApp/android/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Prepare Android
uses: ./.github/actions/prepare-android

- name: Run Unit Tests for Android
run: yarn test:android
build-testapp-android:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Prepare Android
uses: ./.github/actions/prepare-android

- name: Bundle TestApp JS for Android
run: mkdir TestApp/android/app/src/main/assets && yarn TestApp bundle:android
run: mkdir TestApp/android/app/src/main/assets && (cd TestApp;yarn bundle:android)

- name: Build TestApp for Android
run: |
yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"
yarn run build:android
build-ios:
test-native-ios:
runs-on: macos-latest
env:
TURBO_CACHE_DIR: .turbo/ios
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

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

- name: Install Lib cocoapods
run: |
yarn pods
env:
NO_FLIPPER: 1
(cd ios;pod install)
- name: Run Unit Tests for iOS
run: yarn test:ios
build-testapp-ios:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Cache TestApp cocoapods
if: env.turbo_cache_hit != 1
id: cocoapods-cache
uses: actions/cache@v3
with:
path: |
TestApp/**/ios/Pods
key: ${{ runner.os }}-cocoapods-${{ hashFiles('TestApp/ios/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-cocoapods-
- name: Prepare iOS
uses: ./.github/actions/prepare-ios

- name: Install TestApp cocoapods
run: |
yarn TestApp pods
env:
NO_FLIPPER: 1
(cd TestApp/ios;pod install)
- name: Bundle TestApp JS for iOS
run: yarn TestApp bundle:ios
run: (cd TestApp;yarn bundle:ios)

- name: Build TestApp for iOS
run: |
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
yarn run build:ios
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ buck-out/
android/app/libs
android/keystores/debug.keystore

# Yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Expo
.expo/

Expand Down
5 changes: 0 additions & 5 deletions .yarnrc

This file was deleted.

1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
Loading

0 comments on commit ac2f8e7

Please sign in to comment.