mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-12 02:56:56 +08:00
UnitTesting: make the artifact name an option; generate it in Params
This commit is contained in:
1
.github/workflows/Params.yml
vendored
1
.github/workflows/Params.yml
vendored
@@ -43,6 +43,7 @@ jobs:
|
||||
'name': name,
|
||||
'python_version': '${{ inputs.python_version }}',
|
||||
'artifacts': {
|
||||
'unittesting': f'{name}-TestReport',
|
||||
'coverage': f'{name}-coverage',
|
||||
'typing': f'{name}-typing',
|
||||
'package': f'{name}-package',
|
||||
|
||||
8
.github/workflows/UnitTesting.yml
vendored
8
.github/workflows/UnitTesting.yml
vendored
@@ -12,10 +12,10 @@ on:
|
||||
required: false
|
||||
default: '-r tests/requirements.txt'
|
||||
type: string
|
||||
TestReport:
|
||||
artifact:
|
||||
description: "Generate unit test report with junitxml and upload results as an artifact."
|
||||
required: false
|
||||
default: false
|
||||
default: ''
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
@@ -45,14 +45,14 @@ jobs:
|
||||
|
||||
- name: ☑ Run unit tests
|
||||
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
|
||||
|
||||
- name: 📤 Upload 'TestReport.xml' artifact
|
||||
if: inputs.TestReport == 'true'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: TestReport-${{ matrix.python }}
|
||||
name: ${{ inputs.artifact }}-${{ matrix.python }}
|
||||
path: TestReport.xml
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
|
||||
@@ -21,7 +21,7 @@ jobs:
|
||||
jobs: ${{ needs.Params.outputs.python_jobs }}
|
||||
# Optional
|
||||
requirements: '-r tests/requirements.txt'
|
||||
TestReport: true
|
||||
artifact: ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}
|
||||
|
||||
Coverage:
|
||||
uses: pyTooling/Actions/.github/workflows/CoverageCollection.yml@dev
|
||||
|
||||
Reference in New Issue
Block a user