Skip to content

Commit

Permalink
add github action
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Lerch <rlerch@redhat.com>
  • Loading branch information
ryanlerch committed Mar 25, 2024
1 parent 674b9db commit 9e42241
Show file tree
Hide file tree
Showing 4 changed files with 785 additions and 3 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Tests & Build

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
lint:
name: Run Format & Linting Checks
container:
image: fedorapython/fedora-python-tox
steps:
- uses: actions/checkout@v4
- name: Mark the directory as safe for git
run: git config --global --add safe.directory $PWD

- name: Install RPM dependencies
run: |
dnf install -y krb5-devel libpq-devel gettext python-tox poetry
- name: Run tests
run: tox -e ${{ matrix.tox_env }}
strategy:
matrix:
tox_env:
- lint
- format
runs-on: ubuntu-latest

unit_tests:
name: Run the Unit Tests
container: fedorapython/fedora-python-tox:latest
steps:
- uses: actions/checkout@v4
- name: Mark the directory as safe for git
run: git config --global --add safe.directory $PWD
- name: Install RPM dependencies
run: |
dnf install -y krb5-devel libpq-devel gettext python-tox poetry
- name: Run tests
run: tox -e ${{ matrix.tox_env }}
strategy:
matrix:
tox_env:
- py39
- py310
- py311
runs-on: ubuntu-latest
7 changes: 5 additions & 2 deletions kerneltest/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def upload_results(test_result, username, authenticated=False):
logdir = APP.config.get("LOG_DIR", "logs")
if not os.path.exists(logdir) and not os.path.isdir(logdir):
os.mkdir(logdir)

try:
(testdate, testset, testkver, testrel, testresult, failedtests) = parseresults(test_result)
APP.logger.error(testkver)
Expand Down Expand Up @@ -269,7 +270,7 @@ def allowed_file(input_file):
allowed_types = APP.config.get("ALLOWED_MIMETYPES", [])
APP.logger.info("input submitted with mimetype: %s" % input_file.mimetype)
if input_file.mimetype not in allowed_types:
raise InvalidInputException("Invalid input submitted: %s" % input_file.mimetype)
raise Exception("Invalid input submitted: %s" % input_file.mimetype)


@APP.context_processor
Expand Down Expand Up @@ -468,8 +469,10 @@ def upload_anonymous():
jsonout.status_code = 401
return jsonout

tests = upload_results(test_result, username, authenticated=is_authenticated())

try:
tests = upload_results(test_result, username, authenticated=is_authenticated())
# tests = upload_results(test_result, username, authenticated=is_authenticated())
SESSION.commit()
output = {"message": "Upload successful!"}
except InvalidInputException as err:
Expand Down
Loading

0 comments on commit 9e42241

Please sign in to comment.