mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Switch to gh-a artifact uploading instead of imgur 'hack'
For test failure screenshots. Happy now @mattysmith22? ;p
This commit is contained in:
8
.github/workflows/django.yml
vendored
8
.github/workflows/django.yml
vendored
@@ -9,8 +9,6 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
env:
|
||||
IMGUR_UPLOAD_CLIENT_ID: ${{ secrets.IMGUR_UPLOAD_CLIENT_ID }}
|
||||
IMGUR_UPLOAD_CLIENT_SECRET: ${{ secrets.IMGUR_UPLOAD_CLIENT_SECRET }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
||||
@@ -56,6 +54,12 @@ jobs:
|
||||
- name: Run Tests
|
||||
if: \!${{ matrix.parallel }}
|
||||
run: coverage run manage.py test ${{ matrix.test-group }} --verbosity=2
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: failure() # Screenshots only make sense for the non-parallel, i.e. interaction tests anyway
|
||||
with:
|
||||
name: failure-screenshots ${{ matrix.test-group }}
|
||||
path: screenshots/
|
||||
retention-days: 5
|
||||
- name: Run Tests (Parallel)
|
||||
if: ${{ matrix.parallel }}
|
||||
run: coverage run manage.py test ${{ matrix.test-group }} --parallel --verbosity=2
|
||||
|
||||
@@ -263,6 +263,3 @@ USE_GRAVATAR = True
|
||||
|
||||
TERMS_OF_HIRE_URL = "http://www.nottinghamtec.co.uk/terms.pdf"
|
||||
AUTHORISATION_NOTIFICATION_ADDRESS = 'productions@nottinghamtec.co.uk'
|
||||
|
||||
IMGUR_UPLOAD_CLIENT_ID = env('IMGUR_UPLOAD_CLIENT_ID', default="")
|
||||
IMGUR_UPLOAD_CLIENT_SECRET = env('IMGUR_UPLOAD_CLIENT_SECRET', default="")
|
||||
|
||||
@@ -62,19 +62,7 @@ def screenshot_failure(func):
|
||||
if not pathlib.Path("screenshots").is_dir():
|
||||
os.mkdir("screenshots")
|
||||
self.driver.save_screenshot(screenshot_file)
|
||||
|
||||
if settings.IMGUR_UPLOAD_CLIENT_ID != "":
|
||||
config = {
|
||||
'album': None,
|
||||
'name': screenshot_name,
|
||||
'title': screenshot_name,
|
||||
'description': ""
|
||||
}
|
||||
client = imgurpython.ImgurClient(settings.IMGUR_UPLOAD_CLIENT_ID, settings.IMGUR_UPLOAD_CLIENT_SECRET)
|
||||
image = client.upload_from_path(screenshot_file, config=config)
|
||||
print("Error in test {} is at url {}".format(screenshot_name, image['link']), file=sys.stderr)
|
||||
else:
|
||||
print("Error in test {} is at path {}".format(screenshot_name, screenshot_file), file=sys.stderr)
|
||||
print("Error in test {} is at path {}".format(screenshot_name, screenshot_file), file=sys.stderr)
|
||||
raise e
|
||||
return wrapper_func
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ envparse==0.2.0
|
||||
gunicorn==20.0.4
|
||||
icalendar==4.0.7
|
||||
idna==2.10
|
||||
imgurpython==1.1.7
|
||||
importlib-metadata==3.4.0
|
||||
lxml==4.6.2
|
||||
Markdown==3.3.3
|
||||
|
||||
Reference in New Issue
Block a user