Skip to content

Instantly share code, notes, and snippets.

@rakesh-vardan
Created August 22, 2021 13:18

Revisions

  1. rakesh-vardan created this gist Aug 22, 2021.
    80 changes: 80 additions & 0 deletions semaphoreyamlcomplexpardocker.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,80 @@
    version: v1.0
    name: Complex Pipeline with multiple browsers - docker
    agent:
    machine:
    type: e1-standard-2
    os_image: ubuntu1804
    blocks:
    - name: Build
    dependencies: []
    task:
    env_vars:
    - name: MAVEN_OPTS
    value: '-Dmaven.repo.local=.m2'
    jobs:
    - name: Build
    commands:
    - checkout
    - mvn -q package -DskipTests=true
    - cache store
    - name: API Smoke tests
    dependencies:
    - Build
    task:
    env_vars:
    - name: MAVEN_OPTS
    value: '-Dmaven.repo.local=.m2'
    prologue:
    commands:
    - checkout
    - cache restore
    jobs:
    - name: Run Smoke API tests
    commands:
    - mvn clean install -DsuiteXmlFile=testng-api.xml
    epilogue:
    always:
    commands:
    - test-results publish target/surefire-reports/junitreports/*.xml
    - name: Firefox tests
    dependencies:
    - API Smoke tests
    task:
    env_vars:
    - name: MAVEN_OPTS
    value: '-Dmaven.repo.local=.m2'
    prologue:
    commands:
    - checkout
    - cache restore
    jobs:
    - name: Run tests in Firefox
    commands:
    - docker run -d -p 4444:4444 -v /dev/shm:/dev/shm selenium/standalone-firefox:4.0.0-rc-1-prerelease-20210618
    - docker ps
    - mvn clean install -DsuiteXmlFile=testng.xml -Dbrowser=GRID_FIREFOX -DgridHubURL=http://localhost:4444/wd/hub
    epilogue:
    always:
    commands:
    - test-results publish target/surefire-reports/junitreports/*.xml
    - name: Chrome tests
    dependencies:
    - API Smoke tests
    task:
    env_vars:
    - name: MAVEN_OPTS
    value: '-Dmaven.repo.local=.m2'
    prologue:
    commands:
    - checkout
    - cache restore
    jobs:
    - name: Run tests in Chrome
    commands:
    - docker run -d -p 4444:4444 -v /dev/shm:/dev/shm selenium/standalone-chrome:4.0.0-rc-1-prerelease-20210618
    - docker ps
    - mvn clean install -DsuiteXmlFile=testng.xml -Dbrowser=GRID_CHROME -DgridHubURL=http://localhost:4444/wd/hub
    epilogue:
    always:
    commands:
    - test-results publish target/surefire-reports/junitreports/*.xml