From beddc2b41a00d3c15f0696f56e4223886c64fa22 Mon Sep 17 00:00:00 2001 From: Kamalpreet Kaur Date: Mon, 14 Aug 2023 19:03:09 +0530 Subject: [PATCH 1/5] add: maven workflow dispatch --- .github/workflows/sanity-workflow.yml | 120 ++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 .github/workflows/sanity-workflow.yml diff --git a/.github/workflows/sanity-workflow.yml b/.github/workflows/sanity-workflow.yml new file mode 100644 index 0000000..38c7533 --- /dev/null +++ b/.github/workflows/sanity-workflow.yml @@ -0,0 +1,120 @@ +# This job is to test different maven profiles in sdk branch against full commit-id provided +# This workflow targets Java with Maven execution + +name: Java SDK Test workflow for Maven on workflow_dispatch + +on: + workflow_dispatch: + inputs: + commit_sha: + description: 'The full commit id to build' + required: true + +jobs: + comment-run: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + max-parallel: 3 + matrix: + java: [ '8', '11', '17' ] + os: [ 'macos-latest', 'windows-latest', 'ubuntu-latest' ] + name: JUnit Appium Repo ${{ matrix.Java }} - ${{ matrix.os }} Sample + env: + BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} + BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} + + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.inputs.commit_sha }} + - uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 + id: status-check-in-progress + env: + job_name: JUnit Appium Repo ${{ matrix.Java }} - ${{ matrix.os }} Sample + commit_sha: ${{ github.event.inputs.commit_sha }} + with: + github-token: ${{ github.token }} + script: | + const result = await github.rest.checks.create({ + owner: context.repo.owner, + repo: context.repo.repo, + name: process.env.job_name, + head_sha: process.env.commit_sha, + status: 'in_progress' + }).catch((err) => ({status: err.status, response: err.response})); + console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`) + if (result.status !== 201) { + console.log('Failed to create check run') + } + - name: Set up Java + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: ${{ matrix.java }} + - name: Run mvn test for junit4 android + run: | + cd android/junit4-examples + mvn compile + mvn test + mvn test -P sample-test + - name: Run mvn test for junit5 android + run: | + cd android/junit5-examples + mvn compile + mvn test + mvn test -P sample-test + - name: Run mvn profile sample-local-test for junit4 android + run: | + cd android/junit4-examples + mvn compile + mvn test -P sample-local-test -Dbrowserstack.app="./LocalSample.apk" + - name: Run mvn profile sample-local-test for junit5 android + run: | + cd android/junit5-examples + mvn compile + mvn test -P sample-local-test -Dbrowserstack.app="./LocalSample.apk" + - name: Run mvn test for junit4 ios + run: | + cd ios/junit4-examples + mvn compile + mvn test + mvn test -P sample-test + - name: Run mvn test for junit5 ios + run: | + cd ios/junit5-examples + mvn compile + mvn test + mvn test -P sample-test + - name: Run mvn profile sample-local-test for junit4 ios + run: | + cd ios/junit4-examples + mvn compile + mvn test -P sample-local-test -Dbrowserstack.app="./LocalSample.ipa" + - name: Run mvn profile sample-local-test for junit5 ios + run: | + cd ios/junit5-examples + mvn compile + mvn test -P sample-local-test -Dbrowserstack.app="./LocalSample.ipa" + - if: always() + uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 + id: status-check-completed + env: + conclusion: ${{ job.status }} + job_name: TestNG Appium Repo ${{ matrix.Java }} - ${{ matrix.os }} Sample + commit_sha: ${{ github.event.inputs.commit_sha }} + with: + github-token: ${{ github.token }} + script: | + const result = await github.rest.checks.create({ + owner: context.repo.owner, + repo: context.repo.repo, + name: process.env.job_name, + head_sha: process.env.commit_sha, + status: 'completed', + conclusion: process.env.conclusion + }).catch((err) => ({status: err.status, response: err.response})); + console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`) + if (result.status !== 201) { + console.log('Failed to create check run') + } From bb6d5fd7a0429827360a928eb9070f865c635011 Mon Sep 17 00:00:00 2001 From: Kamalpreet Kaur Date: Mon, 14 Aug 2023 19:26:44 +0530 Subject: [PATCH 2/5] chore: cli arg app key --- .github/workflows/sanity-workflow.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sanity-workflow.yml b/.github/workflows/sanity-workflow.yml index 38c7533..9019f7d 100644 --- a/.github/workflows/sanity-workflow.yml +++ b/.github/workflows/sanity-workflow.yml @@ -68,12 +68,12 @@ jobs: run: | cd android/junit4-examples mvn compile - mvn test -P sample-local-test -Dbrowserstack.app="./LocalSample.apk" + mvn test -P sample-local-test -D"browserstack.app"="./LocalSample.apk" - name: Run mvn profile sample-local-test for junit5 android run: | cd android/junit5-examples mvn compile - mvn test -P sample-local-test -Dbrowserstack.app="./LocalSample.apk" + mvn test -P sample-local-test -D"browserstack.app"="./LocalSample.apk" - name: Run mvn test for junit4 ios run: | cd ios/junit4-examples @@ -90,12 +90,12 @@ jobs: run: | cd ios/junit4-examples mvn compile - mvn test -P sample-local-test -Dbrowserstack.app="./LocalSample.ipa" + mvn test -P sample-local-test -D"browserstack.app"="./LocalSample.ipa" - name: Run mvn profile sample-local-test for junit5 ios run: | cd ios/junit5-examples mvn compile - mvn test -P sample-local-test -Dbrowserstack.app="./LocalSample.ipa" + mvn test -P sample-local-test -D"browserstack.app"="./LocalSample.ipa" - if: always() uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 id: status-check-completed From 07eebf306282cb328851765d8b18b9c73fe5aa39 Mon Sep 17 00:00:00 2001 From: Kamalpreet Kaur Date: Mon, 14 Aug 2023 21:51:51 +0530 Subject: [PATCH 3/5] chore: change directory command --- .github/workflows/sanity-workflow.yml | 40 +++++++++++++-------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/sanity-workflow.yml b/.github/workflows/sanity-workflow.yml index 9019f7d..33e6c9f 100644 --- a/.github/workflows/sanity-workflow.yml +++ b/.github/workflows/sanity-workflow.yml @@ -54,46 +54,46 @@ jobs: java-version: ${{ matrix.java }} - name: Run mvn test for junit4 android run: | - cd android/junit4-examples - mvn compile - mvn test - mvn test -P sample-test - - name: Run mvn test for junit5 android - run: | - cd android/junit5-examples + cd junit4-examples/android mvn compile mvn test mvn test -P sample-test - name: Run mvn profile sample-local-test for junit4 android run: | - cd android/junit4-examples - mvn compile - mvn test -P sample-local-test -D"browserstack.app"="./LocalSample.apk" - - name: Run mvn profile sample-local-test for junit5 android - run: | - cd android/junit5-examples + cd junit4-examples/android mvn compile mvn test -P sample-local-test -D"browserstack.app"="./LocalSample.apk" - name: Run mvn test for junit4 ios run: | - cd ios/junit4-examples + cd junit4-examples/ios mvn compile mvn test mvn test -P sample-test - - name: Run mvn test for junit5 ios + - name: Run mvn profile sample-local-test for junit4 ios + run: | + cd junit4-examples/ios + mvn compile + mvn test -P sample-local-test -D"browserstack.app"="./LocalSample.ipa" + - name: Run mvn test for junit5 android run: | - cd ios/junit5-examples + cd junit5-examples/android mvn compile mvn test mvn test -P sample-test - - name: Run mvn profile sample-local-test for junit4 ios + - name: Run mvn profile sample-local-test for junit5 android run: | - cd ios/junit4-examples + cd junit5-examples/android mvn compile - mvn test -P sample-local-test -D"browserstack.app"="./LocalSample.ipa" + mvn test -P sample-local-test -D"browserstack.app"="./LocalSample.apk" + - name: Run mvn test for junit5 ios + run: | + cd junit5-examples/ios + mvn compile + mvn test + mvn test -P sample-test - name: Run mvn profile sample-local-test for junit5 ios run: | - cd ios/junit5-examples + cd junit5-examples/ios mvn compile mvn test -P sample-local-test -D"browserstack.app"="./LocalSample.ipa" - if: always() From 113b04e31e8dce7edd9b38f47b3331d966526bd8 Mon Sep 17 00:00:00 2001 From: Kamalpreet Kaur Date: Mon, 14 Aug 2023 22:07:40 +0530 Subject: [PATCH 4/5] chore: change directory name --- .github/workflows/sanity-workflow.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/sanity-workflow.yml b/.github/workflows/sanity-workflow.yml index 33e6c9f..58531f5 100644 --- a/.github/workflows/sanity-workflow.yml +++ b/.github/workflows/sanity-workflow.yml @@ -54,46 +54,46 @@ jobs: java-version: ${{ matrix.java }} - name: Run mvn test for junit4 android run: | - cd junit4-examples/android + cd junit-4/android mvn compile mvn test mvn test -P sample-test - name: Run mvn profile sample-local-test for junit4 android run: | - cd junit4-examples/android + cd junit-4/android mvn compile mvn test -P sample-local-test -D"browserstack.app"="./LocalSample.apk" - name: Run mvn test for junit4 ios run: | - cd junit4-examples/ios + cd junit-4/ios mvn compile mvn test mvn test -P sample-test - name: Run mvn profile sample-local-test for junit4 ios run: | - cd junit4-examples/ios + cd junit-4/ios mvn compile mvn test -P sample-local-test -D"browserstack.app"="./LocalSample.ipa" - name: Run mvn test for junit5 android run: | - cd junit5-examples/android + cd junit-5/android mvn compile mvn test mvn test -P sample-test - name: Run mvn profile sample-local-test for junit5 android run: | - cd junit5-examples/android + cd junit-5/android mvn compile mvn test -P sample-local-test -D"browserstack.app"="./LocalSample.apk" - name: Run mvn test for junit5 ios run: | - cd junit5-examples/ios + cd junit-5/ios mvn compile mvn test mvn test -P sample-test - name: Run mvn profile sample-local-test for junit5 ios run: | - cd junit5-examples/ios + cd junit-5/ios mvn compile mvn test -P sample-local-test -D"browserstack.app"="./LocalSample.ipa" - if: always() @@ -101,7 +101,7 @@ jobs: id: status-check-completed env: conclusion: ${{ job.status }} - job_name: TestNG Appium Repo ${{ matrix.Java }} - ${{ matrix.os }} Sample + job_name: JUnit Appium Repo ${{ matrix.Java }} - ${{ matrix.os }} Sample commit_sha: ${{ github.event.inputs.commit_sha }} with: github-token: ${{ github.token }} From 8233f845afb8575fd49c7790b965d4df945c4186 Mon Sep 17 00:00:00 2001 From: Kamalpreet Kaur Date: Mon, 14 Aug 2023 22:31:18 +0530 Subject: [PATCH 5/5] chore: remove mvn test --- .github/workflows/sanity-workflow.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/sanity-workflow.yml b/.github/workflows/sanity-workflow.yml index 58531f5..f4a83ef 100644 --- a/.github/workflows/sanity-workflow.yml +++ b/.github/workflows/sanity-workflow.yml @@ -56,7 +56,6 @@ jobs: run: | cd junit-4/android mvn compile - mvn test mvn test -P sample-test - name: Run mvn profile sample-local-test for junit4 android run: | @@ -67,7 +66,6 @@ jobs: run: | cd junit-4/ios mvn compile - mvn test mvn test -P sample-test - name: Run mvn profile sample-local-test for junit4 ios run: | @@ -78,7 +76,6 @@ jobs: run: | cd junit-5/android mvn compile - mvn test mvn test -P sample-test - name: Run mvn profile sample-local-test for junit5 android run: | @@ -89,7 +86,6 @@ jobs: run: | cd junit-5/ios mvn compile - mvn test mvn test -P sample-test - name: Run mvn profile sample-local-test for junit5 ios run: |