ci: fix automated test workflow (#9982)

This commit is contained in:
Igor Randjelovic
2022-07-31 15:17:04 +02:00
committed by Nathan Walker
parent c67f5e19bf
commit 3772264751
2 changed files with 40 additions and 25 deletions

View File

@ -4,15 +4,29 @@ on:
push:
branches:
- main
- 'ci/**'
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: macos-12
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
- name: Install Python
uses: actions/setup-python@v1
@ -20,39 +34,27 @@ jobs:
- name: Install NativeScript
run: |
python -m pip install --upgrade pip six
npm i -g nativescript --ignore-scripts
npm i -g nativescript --ignore-scripts --legacy-peer-deps
ns usage-reporting disable
ns error-reporting disable
ns doctor
- name: Setup
run: npm run setup
- name: Download & install the Android SDK
uses: malinskiy/action-android/install-sdk@release/0.1.3
- name: Set up platform tools like adb
run: sdkmanager platform-tools
- name: Create Emulator
uses: rigor789/action-create-emulator@main
- name: Start ADB and verify that pathing is working correctly
run: adb devices
- name: Test (Android)
run: node tools/scripts/run-automated.js android
- name: Verify $ANDROID_HOME is properly set for later Gradle commands.
run: echo $ANDROID_HOME
- name: Start Emulator
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
script: node tools/scripts/run-automated.js android
- name: Start iOS Simulator
if: always() # run iOS tests even if Android tests failed
if: ${{ always() && !cancelled() }} # run iOS tests even if Android tests failed
uses: futureware-tech/simulator-action@v1
with:
model: 'iPhone 13 Pro'
model: 'iPhone 13 Pro Max'
os_version: '>=15.0'
- name: Test (iOS)
if: always() # run iOS tests even if Android tests failed
if: ${{ always() && !cancelled() }} # run iOS tests even if Android tests failed
run: node tools/scripts/run-automated.js ios

View File

@ -9,10 +9,23 @@ const kill = require('tree-kill');
const TIMEOUT_MS = 5 * 60 * 1000; // 5 minutes
const spawned_process = spawn('npm', ['start', `apps.automated.${process.argv[2]}`], {
stdio: ['inherit', 'pipe', 'pipe']
})
const {stdout, stderr} = spawned_process
const platform = process.argv[2];
const spawned_process = spawn(
"ns",
[
"--path=./apps/automated",
"run",
platform,
"--no-hmr",
"--force",
// "--log=trace",
"--timeout=600" // 10 minutes, booting avds on CI is very slow...
],
{
stdio: ["inherit", "pipe", "pipe"],
}
);
const { stdout, stderr } = spawned_process
stdout.pipe(process.stdout)
stderr.pipe(process.stderr)