Parallel Execution in GitHub Actions using Targets

In ANT execution, everything that is configured under the target tag is considered as part of execution. ANT provides us the capability to have multiple target tags present in the same build.xml file. You can initialize the variables with the target names in secrets.

The following command is used to to execute the build file with targets: 

ant -f build.xml target_name

You can run your workflow in parallel using Target by creating separate jobs for the individual target.

Example: You have 100 test cases and you want to execute a set of 50 test cases in parallel. Then, you can have 2 targets present in the build.xml file and each will point to the 50 test cases to be executed.

Below is the .yml as an example:

# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on: 
  workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  build_Chrome:    
     runs-on: ubuntu-latest    
    # Steps represent a sequence of tasks that will be executed as part of the job
     steps:
    # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
     - uses: actions/[email protected]     
     - name: Run in chrome
       env:
        BROWSER_NAME: Chrome
        TARGET1:${{secrets.TARGET1}}     
             run: |
        mkdir $GITHUB_WORKSPACE/ProvarHome
        curl -O https://download.provartesting.com/latest/Provar_ANT_latest.zip
        unzip -o Provar_ANT_latest.zip -d ProvarHome
        rm Provar_ANT_latest.zip
        sudo apt-get update && sudo apt-get upgrade       
        wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -        
        sudo echo "deb [arch=amd64]  http://dl.google.com/linux/chrome/deb/ stable main" >>sudo tee -a /etc/apt/sources.list.d/google-chrome.list
        sudo apt-get -y install google-chrome-stable
        sudo add-apt-repository ppa:mozillateam/firefox-next && sudo apt install firefox
        echo $PROVAR_HOM
        cd $GITHUB_WORKSPACE/test/AN
               
        xvfb-run ant -f build.xml $TARGET1
     - uses: actions/[email protected]
       with:
        name: Execution Report1
       path:${{ github.workspace }}/test/ANT/Results/*
     - uses: actions/[email protected]
       if: failure()
       with:
        name: Execution Report1
        path:${{ github.workspace }}/test/ANT/Results/*
build_ChromeHeadless:
     runs-on: ubuntu-latest    
    # Steps represent a sequence of tasks that will be executed as part of the job
     steps:
    # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
     - uses: actions/[email protected]     
     - name: Run build Headless
       env:
        BROWSER_NAME: Chrome_Headless
        TARGET2:${{secrets.TARGET2}}           
       run: |
        mkdir $GITHUB_WORKSPACE/ProvarHome
        curl -O https://download.provartesting.com/latest/Provar_ANT_latest.zip
        unzip -o Provar_ANT_latest.zip -d ProvarHome
        rm Provar_ANT_latest.zip
        sudo apt-get update && sudo apt-get upgrade       
        wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -        
        sudo echo "deb [arch=amd64]  http://dl.google.com/linux/chrome/deb/ stable main" >>sudo tee -a /etc/apt/sources.list.d/google-chrome.list
        sudo apt-get -y install google-chrome-stable
        sudo add-apt-repository ppa:mozillateam/firefox-next && sudo apt install firefox
        echo $PROVAR_HOM
        cd $GITHUB_WORKSPACE/test/AN
               
        xvfb-run ant -f build.xml $TARGET2
    - uses: actions/[email protected]
       with:
        name: Execution Report2
       path:${{ github.workspace }}/test/ANT/Results/*
     - uses: actions/[email protected]
       if: failure()
       with:
        name: Execution Report2
         path:${{ github.workspace }}/test/ANT/Results/*
Review Provar on G2
Documentation library

Other available resources

Looking for something different?

We use cookies to better understand how our website is used so we can tailor content for you. For more information about the different cookies we use please take a look at our Privacy Policy.

Scroll to Top