joonvena / robotframework-reporter-action

This action can be used to send parsed test report as comment to that commit that triggered test run
26 stars 14 forks source link

Getting an error for report.sh file not found when using robotframework-reporter-action #17

Closed RahulMSonone-eaton closed 1 year ago

RahulMSonone-eaton commented 1 year ago

D:\a_temp\2e76fc8a-08bb-4c1d-8707-628ed09676a0.sh: line 1: D:a_actionsjoonvenarobotframework-reporter-actionv2.1/report.sh: No such file or directory Error: Process completed with exit code 127.

below is my ymal code for it

joonvena commented 1 year ago

Can you use ubuntu as runner instead of windows. I think that's the reason why it fails

RahulMSonone-eaton commented 1 year ago

This would cost me changing entire requirement.txt and other things too.. I cannot afford that. Thanks for quick reply reporter looks good though closing issue

joonvena commented 1 year ago

If you check the example in this repositorys root. You could just execute the tests in separate job that would use the windows runner and store the report.xml as artifact. Then define another job that would use the ubuntu runner and would download the artifact and execute the reporter action as it doesn't depend on your requirements.txt or anything else. It just wants the xml file to parse.

RahulMSonone-eaton commented 1 year ago

getting an error in passing files from windows to ubuntu Screenshot (2288)

RahulMSonone-eaton commented 1 year ago
name: CI

# Controls when the workflow will runn
on:
  # Triggers the workflow on push or pull request events but only for the "main" branchh
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: windows-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/checkout@v3

      #python and robotframework setup
      - name: Set up Python 3.10.*
        uses: actions/setup-python@v3
        with:
          python-version: 3.10.*
          cache: 'pip'

      - name: Install python dependencies
        run: |
          pip install -r requirements.txt --use-pep517

      - name: Run robot testss
        run: |
          robot -x outputxunit.xml test_scripts/crm.robot

      - name: Step 1 - Create a temporary artifact downloads folder
        run: mkdir -p downloads

      - name: Upload test results
        uses: actions/upload-artifact@v3
        if: always()
        with:
            path: |
                  D:\a\test\test\output.xml
                  D:\a\test\test\outputxunit.xml
                  D:\a\test\test\log.html
                  D:\a\test\test\report.html

#       - name: Download reports
#         uses: actions/download-artifact@v3
#         with:
#           path: |
#                   D:\a\test\test\downloads

      - name: Display structure of downloaded files
        run: ls -R
        working-directory: D:\a\test\test

  generate_report:
        runs-on: ubuntu-latest
        steps:
        - uses: actions/checkout@v2

        - name: Download reports
          uses: actions/download-artifact@v1
          with:
            name: reports
            path: |
                  D:\a\test\test\downloads

        - name: Send report to commit
          uses: joonvena/robotframework-reporter-action@v2
          with:
            gh_access_token: ${{ secrets.GITHUB_TOKEN }}

            # Path to report
            report_path: downloads

            # SHA of the commit tha triggered the tests
            sha: ${{ github.sha }}

            # ID of the Pull Request
            pull_request_id: ${{ github.event.number }}

            # Add report to job summary
            summary: true

            # Only output report to job summary
            only_summary: false

            # If true only failed tests are shown
            show_passed_tests: true
joonvena commented 1 year ago

You could use --outputdir reports in the robot command to put the reports in the reports folder then upload the results:

- name: Upload test results
   uses: actions/upload-artifact@v3
   if: always()
   with:
      name: reports
      path: reports

Then download the report using:

 - name: Download reports
    uses: actions/download-artifact@v1
    with:
       name: reports
RahulMSonone-eaton commented 1 year ago

Screenshot (2289) Screenshot (2290) Done !! Thanks for answering my queries. Have a great days ahead.