Skip to content

NC-4886 Update NamiCampaignManager.refresh #547

NC-4886 Update NamiCampaignManager.refresh

NC-4886 Update NamiCampaignManager.refresh #547

Workflow file for this run

name: CI PR Checks
on: pull_request
jobs:
eslint:
name: ESLint
permissions:
actions: write
contents: write
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: "18"
- name: 'Checkout ${{ inputs.ref }}'
uses: actions/checkout@v3
with:
path: source
ref: '${{ inputs.ref }}'
- name: Install dependencies
run: yarn --frozen-lockfile --prefer-offline
working-directory: source/
- name: Linter
run: |
npx eslint . --ext .js,.jsx,.ts,.tsx
working-directory: source/
tsc:
name: Generate Declaration Files
permissions:
actions: write
contents: write
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: "18"
- name: 'Checkout ${{ inputs.ref }}'
uses: actions/checkout@v3
with:
path: source
ref: '${{ inputs.ref }}'
- name: Install dependencies
run: yarn --frozen-lockfile --prefer-offline
working-directory: source/
- name: Generate .d files
run: |
npx tsc
working-directory: source/
eslintapps:
name: ESLint Sample Apps
permissions:
actions: write
contents: write
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: "18"
- name: 'Checkout ${{ inputs.ref }}'
uses: actions/checkout@v3
with:
path: source
ref: '${{ inputs.ref }}'
- name: Install Basic app dependencies
run: yarn --frozen-lockfile --prefer-offline
working-directory: source/examples/Basic
- name: Linter Basic
run: |
npx eslint . --ext .js,.jsx,.ts,.tsx
working-directory: source/examples/Basic
- name: Install TestNamiTV app dependencies
run: yarn --frozen-lockfile --prefer-offline
working-directory: source/examples/TestNamiTV
- name: Linter TestNamiTV
run: |
npx eslint . --ext .js,.jsx,.ts,.tsx
working-directory: source/examples/TestNamiTV
e2e-ios:
runs-on: macos-12
env:
DETOX_CONFIGURATION: ios.sim.release
steps:
- uses: actions/setup-node@v3
with:
node-version: 18
- name: 'Checkout ${{ inputs.ref }}'
uses: actions/checkout@v3
with:
path: source
ref: '${{ inputs.ref }}'
- name: Cache node_modules
uses: actions/cache@v3
id: cache
with:
path: source/examples/Basic/node_modules
key: node-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install Yarn Dependencies
run: yarn install
working-directory: source/examples/Basic
- name: Install macOS dependencies
run: |
brew tap wix/brew
brew install applesimutils
sudo gem install cocoapods
gem install CFPropertyList
env:
# Speed up build could be updated 0/1 for full install
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
- name: Update App Platform ID
working-directory: source/examples/Basic/config/
run: |
sed -i '' -e "s/APPLE_PROD_APP_PLATFORM_ID/$BASIC_APPLE_PROD_APP_PLATFORM_ID/" index.ts
env:
BASIC_APPLE_PROD_APP_PLATFORM_ID: '${{ secrets.APPLE_PROD_APP_PLATFORM_ID }}'
# - name: Cache Pods
# uses: actions/cache@v3
# id: podcache
# with:
# path: source/examples/Basic/ios
# key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
# restore-keys: |
# ${{ runner.os }}-pods-
- name: Clean node_modules tree
run: rm -rf node_modules/react-native-nami-sdk/examples
working-directory: source/examples/Basic
- name: Install iOS pods
run: RCT_NEW_ARCH_ENABLED=0 SWIFT_VERSION=5 pod install --repo-update
working-directory: source/examples/Basic/ios
- name: Rebuild cache detox
run: yarn detox rebuild-framework-cache
working-directory: source/examples/Basic
- name: Cache Detox build
id: cache-detox-build
uses: actions/cache@v3
with:
path: source/examples/Basic/ios/Pods
key: ${{ runner.os }}-detox-build
restore-keys: |
${{ runner.os }}-detox-build
- name: Detox build
run: yarn detox build --configuration ${{ env.DETOX_CONFIGURATION }}
working-directory: source/examples/Basic
- name: Detox test
run: |
yarn start &
METRO_BUNDLER_PID=$!
yarn detox test --configuration ${{ env.DETOX_CONFIGURATION }} e2e/ios --cleanup --headless --record-logs all
DETOX_EXIT_CODE=$?
kill $METRO_BUNDLER_PID
exit $DETOX_EXIT_CODE
working-directory: source/examples/Basic
- name: Upload artifacts
if: failure()
uses: actions/upload-artifact@v3
with:
name: detox-artifacts
path: artifacts
e2e-android:
runs-on: macos-12
env:
DETOX_CONFIGURATION: android.emu.release
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
path: source
ref: '${{ inputs.ref }}'
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Cache node_modules
uses: actions/cache@v3
id: cache
with:
path: source/examples/Basic/node_modules
key: node-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install Yarn dependencies
run: yarn install
working-directory: source/examples/Basic
- name: Setup Java
uses: actions/setup-java@v3
with:
cache: gradle
distribution: temurin
java-version: 17
- name: Update App Platform ID
working-directory: source/examples/Basic/config/
run: |
sed -i '' -e "s/ANDROID_PROD_APP_PLATFORM_ID/$BASIC_ANDROID_PROD_APP_PLATFORM_ID/" index.ts
env:
BASIC_ANDROID_PROD_APP_PLATFORM_ID: '${{ secrets.ANDROID_PROD_APP_PLATFORM_ID }}'
- name: Rebuild cache detox
run: yarn detox rebuild-framework-cache
working-directory: source/examples/Basic
- name: Cache Detox build
id: cache-detox-build
uses: actions/cache@v3
with:
path: source/examples/Basic/android/app/build
key: ${{ runner.os }}-detox-build
restore-keys: |
${{ runner.os }}-detox-build
- name: Detox build
run: |
rm -rf node_modules/react-native-nami-sdk/examples
yarn detox build --configuration ${{ env.DETOX_CONFIGURATION }}
working-directory: source/examples/Basic
- name: Create the Keystore
run: |
# import keystore from secrets
echo $KEYSTORE_BASE64 | base64 -d > $RUNNER_TEMP/my_production.keystore
env:
KEYSTORE_BASE64: '${{ secrets.KEY_STORE_BASE64 }}'
- name: Encode the keystore to base64
id: encode_keystore
run: |
echo "SIGNINGKEYBASE64=$(openssl base64 < $RUNNER_TEMP/my_production.keystore | tr -d '\n')" >> $GITHUB_ENV
- name: Sign APK
id: sign_apk
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: source/examples/Basic/android/app/build/outputs/apk/production/release
signingKeyBase64: ${{ env.SIGNINGKEYBASE64 }}
alias: ${{ secrets.KEY_ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "34.0.0"
- name: Sign AndroidTest APK for Detox
id: sign_androidTest_apk
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: source/examples/Basic/android/app/build/outputs/apk/androidTest/production/release/
signingKeyBase64: ${{ env.SIGNINGKEYBASE64 }}
alias: ${{ secrets.KEY_ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "34.0.0"
- name: Get device name
id: device
run: node -e "console.log('AVD_NAME=' + require('./.detoxrc').devices.emulator.device.avdName)" >> $GITHUB_OUTPUT
working-directory: source/examples/Basic
# - name: Cache AVD snapshot
# uses: actions/cache@v3
# id: avd-cache
# with:
# path: |
# ~/.android/avd/*
# ~/.android/adb*
# key: avd-30-aosp-atd
#
# - name: Create AVD and generate snapshot for caching
# if: steps.avd-cache.outputs.cache-hit != 'true'
# uses: reactivecircus/android-emulator-runner@v2
# with:
# target: aosp_atd
# api-level: 30
# arch: x86
# channel: canary
# profile: pixel
# ram-size: 2048M
# heapSize: 576M
# # avd-name: ${{ steps.device.outputs.AVD_NAME }}
# avd-name: Pixel_3a_API_30_AOSP
# force-avd-creation: false
# emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
# disable-animations: false
# script: echo "Generated AVD snapshot for caching"
# working-directory: source/examples/Basic
- name: Detox test
uses: reactivecircus/android-emulator-runner@v2
with:
target: aosp_atd
api-level: 30
arch: x86
channel: canary
profile: pixel
avd-name: Pixel_4_API_30_AOSP
script: yarn detox test --configuration ${{ env.DETOX_CONFIGURATION }} e2e/android --headless --record-logs all
working-directory: source/examples/Basic
- name: Upload artifacts
if: failure()
uses: actions/upload-artifact@v3
with:
name: detox-artifacts
path: artifacts