From 7567bc0927e91b7336f4db546992ef658065e1c0 Mon Sep 17 00:00:00 2001 From: Jan Beitner Date: Sat, 15 Aug 2020 17:53:34 +0100 Subject: [PATCH] Annotate test failures in github-actions --- .github/workflows/test.yml | 12 ++---------- poetry.lock | 34 ++++++++++++++++++++++++++-------- pyproject.toml | 5 +++++ 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f574bb97..2b374a05 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -57,16 +57,8 @@ jobs: - name: Install dependencies shell: bash - run: poetry install + run: poetry install -E "github-actions" - name: Run pytest shell: bash - run: poetry run pytest tests --junitxml=junit/test-results-${{ matrix.python-version }}.xml - - - name: Upload test results - uses: actions/upload-artifact@v2 - with: - name: pytest-results-${{ matrix.python-version }} - path: junit/test-results-${{ matrix.python-version }}.xml - # Use always() to always run this step to publish test results when there are test failures - if: ${{ always() }} + run: poetry run pytest tests diff --git a/poetry.lock b/poetry.lock index 0b28010f..c82abc2c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -74,7 +74,7 @@ python = "<3.8" version = ">=1.4.0,<1.5" [[package]] -category = "dev" +category = "main" description = "Atomic file writes." marker = "sys_platform == \"win32\"" name = "atomicwrites" @@ -409,7 +409,7 @@ docs = ["sphinx", "rst.linker"] testing = ["packaging", "pep517", "importlib-resources (>=1.3)"] [[package]] -category = "dev" +category = "main" description = "iniconfig: brain-dead simple config-ini parsing" name = "iniconfig" optional = false @@ -663,7 +663,7 @@ python-versions = "*" version = "0.8.4" [[package]] -category = "dev" +category = "main" description = "More routines for operating on iterables, beyond itertools" name = "more-itertools" optional = false @@ -831,7 +831,7 @@ python-versions = ">=3.5" version = "7.2.0" [[package]] -category = "dev" +category = "main" description = "plugin and hook calling mechanisms for python" name = "pluggy" optional = false @@ -898,7 +898,7 @@ python-versions = "*" version = "0.6.0" [[package]] -category = "dev" +category = "main" description = "library with cross-python path, ini-parsing, io, code, log facilities" name = "py" optional = false @@ -999,7 +999,7 @@ python-versions = "*" version = "2.1" [[package]] -category = "dev" +category = "main" description = "pytest: simple powerful testing with Python" name = "pytest" optional = false @@ -1052,6 +1052,17 @@ version = "1.3.0" py = "*" pytest = ">=3.10" +[[package]] +category = "main" +description = "pytest plugin to annotate failed tests with a workflow command for GitHub Actions" +name = "pytest-github-actions-annotate-failures" +optional = true +python-versions = "*" +version = "0.0.6" + +[package.dependencies] +pytest = ">=4.0.0" + [[package]] category = "dev" description = "pytest-sugar is a plugin for pytest that changes the default look and feel of pytest (e.g. progressbar, show tests that fail instantly)." @@ -1447,7 +1458,7 @@ python-versions = ">=3.5" version = "2.1.0" [[package]] -category = "dev" +category = "main" description = "Python Library for Tom's Obvious, Minimal Language" name = "toml" optional = false @@ -1583,8 +1594,11 @@ version = "3.1.0" docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] testing = ["jaraco.itertools", "func-timeout"] +[extras] +github-actions = ["pytest-github-actions-annotate-failures"] + [metadata] -content-hash = "3bb55af6aecd888584423e7f2d83bd061349d64f25dc16a5a67f115a8c9ca3dd" +content-hash = "041f0ec7d5554c4d34812cae8dbe9092c2058fda254041cca8cb1e7685596977" python-versions = "^3.7" [metadata.files] @@ -2229,6 +2243,10 @@ pytest-forked = [ {file = "pytest-forked-1.3.0.tar.gz", hash = "sha256:6aa9ac7e00ad1a539c41bec6d21011332de671e938c7637378ec9710204e37ca"}, {file = "pytest_forked-1.3.0-py2.py3-none-any.whl", hash = "sha256:dc4147784048e70ef5d437951728825a131b81714b398d5d52f17c7c144d8815"}, ] +pytest-github-actions-annotate-failures = [ + {file = "pytest-github-actions-annotate-failures-0.0.6.tar.gz", hash = "sha256:11f1482da69feb526771ac4268806b5186469405e998320dc46b827d174d05ab"}, + {file = "pytest_github_actions_annotate_failures-0.0.6-py3-none-any.whl", hash = "sha256:3f7976bb84b1c52c9289fce17370ce855cebdb95ded507261fd5bd3350e857e2"}, +] pytest-sugar = [ {file = "pytest-sugar-0.9.4.tar.gz", hash = "sha256:b1b2186b0a72aada6859bea2a5764145e3aaa2c1cfbb23c3a19b5f7b697563d3"}, ] diff --git a/pyproject.toml b/pyproject.toml index 47edda49..17b5b834 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,6 +48,8 @@ pytorch-ranger = "*" matplotlib = "*" cloudpickle = "*" +pytest-github-actions-annotate-failures = {version = "*", optional = true} + [tool.poetry.dev-dependencies] # checks and make tools invoke = "*" @@ -72,6 +74,9 @@ black = { version = "*", allow-prereleases = true } sphinx = "*" m2r = "*" +[tool.poetry.extras] # extras +github-actions = ["pytest-github-actions-annotate-failures"] + [tool.poetry-dynamic-versioning] enable = true vcs = "git"