chore: improve ci workflow (#2499)

# Summary
This commit is contained in:
Jakub Grzywacz
2024-10-23 10:02:46 +02:00
committed by GitHub
parent 3faf625fee
commit 3aebbb22fd
7 changed files with 161 additions and 170 deletions

View File

@@ -1,8 +1,8 @@
name: Test Android build
name: Example Android check
on:
pull_request:
paths:
- '.github/workflows/android-build-test.yml'
- .github/workflows/android-build-test.yml
- 'android/**'
- 'src/fabric/**'
- 'package.json'
@@ -13,6 +13,7 @@ on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
@@ -20,63 +21,50 @@ jobs:
strategy:
matrix:
working-directory: [example, fabric-example]
fail-fast: false
concurrency:
group: android-${{ matrix.working-directory }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Checkout Git repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: Accept licenses
run: /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
- name: Restore svg node_modules from cache
uses: actions/cache@v2
id: cache-node-modules-svg
- name: Get react-native-svg node_modules cache
uses: actions/cache@v4
with:
path: |
node_modules
path: node_modules
key: ${{ runner.os }}-node-modules-svg-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-modules-svg
- name: Install svg node_modules
restore-keys: ${{ runner.os }}-node-modules-svg-
- name: Install react-native-svg node_modules
run: yarn install --frozen-lockfile
- name: Restore app node_modules from cache
uses: actions/cache@v2
id: cache-node-modules-app
- name: Get app node_modules cache
uses: actions/cache@v4
with:
path: |
${{ matrix.working-directory }}/node_modules
path: ${{ matrix.working-directory }}/node_modules
key: ${{ runner.os }}-node-modules-${{ matrix.working-directory }}-${{ hashFiles(format('{0}/yarn.lock', matrix.working-directory)) }}
restore-keys: |
${{ runner.os }}-node-modules-${{ matrix.working-directory }}-
restore-keys: ${{ runner.os }}-node-modules-${{ matrix.working-directory }}-
- name: Install app node_modules
working-directory: ${{ matrix.working-directory }}
run: yarn install --frozen-lockfile
- name: Restore build from cache
uses: actions/cache@v3
- name: Get build cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
android/build
android/.cxx
${{ matrix.working-directory }}/android/build
${{ matrix.working-directory }}/android/.cxx
${{ matrix.working-directory }}/android/.gradle
${{ matrix.working-directory }}/android/app/build
${{ matrix.working-directory }}/android/app/.cxx
${{ matrix.working-directory }}/node_modules/react-native/ReactAndroid/build
${{ matrix.working-directory }}/node_modules/react-native/ReactAndroid/hermes-engine/build
${{ matrix.working-directory }}/node_modules/react-native/ReactAndroid/hermes-engine/.cxx
key: ${{ runner.os }}-build5-${{ matrix.working-directory }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'android/build.gradle', format('{0}/node_modules/react-native/sdks/.hermesversion', matrix.working-directory)) }}
key: ${{ runner.os }}-gradle-${{matrix.working-directory}}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-${{matrix.working-directory}}-
- name: Build app
working-directory: ${{ matrix.working-directory }}/android

View File

