UnitTesting: make the artifact name an option; generate it in Params

This commit is contained in:
umarcor
2021-11-29 22:49:56 +01:00
parent c632013646
commit 6e501b3ead
3 changed files with 6 additions and 5 deletions

View File

@@ -43,6 +43,7 @@ jobs:
'name': name, 'name': name,
'python_version': '${{ inputs.python_version }}', 'python_version': '${{ inputs.python_version }}',
'artifacts': { 'artifacts': {
'unittesting': f'{name}-TestReport',
'coverage': f'{name}-coverage', 'coverage': f'{name}-coverage',
'typing': f'{name}-typing', 'typing': f'{name}-typing',
'package': f'{name}-package', 'package': f'{name}-package',

View File

@@ -12,10 +12,10 @@ on:
required: false required: false
default: '-r tests/requirements.txt' default: '-r tests/requirements.txt'
type: string type: string
TestReport: artifact:
description: "Generate unit test report with junitxml and upload results as an artifact." description: "Generate unit test report with junitxml and upload results as an artifact."
required: false required: false
default: false default: ''
type: string type: string
jobs: jobs:
@@ -45,14 +45,14 @@ jobs:
- name: ☑ Run unit tests - name: ☑ Run unit tests
run: | run: |
[ '${{ inputs.TestReport }}' = 'true' ] && PYTEST_ARGS='--junitxml=TestReport.xml' || unset PYTEST_ARGS [ 'x${{ inputs.artifact }}' != 'x' ] && PYTEST_ARGS='--junitxml=TestReport.xml' || unset PYTEST_ARGS
python -m pytest -rA tests/unit $PYTEST_ARGS --color=yes python -m pytest -rA tests/unit $PYTEST_ARGS --color=yes
- name: 📤 Upload 'TestReport.xml' artifact - name: 📤 Upload 'TestReport.xml' artifact
if: inputs.TestReport == 'true' if: inputs.TestReport == 'true'
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: TestReport-${{ matrix.python }} name: ${{ inputs.artifact }}-${{ matrix.python }}
path: TestReport.xml path: TestReport.xml
if-no-files-found: error if-no-files-found: error
retention-days: 1 retention-days: 1

View File

@@ -21,7 +21,7 @@ jobs:
jobs: ${{ needs.Params.outputs.python_jobs }} jobs: ${{ needs.Params.outputs.python_jobs }}
# Optional # Optional
requirements: '-r tests/requirements.txt' requirements: '-r tests/requirements.txt'
TestReport: true artifact: ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}
Coverage: Coverage:
uses: pyTooling/Actions/.github/workflows/CoverageCollection.yml@dev uses: pyTooling/Actions/.github/workflows/CoverageCollection.yml@dev