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,
|
'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',
|
||||||
|
|||||||
8
.github/workflows/UnitTesting.yml
vendored
8
.github/workflows/UnitTesting.yml
vendored
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user