@@ -1,14 +1,14 @@
name: Test Android e2e
name: E2E Android
on:
pull_request:
paths:
- '.github/workflows/android-e2e-test.yml'
- 'apps/examples/**'
- 'example/**'
- 'android/**'
- 'src/**'
- 'e2e/**'
- 'package.json'
- .github/workflows/e2e-android.yml
- apps/examples/**
- example/**
- android/**
- src/**
- e2e/**
- package.json
# push:
# branches:
# - main

93
.github/workflows/e2e-ios.yml vendored Normal file
View File

@@ -0,0 +1,93 @@
name: E2E iOS
on:
pull_request:
paths:
- .github/workflows/ios-e2e.yml
- apps/examples/**
- apple/**
- src/**
- e2e/**
- package.json
push:
branches:
- main
workflow_dispatch:
jobs:
test:
runs-on: macos-14
timeout-minutes: 60
strategy:
matrix:
working-directory: [example]
fail-fast: false
env:
DEVICE: iPhone 16 Pro
steps:
- name: Checkout Git repository
uses: actions/checkout@v4
- name: Use latest stable Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Get react-native-svg node_modules cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-svg-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-node-modules-svg-
- name: Install react-native-svg node_modules
run: yarn install --frozen-lockfile
- name: Get app node_modules cache
uses: actions/cache@v4
with:
path: ${{ matrix.working-directory }}/node_modules
key: ${{ runner.os }}-node-modules-${{ matrix.working-directory }}-${{ hashFiles(format('{0}/yarn.lock', matrix.working-directory)) }}
restore-keys: ${{ runner.os }}-node-modules-${{ matrix.working-directory }}-
- name: Install app node_modules
working-directory: ${{ matrix.working-directory }}
run: yarn install --frozen-lockfile
- name: Get Pods cache
uses: actions/cache@v4
with:
path: ${{ matrix.working-directory }}/ios/Pods
key: ${{ runner.os }}-pods-${{ matrix.working-directory }}-${{ hashFiles(format('{0}/ios/Podfile.lock', matrix.working-directory)) }}
restore-keys: |
${{ runner.os }}-pods-${{ matrix.working-directory }}-
- name: Install Pods
working-directory: ${{ matrix.working-directory }}/ios
run: bundle install && bundle exec pod install
- name: Get build artifacts cache
uses: actions/cache@v4
with:
path: ~/Library/Developer/Xcode/DerivedData
key: ${{ runner.os }}-ios-derived-data-${{ matrix.working-directory }}-${{ hashFiles(format('{0}/ios/Podfile.lock', matrix.working-directory)) }}
restore-keys: |
${{ runner.os }}-ios-derived-data-${{ matrix.working-directory }}-
- name: Start Metro server
working-directory: ${{ matrix.working-directory }}
run: E2E=true yarn start &> output.log &
- name: Build app
working-directory: ${{ matrix.working-directory }}
run: E2E=true npx react-native@latest run-ios --simulator="${{ env.DEVICE }}" --mode Debug --verbose
- name: Run e2e Tests
run: E2E=true yarn e2e
- name: Upload test report
uses: actions/upload-artifact@v4
with:
name: report
path: |
report.html
jest-html-reporters-attach/

View File

@@ -1,19 +1,20 @@
name: Test iOS build
name: Example iOS check
on:
pull_request:
paths:
- .github/workflows/ios-build-test.yml
- RNSVG.podspec
- apple/**
- src/fabric/**
- package.json
- example/package.json
- example/ios/**
- src/fabric/**
- fabric-example/package.json
- fabric-example/ios/**
- package.json
push:
branches:
- main
workflow_dispatch:
jobs:
build:
@@ -26,16 +27,16 @@ jobs:
group: ios-${{ matrix.working-directory }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Checkout Git repository
uses: actions/checkout@v4
- name: Use latest stable Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Restore react-native-svg node_modules from cache
uses: actions/cache@v3
- name: Get react-native-svg node_modules cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-svg-${{ hashFiles('yarn.lock') }}
@@ -44,8 +45,8 @@ jobs:
- name: Install react-native-svg node_modules
run: yarn install --frozen-lockfile
- name: Restore app node_modules from cache
uses: actions/cache@v3
- name: Get app node_modules cache
uses: actions/cache@v4
with:
path: ${{ matrix.working-directory }}/node_modules
key: ${{ runner.os }}-node-modules-${{ matrix.working-directory }}-${{ hashFiles(format('{0}/yarn.lock', matrix.working-directory)) }}
@@ -55,25 +56,26 @@ jobs:
working-directory: ${{ matrix.working-directory }}
run: yarn install --frozen-lockfile
- name: Restore Pods from cache
uses: actions/cache@v3
- name: Get Pods cache
uses: actions/cache@v4
with:
path: |
${{ matrix.working-directory }}/ios/Pods
~/Library/Caches/CocoaPods
~/.cocoapods
path: ${{ matrix.working-directory }}/ios/Pods
key: ${{ runner.os }}-pods-${{ matrix.working-directory }}-${{ hashFiles(format('{0}/ios/Podfile.lock', matrix.working-directory)) }}
restore-keys: |
${{ runner.os }}-pods-${{ matrix.working-directory }}-
- name: Install Pods
working-directory: ${{ matrix.working-directory }}/ios
run: bundle install && bundle exec pod install
- name: Restore build artifacts from cache
uses: actions/cache@v3
- name: Get build artifacts cache
uses: actions/cache@v4
with:
path: ~/Library/Developer/Xcode/DerivedData
key: ${{ runner.os }}-ios-derived-data-${{ matrix.working-directory }}-${{ hashFiles(format('{0}/ios/Podfile.lock', matrix.working-directory)) }}
restore-keys: |
${{ runner.os }}-ios-derived-data-${{ matrix.working-directory }}-
- name: Build app
working-directory: ${{ matrix.working-directory }}
run: npx react-native@latest run-ios --simulator="iPhone 16 Pro" --mode Debug --verbose --terminal /bin/zsh
run: npx react-native run-ios --simulator="iPhone 15 Pro" --mode Debug --verbose --no-packager

View File

@@ -1,93 +0,0 @@
name: Test iOS e2e
on:
pull_request:
paths:
- '.github/workflows/android-e2e-test.yml'
- 'apps/examples/**'
- 'example/**'
- 'apple/**'
- 'src/**'
- 'e2e/**'
- 'package.json'
push:
branches:
- main
workflow_dispatch:
jobs:
test:
runs-on: macos-14
timeout-minutes: 60
env:
WORKING_DIRECTORY: example
DEVICE: iPhone 16 Pro
XCODE_VERSION: latest-stable
concurrency:
group: ios-e2e-example-${{ github.ref }}
cancel-in-progress: true
steps:
- name: checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Use latest stable Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Restore react-native-svg node_modules from cache
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-modules-svg-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-node-modules-svg-
- name: Install react-native-svg node_modules
run: yarn install --frozen-lockfile
- name: Restore app node_modules from cache
uses: actions/cache@v3
with:
path: ${{ env.WORKING_DIRECTORY }}/node_modules
key: ${{ runner.os }}-node-modules-${{ env.WORKING_DIRECTORY }}-${{ hashFiles(format('{0}/yarn.lock', env.WORKING_DIRECTORY)) }}
restore-keys: ${{ runner.os }}-node-modules-${{ env.WORKING_DIRECTORY }}-
- name: Install app node_modules
working-directory: ${{ env.WORKING_DIRECTORY }}
run: yarn install --frozen-lockfile
- name: Restore Pods from cache
uses: actions/cache@v3
with:
path: |
${{ env.WORKING_DIRECTORY }}/ios/Pods
~/Library/Caches/CocoaPods
~/.cocoapods
key: ${{ runner.os }}-pods-${{ env.WORKING_DIRECTORY }}-${{ hashFiles(format('{0}/ios/Podfile.lock', env.WORKING_DIRECTORY)) }}
- name: Install Pods
working-directory: ${{ env.WORKING_DIRECTORY }}/ios
run: bundle install && bundle exec pod install
- name: Restore build artifacts from cache
uses: actions/cache@v3
with:
path: ~/Library/Developer/Xcode/DerivedData
key: ${{ runner.os }}-ios-derived-data-${{ env.WORKING_DIRECTORY }}-${{ hashFiles(format('{0}/ios/Podfile.lock', env.WORKING_DIRECTORY)) }}
- name: Start Metro server
working-directory: ${{ env.WORKING_DIRECTORY }}
run: E2E=true yarn start &> output.log &
- name: Build app
working-directory: ${{ env.WORKING_DIRECTORY }}
run: E2E=true npx react-native@latest run-ios --simulator="${{ env.DEVICE }}" --mode Debug --verbose
- name: Run e2e Tests
run: E2E=true yarn e2e
- name: Upload test report
uses: actions/upload-artifact@v4
with:
name: report
path: |
report.html
jest-html-reporters-attach/

View File

@@ -1,4 +1,7 @@
name: Test JS build
concurrency:
group: js-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
branches:
@@ -9,24 +12,22 @@ on:
jobs:
build:
runs-on: ubuntu-latest
concurrency:
group: js-${{ github.ref }}
cancel-in-progress: true
steps:
- name: checkout
uses: actions/checkout@v2
- name: Use Node.js 18
uses: actions/setup-node@v2
uses: actions/checkout@v4
- name: Get react-native-svg node_modules cache
uses: actions/cache@v4
with:
node-version: 18
cache: 'yarn'
cache-dependency-path: 'yarn.lock'
- name: Install node dependencies
run: yarn
path: node_modules
key: ${{ runner.os }}-node-modules-svg-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-node-modules-svg-
- name: Install react-native-svg node_modules
run: yarn install --frozen-lockfile
- name: Build
run: yarn bob
- name: Test and lint
run: yarn test
- name: Build Example App
working-directory: example/
run: yarn && yarn tsc

View File

@@ -10,7 +10,7 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=2048m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit