joonvena / Robot-Reporter

Robot Reporter is a tool for Robot Framework test reporting.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No such file or directory /github/workspace/assets/template.txt

shanebenlolo opened this issue · comments

I received the following error when using your robotframework-reporter-action@v0.1:

2021/07/15 23:04:52 stat /github/workspace/assets/template.txt: no such file or directory

here is the full action:

      - name: Send test report as comment to commit
        uses: joonvena/robotframework-reporter-action@v0.1
        if: ${{ github.event_name == 'push' }}
        env:
          GH_ACCESS_TOKEN: ${{ github.TOKEN }}
          REPO_OWNER: ${{ github.REPOSITORY_OwNER }}
          COMMIT_SHA: ${{ github.SHA }}
          REPOSITORY: ${{ github.repository }}
          REPORT_PATH: ${{ github.workspace }}/Reports

please let me know if you know what the issue is, thank you 👍

Fixed #5. Should work now 👍

Thanks for the quick response. Just tried to rerun the workflow and was met with this error:

2021/07/16 03:40:49 POST https://api.github.com/repos/shanebenlolo/shanebenlolo/gha_rf_docker_test/commits/ab4e7a9e45fba123b5e9cbe12adbcbf2d4961ba6/comments: 404 Not Found []

This one could be on my end, please let me know what you think.

Could you share the full workflow file? I did execute the updated workflow and it works on my end.

name: Run Robot Framework Tests
on:
  push:
    # runs tests for commits pushed to master
    branches:
      - main
    # do not run tests if file README.md changes
    paths-ignore:
      - "README.md"
    # run tests for GitHub Pull requests. Test result is visible in the Pull Request page.
  pull_request:
    paths-ignore:
      - "README.md"
  schedule:
    # run tests once a year in January 1st
    - cron: "0 0 1 1 *"
jobs:
  run_tests:
    runs-on: ubuntu-latest
    steps:
      # checkout code from a repository
      - uses: actions/checkout@v2
      # create folder for test reports
      - name: Create folder for reports
        run: mkdir reports
      # run Robot Framework tests inside Docker container
      - name: Run Robot Framework Tests
        # container used here is ppodgorsek/robot-framework:latest
        # see container documentation for usage: https://hub.docker.com/r/ppodgorsek/robot-framework/dockerfile
        # it is required that GitHub repository contains folder "reports". Commit some file inside "reports" to create it
        # place tests in folder tests or change docker run command accordingly
        # configure -e ROBOT_OPTIONS according to yout tests, or remove it if no special configuration is needed
        run: |
          docker run \
            -v ${PWD}/reports:/opt/robotframework/reports:Z \
            -v ${PWD}/Tests:/opt/robotframework/tests:Z \
            -v ${PWD}/Listeners:/opt/robotframework/listeners:Z \
            -e ROBOT_OPTIONS="--listener /opt/robotframework/listeners/TestListener.py" \
            --user $(id -u):$(id -g) \
            ppodgorsek/robot-framework:latest
      # upload test reports as a zip file
      - name: Upload reports
        uses: actions/upload-artifact@v1
        if: always()
        with:
          name: reports
          # set path to Robot Framework results reports. Exclude dummy file that is needed because of ppodgorsek image priviledges.
          path: ${{ github.workspace }}/reports
      # repository name is needed for posting test report in a next step
      - name: Get Repository Name
        run: |
          export REPO="$(echo "${{ github.repository }}" | awk -F / '{print $2}' | sed -e "s/:refs//")"
      # when test are run for a commit, post results as a comment
      # note: comment is not posted for tests triggered for pull requests, only for a main branch (master)
      - name: Send test report as comment to commit
        uses: joonvena/robotframework-reporter-action@v0.1
        if: ${{ github.event_name == 'push' }}
        env:
          GH_ACCESS_TOKEN: ${{ github.TOKEN }}
          REPO_OWNER: ${{ github.REPOSITORY_OwNER }}
          COMMIT_SHA: ${{ github.SHA }}
          REPOSITORY: ${{ github.repository }}
          REPORT_PATH: ${{ github.workspace }}/reports

EDIT: I was using "Reports" rather than "report" in some places and thought that may have been an issue, but after changing them all instances of the word to "reports", the issue is persisting. I have edited the code above to reflect this change

I just finished adding new and updated actions for running the tests and for reporting also. Check this out for complete example:

https://github.com/joonvena/robotframework-reporter-action#example-usage-with-robotframework-docker-action