Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(workflow): ⚡ run cloud tests when cloud env variables set #626

Merged
merged 3 commits into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/_test-core-java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
java-version:
type: string
description: Version of Java to run on
default: 17
default: '17'
suite-name:
type: string
description: Test Suite name to run
Expand Down
65 changes: 49 additions & 16 deletions .github/workflows/test-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ concurrency:
group: boyka-tests-${{ github.ref }}-1
cancel-in-progress: true

env:
BS_USER: ${{ secrets.BS_USER }}
BS_KEY: ${{ secrets.BS_KEY }}
LT_USER: ${{ secrets.LT_USER }}
LT_KEY: ${{ secrets.LT_KEY }}

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -42,31 +36,67 @@ jobs:
- name: Build the project
run: mvn clean install -f core-java/pom.xml -DskipTests

test-api:
check-cloud:
runs-on: ubuntu-latest

needs:
- build

env:
LT_USER: ${{ secrets.LT_USER }}
BS_USER: ${{ secrets.BS_USER }}

outputs:
bs-present: ${{ steps.bs-secrets.outputs.present }}
lt-present: ${{ steps.lt-secrets.outputs.present }}

steps:
- name: Check BrowserStack secrets presence
id: bs-secrets
shell: bash
run: |
if [ "$BS_USER" == "" ]; then
echo "present=NO" >> $GITHUB_OUTPUT
else
echo "present=YES" >> $GITHUB_OUTPUT
fi

- name: Check BrowserStack secrets presence
id: lt-secrets
shell: bash
run: |
if [ "$LT_USER" == "" ]; then
echo "present=NO" >> $GITHUB_OUTPUT
else
echo "present=YES" >> $GITHUB_OUTPUT
fi

test-api:
needs:
- check-cloud
uses: ./.github/workflows/_test-core-java.yml
with:
suite-name: testng-api

test-others:
needs:
- build
- check-cloud
uses: ./.github/workflows/_test-core-java.yml
with:
suite-name: testng-others

test-web-local:
needs:
- build
- check-cloud
uses: ./.github/workflows/_test-core-java.yml
with:
suite-name: testng-web-local
runs-on: macos-latest

test-web-bs:
needs:
- build
- check-cloud
if: ${{ needs.check-cloud.outputs.bs-present == 'YES' }}
uses: ./.github/workflows/_test-core-java.yml
secrets:
cloudUser: ${{ secrets.BS_USER }}
Expand All @@ -76,7 +106,8 @@ jobs:

test-web-lt:
needs:
- build
- check-cloud
if: ${{ needs.check-cloud.outputs.lt-present == 'YES' }}
uses: ./.github/workflows/_test-core-java.yml
secrets:
cloudUser: ${{ secrets.LT_USER }}
Expand All @@ -86,15 +117,15 @@ jobs:

test-web-grid:
needs:
- build
- check-cloud
uses: ./.github/workflows/_test-core-java.yml
with:
suite-name: testng-web-grid
run-grid: true

test-mobile-local:
needs:
- build
- check-cloud
uses: ./.github/workflows/_test-core-java.yml
with:
runs-on: macos-latest
Expand All @@ -108,7 +139,7 @@ jobs:

test-mobile-web:
needs:
- build
- check-cloud
uses: ./.github/workflows/_test-core-java.yml
with:
runs-on: macos-latest
Expand All @@ -120,7 +151,8 @@ jobs:

test-mobile-bs:
needs:
- build
- check-cloud
if: ${{ needs.check-cloud.outputs.bs-present == 'YES' }}
uses: ./.github/workflows/_test-core-java.yml
secrets:
cloudUser: ${{ secrets.BS_USER }}
Expand All @@ -130,7 +162,8 @@ jobs:

test-mobile-lt:
needs:
- build
- check-cloud
if: ${{ needs.check-cloud.outputs.lt-present == 'YES' }}
uses: ./.github/workflows/_test-core-java.yml
secrets:
cloudUser: ${{ secrets.LT_USER }}
Expand Down