From dbe325d22b91f65a2c61377af296d61c8a4f5b4d Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 18 Oct 2021 12:50:06 +0300 Subject: [PATCH 01/42] chore: (Android) Config - add option to specify buildType --- README.md | 31 ++++++++++++++++--------------- example/owl.config.json | 1 + src/cli/build.ts | 9 +++++++-- src/cli/config.test.ts | 1 + src/cli/config.ts | 1 + src/cli/run.test.ts | 1 + src/cli/run.ts | 5 +++-- src/cli/types.ts | 2 ++ 8 files changed, 32 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index ecac97dd..51da3283 100644 --- a/README.md +++ b/README.md @@ -16,21 +16,22 @@ The config file - which unless specified in the cli should live in `./owl.config ### Options -| Name | Required | Description | -| ---------------------- | -------- | -------------------------------------------------------------------- | -| **general** | | | -| `debug` | false | Prevents the CLI/library from printing any logs/output | -| **ios config** | | | -| `ios.workspace` | true | Path to the `.xcworkspace` file of your react-native project | -| `ios.scheme` | true | The name of the scheme you would like to use for building the app | -| `ios.configuration` | true | The build configuration that should be used. Defaults to Debug | -| `ios.buildCommand` | false | Overrides the `xcodebuild` command making the above options obselete | -| `ios.binaryPath` | false | The path to the binary, if you are using a custom build command | -| `ios.quiet` | false | Passes the quiet flag to `xcode builds` | -| **android config** | | | -| `android.buildCommand` | false | Overrides the `assembleDebug` gradle command. Should build the apk | -| `android.binaryPath` | false | The path to the binary, if you are using a custom build command | -| `android.quiet` | false | Passes the quiet flag to `gradlew` | +| Name | Required | Description | +| ---------------------- | -------- | ----------------------------------------------------------------------------------------------- | +| **general** | | | +| `debug` | false | Prevents the CLI/library from printing any logs/output | +| **ios config** | | | +| `ios.workspace` | true | Path to the `.xcworkspace` file of your react-native project | +| `ios.scheme` | true | The name of the scheme you would like to use for building the app | +| `ios.configuration` | true | The build configuration that should be used. Defaults to Debug | +| `ios.buildCommand` | false | Overrides the `xcodebuild` command making the above options obselete | +| `ios.binaryPath` | false | The path to the binary, if you are using a custom build command | +| `ios.quiet` | false | Passes the quiet flag to `xcode builds` | +| **android config** | | | +| `android.buildCommand` | false | Overrides the `assembleDebug` or `assembleRelease` gradle commands. Should build the apk | +| `android.buildType` | false | Can be one of `debug` or `release`. Used to call the `assembleDebug`,`assembleRelease` commands | +| `android.binaryPath` | false | The path to the binary, if you are using a custom build command | +| `android.quiet` | false | Passes the quiet flag to `gradlew` | ### Example diff --git a/example/owl.config.json b/example/owl.config.json index 1a3799d1..852eb9ca 100644 --- a/example/owl.config.json +++ b/example/owl.config.json @@ -8,6 +8,7 @@ }, "android": { "packageName": "com.owldemo", + "buildType": "Release", "quiet": true }, "debug": true diff --git a/src/cli/build.ts b/src/cli/build.ts index e161097d..52881bd3 100644 --- a/src/cli/build.ts +++ b/src/cli/build.ts @@ -35,7 +35,12 @@ export const buildAndroid = async ( ): Promise => { const buildCommand = config.android?.buildCommand ? [config.android?.buildCommand] - : [`./gradlew`, `assembleDebug`]; + : [ + `./gradlew`, + config.android?.buildType === 'Release' + ? `assembleRelease` + : 'assembleDebug', + ]; if (!config.android?.buildCommand && config.android?.quiet) { buildCommand.push('--quiet'); @@ -43,7 +48,7 @@ export const buildAndroid = async ( const cwd = config.android?.buildCommand ? undefined - : path.join(process.cwd(), '/android'); + : path.join(process.cwd(), 'android'); logger.info(`[OWL] Building the app with: ${buildCommand.join(' ')}.`); diff --git a/src/cli/config.test.ts b/src/cli/config.test.ts index 7eee8363..16d58fe3 100644 --- a/src/cli/config.test.ts +++ b/src/cli/config.test.ts @@ -181,6 +181,7 @@ describe('config.ts', () => { }, android: { packageName: 'com.rndemo', + buildType: 'Debug', }, }; diff --git a/src/cli/config.ts b/src/cli/config.ts index dcaee886..09f34938 100644 --- a/src/cli/config.ts +++ b/src/cli/config.ts @@ -31,6 +31,7 @@ export const validateSchema = (config: {}): Promise => { properties: { packageName: { type: 'string' }, buildCommand: { type: 'string', nullable: true }, + buildType: { type: 'string', nullable: true, default: 'Debug' }, binaryPath: { type: 'string', nullable: true }, quiet: { type: 'boolean', nullable: true }, }, diff --git a/src/cli/run.test.ts b/src/cli/run.test.ts index 72ff458c..3ed5a813 100644 --- a/src/cli/run.test.ts +++ b/src/cli/run.test.ts @@ -123,6 +123,7 @@ describe('run.ts', () => { const config: Config = { android: { packageName: 'com.rndemo', + buildType: 'Debug', }, }; diff --git a/src/cli/run.ts b/src/cli/run.ts index a02faf2d..9d6c4bb4 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -43,14 +43,15 @@ export const runIOS = async (config: Config, logger: Logger) => { export const runAndroid = async (config: Config, logger: Logger) => { const stdio = config.debug ? 'inherit' : 'ignore'; - const DEFAULT_APK_DIR = '/android/app/build/outputs/apk/debug/'; + const buildType = config.android?.buildType?.toLowerCase(); + const DEFAULT_APK_DIR = `/android/app/build/outputs/apk/${buildType}/`; const cwd = config.android?.binaryPath ? path.dirname(config.android?.binaryPath) : path.join(process.cwd(), DEFAULT_APK_DIR); const appFilename = config.android!.binaryPath ? path.basename(config.android!.binaryPath) - : 'app-debug.apk'; + : `app-${buildType}.apk`; const appPath = path.join(cwd, appFilename); const { packageName } = config.android!; diff --git a/src/cli/types.ts b/src/cli/types.ts index 6f3f5a0b..da0019d9 100644 --- a/src/cli/types.ts +++ b/src/cli/types.ts @@ -35,6 +35,8 @@ type ConfigAndroid = { packageName: string; /** Overrides the `assembleDebug` gradle command. Should build the apk. */ buildCommand?: string; + /** Used to decided which build command it should call. */ + buildType?: 'Debug' | 'Release'; /** Path to the .apk that will get generated by a custom build command. Ignored when not using a custom build command. */ binaryPath?: string; /** Passes the quiet flag to `gradlew`. */ From 220934a20648b14e09609e1ff458fe3e0c0e3cdc Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 18 Oct 2021 13:15:56 +0300 Subject: [PATCH 02/42] Setup android job --- .github/workflows/demo-app.yml | 57 ++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index 15fb301d..5bcb0bc7 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -5,6 +5,7 @@ on: [pull_request] jobs: run-visual-regression-ios: runs-on: macos-11 + needs: run-visual-regression-android # FIXME: Remove this line before merging steps: - uses: actions/checkout@v2 @@ -68,3 +69,59 @@ jobs: with: name: owl-screenshots path: example/.owl + + run-visual-regression-android: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Get Runner Information + run: /usr/bin/xcodebuild -version + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - uses: actions/cache@v2 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install Dependencies (Library) + run: yarn install --frozen-lockfile + working-directory: ./ + + - name: Compile the library + run: yarn build + working-directory: ./ + + - name: Install Dependencies (Example App) + run: yarn install --frozen-lockfile + working-directory: ./example + + - uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Run Owl Build + run: yarn owl:build:android + working-directory: ./example + + - name: Run Owl Test + run: yarn owl:test:android + working-directory: ./example + + - name: Store screenshots as artifacts + uses: actions/upload-artifact@v2 + with: + name: owl-screenshots + path: example/.owl From 66e6d909e7b10efd3456de1b9cdb4bd98f72a6e6 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 18 Oct 2021 13:18:16 +0300 Subject: [PATCH 03/42] Remove missed iOS step --- .github/workflows/demo-app.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index 5bcb0bc7..c7a57d75 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -76,9 +76,6 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Get Runner Information - run: /usr/bin/xcodebuild -version - - name: Get yarn cache directory path id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" From be9cbbe41afcb286c6bc9dc2dad0398232129a77 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 18 Oct 2021 13:38:47 +0300 Subject: [PATCH 04/42] Add tmate step --- .github/workflows/demo-app.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index c7a57d75..c4331eab 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -117,6 +117,10 @@ jobs: run: yarn owl:test:android working-directory: ./example + - name: Setup tmate session + if: ${{ failure() }} + uses: mxschmitt/action-tmate@v3 + - name: Store screenshots as artifacts uses: actions/upload-artifact@v2 with: From 0e10dda6d998517790312da96521074931a051ef Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 18 Oct 2021 14:04:44 +0300 Subject: [PATCH 05/42] Nicer output from gradlew command --- example/owl.config.json | 2 +- src/cli/build.test.ts | 22 ++++++++++++++-------- src/cli/build.ts | 1 + 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/example/owl.config.json b/example/owl.config.json index 852eb9ca..ce3d4e08 100644 --- a/example/owl.config.json +++ b/example/owl.config.json @@ -9,7 +9,7 @@ "android": { "packageName": "com.owldemo", "buildType": "Release", - "quiet": true + "quiet": false }, "debug": true } diff --git a/src/cli/build.test.ts b/src/cli/build.test.ts index f7592df9..87e7006b 100644 --- a/src/cli/build.test.ts +++ b/src/cli/build.test.ts @@ -82,10 +82,13 @@ describe('build.ts', () => { await buildAndroid(config, logger); expect(execMock).toHaveBeenCalledTimes(1); - expect(execMock).toHaveBeenCalledWith(`./gradlew assembleDebug`, { - stdio: 'inherit', - cwd: path.join(process.cwd(), 'android'), - }); + expect(execMock).toHaveBeenCalledWith( + `./gradlew assembleDebug --console plain`, + { + stdio: 'inherit', + cwd: path.join(process.cwd(), 'android'), + } + ); }); it('builds an Android project with the default build command - with the quiet arg', async () => { @@ -99,10 +102,13 @@ describe('build.ts', () => { await buildAndroid(config, logger); expect(execMock).toHaveBeenCalledTimes(1); - expect(execMock).toHaveBeenCalledWith(`./gradlew assembleDebug --quiet`, { - stdio: 'inherit', - cwd: path.join(process.cwd(), 'android'), - }); + expect(execMock).toHaveBeenCalledWith( + `./gradlew assembleDebug --console plain --quiet`, + { + stdio: 'inherit', + cwd: path.join(process.cwd(), 'android'), + } + ); }); it('builds an Android project with a custom build command', async () => { diff --git a/src/cli/build.ts b/src/cli/build.ts index 52881bd3..cf6fe4e2 100644 --- a/src/cli/build.ts +++ b/src/cli/build.ts @@ -40,6 +40,7 @@ export const buildAndroid = async ( config.android?.buildType === 'Release' ? `assembleRelease` : 'assembleDebug', + '--console plain', ]; if (!config.android?.buildCommand && config.android?.quiet) { From 7317cea08dfbd589fc17360892ac5fe212695de3 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 18 Oct 2021 14:05:03 +0300 Subject: [PATCH 06/42] Attempt to install the sdks, create & boot the emulator --- .github/workflows/demo-app.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index c4331eab..4edad12e 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -109,6 +109,18 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- + - name: SKDs - download required images + run: $ANDROID_HOME/tools/bin/sdkmanager "system-images;android-30;default;x86_64" + + - name: SDKs - accept licenses + run: yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses + + - name: Emulator - Create + run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30_AOSP -d pixel --package "system-images;android-30;default;x86_64" + + - name: Emulator - Boot + run: emulator -avd Pixel_API_30_AOSP + - name: Run Owl Build run: yarn owl:build:android working-directory: ./example From 81b9775c0e9d299cc0304d4b99d18c04ea366352 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 18 Oct 2021 14:15:18 +0300 Subject: [PATCH 07/42] Switch to ubuntu-18.04 --- .github/workflows/demo-app.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index 4edad12e..378d7639 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -71,7 +71,7 @@ jobs: path: example/.owl run-visual-regression-android: - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 @@ -116,10 +116,12 @@ jobs: run: yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses - name: Emulator - Create - run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30_AOSP -d pixel --package "system-images;android-30;default;x86_64" + $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_28_AOSP -d pixel --package "system-images;android-30;default;x86_64" - name: Emulator - Boot - run: emulator -avd Pixel_API_30_AOSP + run: | + $ANDROID_HOME/emulator/emulator -list-avds + $ANDROID_HOME/emulator/emulator -avd Pixel_API_30_AOSP & - name: Run Owl Build run: yarn owl:build:android From 0706de9439a005282a3f65d13f6b7542ac5a8a08 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 18 Oct 2021 14:16:42 +0300 Subject: [PATCH 08/42] Valid workflow --- .github/workflows/demo-app.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index 378d7639..153254c3 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -116,12 +116,13 @@ jobs: run: yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses - name: Emulator - Create - $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_28_AOSP -d pixel --package "system-images;android-30;default;x86_64" + run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_28_AOSP -d pixel --package "system-images;android-30;default;x86_64" + + - name: Emulator - List + run: $ANDROID_HOME/emulator/emulator -list-avds - name: Emulator - Boot - run: | - $ANDROID_HOME/emulator/emulator -list-avds - $ANDROID_HOME/emulator/emulator -avd Pixel_API_30_AOSP & + run: $ANDROID_HOME/emulator/emulator -avd Pixel_API_30_AOSP & - name: Run Owl Build run: yarn owl:build:android From 1d2b6ad3e63c5f1d0bc7ffb4de33c1c6c2625f0f Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 18 Oct 2021 14:19:00 +0300 Subject: [PATCH 09/42] Correct simulator name --- .github/workflows/demo-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index 153254c3..b2f10984 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -122,7 +122,7 @@ jobs: run: $ANDROID_HOME/emulator/emulator -list-avds - name: Emulator - Boot - run: $ANDROID_HOME/emulator/emulator -avd Pixel_API_30_AOSP & + run: $ANDROID_HOME/emulator/emulator -avd Pixel_API_28_AOSP & - name: Run Owl Build run: yarn owl:build:android From 775b9d8dd5ae3ce98faf497ea7140fc48f9dc4fc Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 18 Oct 2021 14:19:22 +0300 Subject: [PATCH 10/42] Retry --- .github/workflows/demo-app.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index b2f10984..ecf67445 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -116,13 +116,13 @@ jobs: run: yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses - name: Emulator - Create - run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_28_AOSP -d pixel --package "system-images;android-30;default;x86_64" + run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30_AOSP -d pixel --package "system-images;android-30;default;x86_64" - name: Emulator - List run: $ANDROID_HOME/emulator/emulator -list-avds - name: Emulator - Boot - run: $ANDROID_HOME/emulator/emulator -avd Pixel_API_28_AOSP & + run: $ANDROID_HOME/emulator/emulator -avd Pixel_API_30_AOSP & - name: Run Owl Build run: yarn owl:build:android From 25d3bbf2d8e33d9eca281f6aac22d464f65b1857 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 18 Oct 2021 14:48:10 +0300 Subject: [PATCH 11/42] Run on macos because of HAXM --- .github/workflows/demo-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index ecf67445..b5f5e7bd 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -71,7 +71,7 @@ jobs: path: example/.owl run-visual-regression-android: - runs-on: ubuntu-18.04 + runs-on: macos-11 steps: - uses: actions/checkout@v2 From 91e8b71a03b93e665bf491df208e844b92c090a8 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 18 Oct 2021 15:01:46 +0300 Subject: [PATCH 12/42] Retry --- .github/workflows/demo-app.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index b5f5e7bd..2803007e 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -37,7 +37,7 @@ jobs: run: yarn install --frozen-lockfile working-directory: ./example - - name: Install CocoaPods + - name: Install CocoaPods Gem run: gem install cocoapods -v 1.11.0 - uses: actions/cache@v2 @@ -47,7 +47,7 @@ jobs: restore-keys: | ${{ runner.os }}-pods- - - name: Install CocoaPods + - name: Install Pods run: pod install working-directory: ./example/ios @@ -113,7 +113,7 @@ jobs: run: $ANDROID_HOME/tools/bin/sdkmanager "system-images;android-30;default;x86_64" - name: SDKs - accept licenses - run: yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses + run: y | $ANDROID_HOME/tools/bin/sdkmanager --licenses - name: Emulator - Create run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30_AOSP -d pixel --package "system-images;android-30;default;x86_64" From 3b8176a01b38ce61fc733f5b3f6a51aac1927f1c Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 18 Oct 2021 15:20:04 +0300 Subject: [PATCH 13/42] Add step to become root in adb (required to set time in emulator) --- .github/workflows/demo-app.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index 2803007e..43536040 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -124,6 +124,9 @@ jobs: - name: Emulator - Boot run: $ANDROID_HOME/emulator/emulator -avd Pixel_API_30_AOSP & + - name: Emulator / ADB Root + run: adb root + - name: Run Owl Build run: yarn owl:build:android working-directory: ./example From c10b0327adc56f172289b5f71ebd6b2bb3353741 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 18 Oct 2021 15:24:12 +0300 Subject: [PATCH 14/42] Reorder so that emulator has time to boot --- .github/workflows/demo-app.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index 43536040..4c28e722 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -124,13 +124,13 @@ jobs: - name: Emulator - Boot run: $ANDROID_HOME/emulator/emulator -avd Pixel_API_30_AOSP & - - name: Emulator / ADB Root - run: adb root - - name: Run Owl Build run: yarn owl:build:android working-directory: ./example + - name: Emulator / ADB Root + run: adb root + - name: Run Owl Test run: yarn owl:test:android working-directory: ./example From 14a85e3ce9fe71cf5053ceea48b058176afd1c60 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Fri, 20 May 2022 21:20:41 +0100 Subject: [PATCH 15/42] chore: Remove adb root --- .github/workflows/demo-app.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index a3cb9642..0fe80dd5 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -129,9 +129,6 @@ jobs: run: yarn owl:build:android working-directory: ./example - - name: Emulator / ADB Root - run: adb root - - name: Run Owl Test run: yarn owl:test:android working-directory: ./example From 972550dd215d05ba8fe3369bd6792d9b341e68dd Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Fri, 20 May 2022 21:26:49 +0100 Subject: [PATCH 16/42] chore: Fix tests --- lib/cli/build.ts | 6 +++--- lib/cli/run.test.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/cli/build.ts b/lib/cli/build.ts index 72487c2e..4987f05b 100644 --- a/lib/cli/build.ts +++ b/lib/cli/build.ts @@ -45,9 +45,9 @@ export const buildAndroid = async ( ? [config.android?.buildCommand] : [ `./gradlew`, - config.android?.buildType === 'Release' - ? `assembleRelease` - : 'assembleDebug', + config.android?.buildType === 'Debug' + ? `assembleDebug` + : 'assembleRelease', '--console plain', ]; diff --git a/lib/cli/run.test.ts b/lib/cli/run.test.ts index 5b07fc78..44871214 100644 --- a/lib/cli/run.test.ts +++ b/lib/cli/run.test.ts @@ -149,7 +149,7 @@ describe('run.ts', () => { const config: Config = { android: { packageName: 'com.rndemo', - buildType: 'Debug', + buildType: 'Release', }, }; From 8d23ac06270fef70c5f3614ffafaf77dae41a630 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Fri, 20 May 2022 21:49:15 +0100 Subject: [PATCH 17/42] chore: Debug devices --- .github/workflows/demo-app.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index 0fe80dd5..61c3938a 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -119,16 +119,25 @@ jobs: - name: Emulator - Create run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30_AOSP -d pixel --package "system-images;android-30;default;x86_64" + - name: ADB Devices + run: adb devices + - name: Emulator - List run: $ANDROID_HOME/emulator/emulator -list-avds - name: Emulator - Boot run: $ANDROID_HOME/emulator/emulator -avd Pixel_API_30_AOSP & + - name: ADB Devices + run: adb devices + - name: Run Owl Build run: yarn owl:build:android working-directory: ./example + - name: ADB Devices + run: adb devices + - name: Run Owl Test run: yarn owl:test:android working-directory: ./example From 157ce31f326297a124f92f79847b368c897d74f3 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Fri, 20 May 2022 22:04:55 +0100 Subject: [PATCH 18/42] chore: Set emulator's disk size --- .github/workflows/demo-app.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index 61c3938a..959bbfb4 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -117,10 +117,7 @@ jobs: run: y | $ANDROID_HOME/tools/bin/sdkmanager --licenses - name: Emulator - Create - run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30_AOSP -d pixel --package "system-images;android-30;default;x86_64" - - - name: ADB Devices - run: adb devices + run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30_AOSP -d pixel --package "system-images;android-30;default;x86_64" --sdcard 128M - name: Emulator - List run: $ANDROID_HOME/emulator/emulator -list-avds @@ -128,9 +125,6 @@ jobs: - name: Emulator - Boot run: $ANDROID_HOME/emulator/emulator -avd Pixel_API_30_AOSP & - - name: ADB Devices - run: adb devices - - name: Run Owl Build run: yarn owl:build:android working-directory: ./example From 6b3e05626169b6c8a14dce3f43fba4fb5622e5c7 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Fri, 20 May 2022 23:31:18 +0100 Subject: [PATCH 19/42] chore: Adb wait for device --- .github/workflows/demo-app.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index 959bbfb4..65427069 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -125,13 +125,13 @@ jobs: - name: Emulator - Boot run: $ANDROID_HOME/emulator/emulator -avd Pixel_API_30_AOSP & + - name: ADB Wait For Device + run: timeout 60 adb wait-for-any-device + - name: Run Owl Build run: yarn owl:build:android working-directory: ./example - - name: ADB Devices - run: adb devices - - name: Run Owl Test run: yarn owl:test:android working-directory: ./example From 23c1899b1b30a14fec8a3d88d0029be31b47da81 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Sun, 22 May 2022 20:55:02 +0100 Subject: [PATCH 20/42] chore: Timeout with bash --- .github/workflows/demo-app.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index 65427069..e5fe4569 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -127,6 +127,7 @@ jobs: - name: ADB Wait For Device run: timeout 60 adb wait-for-any-device + shell: bash - name: Run Owl Build run: yarn owl:build:android From 538bfc81d8317b6c4910f86ba476bd8dc7230c03 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Sun, 22 May 2022 21:01:09 +0100 Subject: [PATCH 21/42] chore: Use timeout_minutes --- .github/workflows/demo-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index e5fe4569..b8074c67 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -127,7 +127,7 @@ jobs: - name: ADB Wait For Device run: timeout 60 adb wait-for-any-device - shell: bash + timeout-minutes: 1 - name: Run Owl Build run: yarn owl:build:android From 7b0df6dc205edbaf0ccbbb9f6c8e5206d1ae8dea Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Sun, 22 May 2022 21:14:35 +0100 Subject: [PATCH 22/42] chore: clean up --- .github/workflows/demo-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index b8074c67..90ec945c 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -126,7 +126,7 @@ jobs: run: $ANDROID_HOME/emulator/emulator -avd Pixel_API_30_AOSP & - name: ADB Wait For Device - run: timeout 60 adb wait-for-any-device + run: adb wait-for-any-device timeout-minutes: 1 - name: Run Owl Build From 6591b730ed4079768e1bf7f6f132419e95832a10 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 23 May 2022 11:21:19 +0100 Subject: [PATCH 23/42] Update demo-app.yml --- .github/workflows/demo-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index 90ec945c..bd0e9b4e 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -127,7 +127,7 @@ jobs: - name: ADB Wait For Device run: adb wait-for-any-device - timeout-minutes: 1 + timeout-minutes: 3 - name: Run Owl Build run: yarn owl:build:android From affde7de5adabb45be8004695a919573a13a1fc2 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 23 May 2022 14:03:47 +0100 Subject: [PATCH 24/42] chore: Specify Pixel 2 for the emulator --- .github/workflows/demo-app.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index bd0e9b4e..41ad1426 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -117,13 +117,13 @@ jobs: run: y | $ANDROID_HOME/tools/bin/sdkmanager --licenses - name: Emulator - Create - run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30_AOSP -d pixel --package "system-images;android-30;default;x86_64" --sdcard 128M + run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30 --device 'Pixel 2' --package "system-images;android-30;default;x86_64" --sdcard 128M - name: Emulator - List run: $ANDROID_HOME/emulator/emulator -list-avds - name: Emulator - Boot - run: $ANDROID_HOME/emulator/emulator -avd Pixel_API_30_AOSP & + run: $ANDROID_HOME/emulator/emulator -avd Pixel_API_30 -no-audio -no-window & - name: ADB Wait For Device run: adb wait-for-any-device From c408edf58f8619fa421e82153d349186b996e232 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 23 May 2022 14:08:12 +0100 Subject: [PATCH 25/42] chore: Revert command arg --- .github/workflows/demo-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index 41ad1426..397409d7 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -117,7 +117,7 @@ jobs: run: y | $ANDROID_HOME/tools/bin/sdkmanager --licenses - name: Emulator - Create - run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30 --device 'Pixel 2' --package "system-images;android-30;default;x86_64" --sdcard 128M + run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30 -d 'Pixel 2' --package "system-images;android-30;default;x86_64" --sdcard 128M - name: Emulator - List run: $ANDROID_HOME/emulator/emulator -list-avds From 39c7794c20d1f02952711559e7cd9396aae5456f Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 23 May 2022 14:28:48 +0100 Subject: [PATCH 26/42] chore: Use "Nexus 5X" to match "Pixel 2"'s config --- .github/workflows/demo-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index 397409d7..b93c3043 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -117,7 +117,7 @@ jobs: run: y | $ANDROID_HOME/tools/bin/sdkmanager --licenses - name: Emulator - Create - run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30 -d 'Pixel 2' --package "system-images;android-30;default;x86_64" --sdcard 128M + run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30 --device 'Nexus 5X' --package "system-images;android-30;default;x86_64" --sdcard 128M - name: Emulator - List run: $ANDROID_HOME/emulator/emulator -list-avds From 91bce4f19fc532f37ee6e6b2ae5c68943cf9cd50 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 23 May 2022 14:39:23 +0100 Subject: [PATCH 27/42] chore: Clean Up --- .github/workflows/demo-app.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index b93c3043..e1505520 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -119,9 +119,6 @@ jobs: - name: Emulator - Create run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30 --device 'Nexus 5X' --package "system-images;android-30;default;x86_64" --sdcard 128M - - name: Emulator - List - run: $ANDROID_HOME/emulator/emulator -list-avds - - name: Emulator - Boot run: $ANDROID_HOME/emulator/emulator -avd Pixel_API_30 -no-audio -no-window & From 4f1edb38de042a32112e5ddc0a176064e1227ab6 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 23 May 2022 15:04:13 +0100 Subject: [PATCH 28/42] chore: Use existing github action to handle emulator launch --- .github/workflows/demo-app.yml | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index e1505520..1901c667 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -110,34 +110,19 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- - - name: SKDs - download required images - run: $ANDROID_HOME/tools/bin/sdkmanager "system-images;android-30;default;x86_64" - - - name: SDKs - accept licenses - run: y | $ANDROID_HOME/tools/bin/sdkmanager --licenses - - - name: Emulator - Create - run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30 --device 'Nexus 5X' --package "system-images;android-30;default;x86_64" --sdcard 128M - - - name: Emulator - Boot - run: $ANDROID_HOME/emulator/emulator -avd Pixel_API_30 -no-audio -no-window & - - - name: ADB Wait For Device - run: adb wait-for-any-device - timeout-minutes: 3 - - name: Run Owl Build run: yarn owl:build:android working-directory: ./example - name: Run Owl Test - run: yarn owl:test:android + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: 30 + profile: Nexus 5X + disable-animations: true + script: yarn owl:test:android working-directory: ./example - - name: Setup tmate session - if: ${{ failure() }} - uses: mxschmitt/action-tmate@v3 - - name: Store screenshots as artifacts uses: actions/upload-artifact@v2 with: From ca881632e416e4a5d0fe1e6d9ce179ef01c021e6 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 23 May 2022 15:06:16 +0100 Subject: [PATCH 29/42] chore: Fix systax --- .github/workflows/demo-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index 1901c667..b9204699 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -121,7 +121,7 @@ jobs: profile: Nexus 5X disable-animations: true script: yarn owl:test:android - working-directory: ./example + working-directory: ./example - name: Store screenshots as artifacts uses: actions/upload-artifact@v2 From bd5e33637ddb12e4c345fb0b93588fc489bb2d42 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 23 May 2022 15:22:01 +0100 Subject: [PATCH 30/42] chore: Add architecture --- .github/workflows/demo-app.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index b9204699..0e706e9d 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -118,6 +118,7 @@ jobs: uses: reactivecircus/android-emulator-runner@v2 with: api-level: 30 + arch: x86_64 profile: Nexus 5X disable-animations: true script: yarn owl:test:android From 3f665851461ece375861469d5b246348929d0734 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 23 May 2022 15:42:31 +0100 Subject: [PATCH 31/42] chore: Store screenshots if tests fail --- .github/workflows/demo-app.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index 0e706e9d..e5ccb8ec 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -126,6 +126,7 @@ jobs: - name: Store screenshots as artifacts uses: actions/upload-artifact@v2 + if: failure() with: name: owl-screenshots path: example/.owl From b9eb17d18b5820b1477119e046ee4f02ee44a390 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 23 May 2022 16:14:38 +0100 Subject: [PATCH 32/42] chore: Back to custom config --- .github/workflows/demo-app.yml | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index e5ccb8ec..95a05f44 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -110,19 +110,29 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- + - name: SKDs - download required images + run: $ANDROID_HOME/tools/bin/sdkmanager "system-images;android-30;default;x86_64" + + - name: SDKs - accept licenses + run: y | $ANDROID_HOME/tools/bin/sdkmanager --licenses + + - name: Emulator - Create + run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30 --device 'Nexus 5X' --package "system-images;android-30;default;x86_64" --sdcard 256M + + - name: Emulator - Boot + run: $ANDROID_HOME/emulator/emulator -avd Pixel_API_30 -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim & + + - name: ADB Wait For Device + run: adb wait-for-any-device + timeout-minutes: 3 + - name: Run Owl Build run: yarn owl:build:android working-directory: ./example - name: Run Owl Test - uses: reactivecircus/android-emulator-runner@v2 - with: - api-level: 30 - arch: x86_64 - profile: Nexus 5X - disable-animations: true - script: yarn owl:test:android - working-directory: ./example + run: yarn owl:test:android + working-directory: ./example - name: Store screenshots as artifacts uses: actions/upload-artifact@v2 From c8d314384000aa35cb35b2cd15c0fb8289bf58df Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 23 May 2022 16:32:29 +0100 Subject: [PATCH 33/42] chore: Attempt to give more RAM for the emulator --- .github/workflows/demo-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index 95a05f44..31543ea8 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -117,7 +117,7 @@ jobs: run: y | $ANDROID_HOME/tools/bin/sdkmanager --licenses - name: Emulator - Create - run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30 --device 'Nexus 5X' --package "system-images;android-30;default;x86_64" --sdcard 256M + run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30 --device 'Nexus 5X' --package "system-images;android-30;default;x86_64" -memory 2048 --sdcard 512M - name: Emulator - Boot run: $ANDROID_HOME/emulator/emulator -avd Pixel_API_30 -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim & From d89693108132b7bd13d00fa6da057132922bdb48 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 23 May 2022 16:43:11 +0100 Subject: [PATCH 34/42] chore: Move memory arg --- .github/workflows/demo-app.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index 31543ea8..8ab52d83 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -117,10 +117,10 @@ jobs: run: y | $ANDROID_HOME/tools/bin/sdkmanager --licenses - name: Emulator - Create - run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30 --device 'Nexus 5X' --package "system-images;android-30;default;x86_64" -memory 2048 --sdcard 512M + run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30 --device 'Nexus 5X' --package "system-images;android-30;default;x86_64" --sdcard 512M - name: Emulator - Boot - run: $ANDROID_HOME/emulator/emulator -avd Pixel_API_30 -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim & + run: $ANDROID_HOME/emulator/emulator -memory 2048 -avd Pixel_API_30 -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim & - name: ADB Wait For Device run: adb wait-for-any-device From 7d4ba858feafccc0db2c2f53f47b5f8425d86675 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Wed, 25 May 2022 10:16:00 +0100 Subject: [PATCH 35/42] Update demo-app.yml --- .github/workflows/demo-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index 8ab52d83..c4b912a4 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -120,7 +120,7 @@ jobs: run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30 --device 'Nexus 5X' --package "system-images;android-30;default;x86_64" --sdcard 512M - name: Emulator - Boot - run: $ANDROID_HOME/emulator/emulator -memory 2048 -avd Pixel_API_30 -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim & + run: $ANDROID_HOME/emulator/emulator -memory 4096 -avd Pixel_API_30 -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim & - name: ADB Wait For Device run: adb wait-for-any-device From e380a49aa0bd0e7e6555daf7e4975a48e728eb01 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 30 May 2022 15:14:17 +0100 Subject: [PATCH 36/42] chore: Attempt to use google imag --- .github/workflows/demo-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index c4b912a4..8d3ba377 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -111,7 +111,7 @@ jobs: ${{ runner.os }}-gradle- - name: SKDs - download required images - run: $ANDROID_HOME/tools/bin/sdkmanager "system-images;android-30;default;x86_64" + run: $ANDROID_HOME/tools/bin/sdkmanager "system-images;android-30;google;x86_64" - name: SDKs - accept licenses run: y | $ANDROID_HOME/tools/bin/sdkmanager --licenses From d8a886f5dcb2aa93376d1313837ba75631b7befb Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 30 May 2022 15:31:03 +0100 Subject: [PATCH 37/42] chore: More memory --- .github/workflows/demo-app.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index 8d3ba377..a3923d4f 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -111,7 +111,7 @@ jobs: ${{ runner.os }}-gradle- - name: SKDs - download required images - run: $ANDROID_HOME/tools/bin/sdkmanager "system-images;android-30;google;x86_64" + run: $ANDROID_HOME/tools/bin/sdkmanager "system-images;android-30;default;x86_64" - name: SDKs - accept licenses run: y | $ANDROID_HOME/tools/bin/sdkmanager --licenses @@ -120,7 +120,7 @@ jobs: run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30 --device 'Nexus 5X' --package "system-images;android-30;default;x86_64" --sdcard 512M - name: Emulator - Boot - run: $ANDROID_HOME/emulator/emulator -memory 4096 -avd Pixel_API_30 -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim & + run: $ANDROID_HOME/emulator/emulator -memory 6144 -avd Pixel_API_30 -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim & - name: ADB Wait For Device run: adb wait-for-any-device From efecccf64a90d9d75ada786a9db249c3fb8b5b5d Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 30 May 2022 15:42:51 +0100 Subject: [PATCH 38/42] chore: More storage --- .github/workflows/demo-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index a3923d4f..0c86e4a0 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -117,7 +117,7 @@ jobs: run: y | $ANDROID_HOME/tools/bin/sdkmanager --licenses - name: Emulator - Create - run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30 --device 'Nexus 5X' --package "system-images;android-30;default;x86_64" --sdcard 512M + run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30 --device 'Nexus 5X' --package "system-images;android-30;default;x86_64" --sdcard 1024M - name: Emulator - Boot run: $ANDROID_HOME/emulator/emulator -memory 6144 -avd Pixel_API_30 -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim & From 4a0b3eee762de2ef1eb084106ea934875a09ac98 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 30 May 2022 16:30:21 +0100 Subject: [PATCH 39/42] chore: Rollback changes --- .github/workflows/demo-app.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index 0c86e4a0..c4b912a4 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -117,10 +117,10 @@ jobs: run: y | $ANDROID_HOME/tools/bin/sdkmanager --licenses - name: Emulator - Create - run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30 --device 'Nexus 5X' --package "system-images;android-30;default;x86_64" --sdcard 1024M + run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30 --device 'Nexus 5X' --package "system-images;android-30;default;x86_64" --sdcard 512M - name: Emulator - Boot - run: $ANDROID_HOME/emulator/emulator -memory 6144 -avd Pixel_API_30 -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim & + run: $ANDROID_HOME/emulator/emulator -memory 4096 -avd Pixel_API_30 -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim & - name: ADB Wait For Device run: adb wait-for-any-device From f4a7cdabfbfc3135a7d28c90ac9d65540163ceb2 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Mon, 30 May 2022 17:11:57 +0100 Subject: [PATCH 40/42] chore: Wipe data --- .github/workflows/demo-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index c4b912a4..684b75c7 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -120,7 +120,7 @@ jobs: run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30 --device 'Nexus 5X' --package "system-images;android-30;default;x86_64" --sdcard 512M - name: Emulator - Boot - run: $ANDROID_HOME/emulator/emulator -memory 4096 -avd Pixel_API_30 -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim & + run: $ANDROID_HOME/emulator/emulator -memory 4096 -avd Pixel_API_30 -wipe-data -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim & - name: ADB Wait For Device run: adb wait-for-any-device From 83222b1966173c0b48baac61e03f571581496374 Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Wed, 1 Jun 2022 15:58:32 +0100 Subject: [PATCH 41/42] chore: Add example workflow to docs --- .github/workflows/demo-app.yml | 2 +- docs/advanced/_category_.json | 4 - docs/advanced/running-ci.md | 85 ------------------- docs/ci/_category_.json | 4 + docs/ci/github-actions.md | 146 +++++++++++++++++++++++++++++++++ 5 files changed, 151 insertions(+), 90 deletions(-) delete mode 100644 docs/advanced/_category_.json delete mode 100644 docs/advanced/running-ci.md create mode 100644 docs/ci/_category_.json create mode 100644 docs/ci/github-actions.md diff --git a/.github/workflows/demo-app.yml b/.github/workflows/demo-app.yml index 684b75c7..a8d99934 100644 --- a/.github/workflows/demo-app.yml +++ b/.github/workflows/demo-app.yml @@ -5,7 +5,6 @@ on: [pull_request] jobs: run-visual-regression-ios: runs-on: macos-11 - needs: run-visual-regression-android # FIXME: Remove this line before merging steps: - uses: actions/checkout@v2 @@ -73,6 +72,7 @@ jobs: run-visual-regression-android: runs-on: macos-11 + if: ${{ false }} steps: - uses: actions/checkout@v2 diff --git a/docs/advanced/_category_.json b/docs/advanced/_category_.json deleted file mode 100644 index c039890a..00000000 --- a/docs/advanced/_category_.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "label": "Advanced", - "position": 4 -} diff --git a/docs/advanced/running-ci.md b/docs/advanced/running-ci.md deleted file mode 100644 index 9eb2eca8..00000000 --- a/docs/advanced/running-ci.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -sidebar_position: 1 ---- - -# Running on CI - -:::info - -With visual regression testing, it is all about **consistency**. Please make sure that you use the same simulator across environments. ie. Use the same emulator to generate the baseline images and the same (model) one on CI so that the library can compare the screenshots. - -::: - -### GitHub Actions - -#### Example - -To run the tests on an iOS simulator, you will need to use a [macOS based runner](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources). - -```yaml title=".github/workflows/visual-regression-ios.yml" -name: Run Visual Regression iOS - -on: [pull_request] - -jobs: - run-visual-regression-ios: - runs-on: macos-11 - - steps: - - uses: actions/checkout@v2 - - - name: Get Runner Information - run: /usr/bin/xcodebuild -version - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v2 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install Dependencies - run: yarn install --frozen-lockfile - working-directory: ./ - - - name: Install CocoaPods - run: gem install cocoapods -v 1.11.0 - - - uses: actions/cache@v2 - with: - path: ./ios/Pods - key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} - restore-keys: | - ${{ runner.os }}-pods- - - - name: Install CocoaPods - run: pod install - working-directory: ./ios - - - uses: futureware-tech/simulator-action@v1 - with: - model: 'iPhone 13 Pro' - os_version: '>=15.0' - - - name: Run Owl Build - run: yarn owl:build:ios - working-directory: ./ - - - name: Run Owl Test - run: yarn owl:test:ios - working-directory: ./ - - - name: Store screenshots and report as artifacts - uses: actions/upload-artifact@v2 - if: failure() - with: - name: owl-results - path: ./.owl -``` - -To run the tests on an Android simulator, you can use the [Android Emulator Runner](https://github.com/marketplace/actions/android-emulator-runner) Action and adjust the example action above. diff --git a/docs/ci/_category_.json b/docs/ci/_category_.json new file mode 100644 index 00000000..db24e6e6 --- /dev/null +++ b/docs/ci/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Running on CI", + "position": 4 +} diff --git a/docs/ci/github-actions.md b/docs/ci/github-actions.md new file mode 100644 index 00000000..ec5e930c --- /dev/null +++ b/docs/ci/github-actions.md @@ -0,0 +1,146 @@ +--- +sidebar_position: 1 +--- + +# GitHub Actions + +:::info + +With visual regression testing, it is all about **consistency**. Please make sure that you use the same simulator across environments. ie. Use the same emulator to generate the baseline images and the same (model) one on CI so that the library can compare the screenshots. + +::: + +### iOS + +To run the tests on an iOS simulator, you will need to use a [macOS based runner](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources). + +```yaml title=".github/workflows/visual-regression-ios.yml" +name: Visual Regression - iOS + +on: [pull_request] + +jobs: + run-visual-regression-ios: + runs-on: macos-11 + + steps: + - uses: actions/checkout@v2 + + - name: Get Runner Information + run: /usr/bin/xcodebuild -version + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - uses: actions/cache@v2 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install Dependencies + run: yarn install --frozen-lockfile + + - name: Install CocoaPods + run: gem install cocoapods -v 1.11.0 + + - uses: actions/cache@v2 + with: + path: ./ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: | + ${{ runner.os }}-pods- + + - name: Install CocoaPods + run: pod install + working-directory: ./ios + + - uses: futureware-tech/simulator-action@v1 + with: + model: 'iPhone 13 Pro' + os_version: '>=15.0' + + - name: Run Owl Build + run: yarn owl:build:ios + + - name: Run Owl Test + run: yarn owl:test:ios + + - name: Store screenshots and report as artifacts + uses: actions/upload-artifact@v2 + if: failure() + with: + name: owl-results + path: ./.owl +``` + +### Android + +```yaml title=".github/workflows/visual-regression-android.yml" +name: Visual Regression - Android + +on: [pull_request] + +jobs: + run-visual-regression-android: + runs-on: macos-11 + + steps: + - uses: actions/checkout@v2 + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - uses: actions/cache@v2 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install Dependencies + run: yarn install --frozen-lockfile + + - uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: SKDs - download required images + run: $ANDROID_HOME/tools/bin/sdkmanager "system-images;android-30;default;x86_64" + + - name: SDKs - accept licenses + run: y | $ANDROID_HOME/tools/bin/sdkmanager --licenses + + - name: Emulator - Create + run: $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_30 --device 'Nexus 5X' --package "system-images;android-30;default;x86_64" --sdcard 512M + + - name: Emulator - Boot + run: $ANDROID_HOME/emulator/emulator -memory 4096 -avd Pixel_API_30 -wipe-data -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim & + + - name: ADB Wait For Device + run: adb wait-for-any-device + timeout-minutes: 3 + + - name: Run Owl Build + run: yarn owl:build:android + + - name: Run Owl Test + run: yarn owl:test:android + + - name: Store screenshots as artifacts + uses: actions/upload-artifact@v2 + if: failure() + with: + name: owl-screenshots + path: ./.owl +``` From b917fd2db6b063f8074f6fbd992a18f8ec06f48b Mon Sep 17 00:00:00 2001 From: Manos Konstantinidis Date: Wed, 1 Jun 2022 16:30:19 +0100 Subject: [PATCH 42/42] chore: Update copy in the docs --- docs/ci/github-actions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ci/github-actions.md b/docs/ci/github-actions.md index ec5e930c..42586ab5 100644 --- a/docs/ci/github-actions.md +++ b/docs/ci/github-actions.md @@ -6,7 +6,7 @@ sidebar_position: 1 :::info -With visual regression testing, it is all about **consistency**. Please make sure that you use the same simulator across environments. ie. Use the same emulator to generate the baseline images and the same (model) one on CI so that the library can compare the screenshots. +With visual regression testing, it is all about **consistency**. Please make sure that you use the same simulator across environments. Use the same emulator configuration to generate the baseline images and for running the test suite on CI so that the library can compare the screenshots. The library will not be able to compare different sizes and resolutions of screenshots. :::