Forum Discussion

asifpasha291's avatar
asifpasha291
Occasional Visitor
3 years ago

zephyr scale integration with github actions

Hi Community,

 

I am planning to integrate zephyr scale with GitHub actions for my automation scripts to update the result back to scale post-build.

Anyone let me know some resources or ideas on how to do this?

  • MisterB's avatar
    MisterB
    Champion Level 3

    Congratulations!  And thank you for sharing with us ðŸ˜Š

  • Hello guys, finally I had success on all pipeline! 
    Here is my yml file for reference! 

    Actually, just the last four lines is the entire solution, but I posting the entire document for reference

    name: "e2e"
    on: [push]
    jobs:
    test-e2e:
    name: Run E2E tests
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - uses: actions/setup-node@v2
    with:
    node-version: '18'
    - name: Install dependencies
    run: npm ci
    - name: Install Playwright
    run: npx playwright install --with-deps
    - name: Run your tests
    run: npx playwright test
    - name: Upload allure report results
    if: always()
    uses: actions/upload-artifact@v2
    with:
    name: Allure Report
    path: test-results
    - name: Upload JUnit artifact
    if: always()
    uses: actions/upload-artifact@v2
    with:
    name: junit-artifact
    path: playwright-report
    - name: Download Artifact
    if: always()
    uses: actions/download-artifact@v2
    with:
    name: junit-artifact
    path: download-artifact
    - name: Get File Info
    id: file
    if: always()
    run: |
    relative_path="download-artifact/results.xml"
    absolute_path="${{ github.workspace }}/$relative_path"
    echo "Absolute path of the downloaded file: $absolute_path"
    file_size=$(stat -c%s "$absolute_path")
    echo "::set-output name=path::$absolute_path"
    echo "Size of the downloaded file: $file_size"
    - name: upload to Zephyr via curl
    if: always()
    run: >-
    curl --location --request POST '${{ vars.ZEPHYR_BASE_URL }}/automations/executions/junit?autoCreateTestCases=true&projectKey=${{ vars.ZEPHYR_PROJECT_KEY }}' --header 'Authorization: Bearer ${{ secrets.ZEPHYR_TOKEN }}' --form 'file=@"${{ steps.file.outputs.path }}"'
  • I'm looking for a solution, too... I am almost done by passing a curl command into my .yml file but I'm stuck on this step because I cannot perform this POST even using Postman. 
    I don't know what to do anymore. 
    Here is my solution that doesn't work at all, I hope to help anyone that is luckier than me at the POST request

     

    name: "e2e"
    on: [push]
    jobs:
    test-e2e:
    name: Run E2E tests
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - uses: actions/setup-node@v2
    with:
    node-version: '18'
    - name: Install dependencies
    run: npm ci
    - name: Install Playwright
    run: npx playwright install --with-deps
    - name: Run your tests
    run: npx playwright test
    - name: Upload allure report results
    if: always()
    uses: actions/upload-artifact@v2
    with:
    name: Allure Report
    path: test-results
    - name: Upload JUnit artifact
    if: always()
    uses: actions/upload-artifact@v2
    with:
    name: junit-artifact
    path: playwright-report
    - name: Download Artifact
    if: always()
    uses: actions/download-artifact@v2
    with:
    name: junit-artifact
    path: download-artifact
    - name: Get Path
    id: file-path
    if: always()
    run: |
    file_path=download-artifact/results.xml
    echo "PATH LOG: $file_path"
    echo "::set-output name=path::$file_path"
    cd download-artifact
    ls -R
    - name: Get File Size
    if: always()
    id: file-size
    run: |
    file_size=$(stat -c%s "${{ steps.file-path.outputs.path }}")
    echo "SIZE LOG: $file_size"
    echo "::set-output name=size::$file_size"
    - name: upload to Zephyr via curl
    if: always()
    run: >-
    curl -X POST "${{ vars.ZEPHYR_BASE_URL }}/automations/executions/junit?projectKey=${{ vars.ZEPHYR_PROJECT_KEY }}&autoCreateTestCases=true" \
    -H "Authorization: Bearer ${{ secrets.TOKEN }}" \
    -H "Content-Length: ${{ steps.file-size.outputs.size }} "\
    -H "Content-Type: application/json" \
    --data-binary "@downloaded-artifact/results.xml" \
    --data '{"testCycle": {"name": "Created by GitHub Actions", "description": "Something to think about", "folderId": "${{ vars.TESTCYCLE_FOLDER_ID }}"}}'

     

    My solution was based on the docs: Zephyr Scale for Jira Cloud API 

  • samaarah's avatar
    samaarah
    New Contributor
    I am also investigating this and would like to get info this as well.