Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

404 Not Found #12

Open
etienne-herlaut-cko opened this issue Dec 12, 2020 · 15 comments
Open

404 Not Found #12

etienne-herlaut-cko opened this issue Dec 12, 2020 · 15 comments

Comments

@etienne-herlaut-cko
Copy link

etienne-herlaut-cko commented Dec 12, 2020

I am trying to use your tool to display my test result.
I like the PR comment functionality so I am using your v1a.
It passes the Publish test results step but then I get a 404 when clicking on the link:

image

Any pointers?

Here is my workflow:

env:
  PYTHON: /usr/bin/python3
  WORKING_DIR: /home/runner/work/surface-tmp/surface-tmp
  VENV: /home/runner/work/surface-tmp/surface-tmp/.env/bin
  PYSPARK_PYTHON: python3
  PYSPARK_DRIVER_PYTHON: python3

name: Surface

on:
  pull_request:
    branches:
      - master

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@master
      - name: Cache pip
        uses: actions/cache@v2
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
          restore-keys: |
            ${{ runner.os }}-pip-
            ${{ runner.os }}-
      - name: Test
        run: |
          ${PYTHON} -m venv .env
          ${VENV}/pip install -r ${WORKING_DIR}/requirements.txt
          ${VENV}/python test_report.py --open_browser False
      - name: Publish test results
        id: html_preview
        uses: pavi2410/html-preview-action@v1a
        with:
          msg: 'Click here to open test result in browser'
          html_file: 'reports/surface-test-report.html'
@pavi2410
Copy link
Owner

reports/surface-test-report.html Is this file checked into the source or is it a generated file? Because currently this action doesn't support generated files.

@etienne-herlaut-cko
Copy link
Author

I think the answer is generated file but I don't know what do you mean by checked into the source.
What makes it harder if it is generated ?

@pavi2410
Copy link
Owner

pavi2410 commented Dec 14, 2020

This action is simply a wrapper for https://github.com/htmlpreview/htmlpreview.github.com. htmlpreview doesn't support this use-case. But what I can do is that I can pull the HTML file and send it as a data URI. That should make it load the generated HTML files.

@etienne-herlaut-cko
Copy link
Author

If that would work, that would be amazing 😊 🙏

@etienne-herlaut-cko
Copy link
Author

Any updates on this ?
For now, I am uploading the html as an artefact.
But would be nicer with this tool.

@pavi2410
Copy link
Owner

Sorry! I'm busy with my exams. I can't do this before the new year.

@etienne-herlaut-cko
Copy link
Author

No problem at all, thanks man and good luck!!

@qiongwu-eqix
Copy link

@pavi2410 I am currently also looking for the same thing. I have a test report in HTML format, and I am hoping there is a github action that can display my test report. I notice that you plan to make html-preview action to work like that. Is there any update? Thanks!

@pavi2410
Copy link
Owner

pavi2410 commented Jun 4, 2021

The issue is that local/generated/private HTML files can't be seen by a public service like https://htmlpreview.github.io

A naive solution would be to copy the contents of the HTML file and return a link to it using a data URI or some other way. But, it won't able to resolve CSS/JS files that the HTML file may require to properly display content.

If you have a better solution to this problem, I'd be very happy to hear :)

@qiongwu-eqix
Copy link

@pavi2410 Thanks for the quick response!

My HTML report file is generated by newman, which is a single file that contains all the pass/fail info. Using the htmlpreview service link, the file can be seen like this: https://htmlpreview.github.io/?https://github.com/kama-equinix/my-actions/blob/main/newman/postman-echo-2021-05-31-04-47-43-718-0.html#pills-summary

Ideally, I am hoping after a job is run, a link is generated and displayed in the job summary -> html result with this link.

I search a lot , but didn't find any other github actions provide this function. But, in Jenkins, it has HTML report plugin to publish the test report.

@vitalyk-multinarity
Copy link

vitalyk-multinarity commented Nov 13, 2022

@qiongwu-eqix @etienne-herlaut-cko - did you find any good solution for this problem?
I encountered the same issue now (need to publish HTML report) and I couldn't see any elegant solution...
I see two workarounds:

  • convert to Markdown - but we lost colors and other HTML features
  • publish as Artifacts - but it's very user un-friendly - he/she needs 3-4 clicks for open HTML

@pavi2410
Copy link
Owner

@vitalyk-multinarity I think in your case you can publish HTML files as artifacts and post their URLs in the comment. Although, I'm not sure if Github now allows single files in artifacts as they use to download as zip before

@vitalyk-multinarity
Copy link

@vitalyk-multinarity I think in your case you can publish HTML files as artifacts and post their URLs in the comment. >Although, I'm not sure if Github now allows single files in artifacts as they use to download as zip

It allows single file, but we cannot download this file as is, we're getting .zip archive.

@pavi2410
Copy link
Owner

The other way is to encode the HTML as a data URI. Depending on the HTML size and content, it may or may not work

@vitalyk-multinarity
Copy link

The other way is to encode the HTML as a data URI. Depending on the HTML size and content, it may or may not work

Thank you, didn't know about this option, I'll check it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants