mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-12 02:56:56 +08:00
Split test directory and unit test directory into 2 parameters.
This commit is contained in:
12
.github/workflows/CoverageCollection.yml
vendored
12
.github/workflows/CoverageCollection.yml
vendored
@@ -35,10 +35,15 @@ on:
|
||||
required: false
|
||||
default: '-r tests/requirements.txt'
|
||||
type: string
|
||||
unittest_directory:
|
||||
description: 'Path to the directory containing unit tests.'
|
||||
test_directory:
|
||||
description: 'Path to the directory containing tests (test working directory).'
|
||||
required: false
|
||||
default: 'tests/unit'
|
||||
default: 'tests'
|
||||
type: string
|
||||
unittest_directory:
|
||||
description: 'Path to the directory containing unit tests (from test_directory).'
|
||||
required: false
|
||||
default: 'unit'
|
||||
type: string
|
||||
coverage_config:
|
||||
description: 'Path to the .coveragerc file. Use pyproject.toml by default.'
|
||||
@@ -117,6 +122,7 @@ jobs:
|
||||
- name: Collect coverage
|
||||
continue-on-error: true
|
||||
run: |
|
||||
cd ${{ inputs.test_directory }}
|
||||
[ 'x${{ inputs.coverage_config }}' != 'x' ] && PYCOV_ARGS='--cov-config=${{ inputs.coverage_config }}' || unset PYCOV_ARGS
|
||||
python -m pytest -rA --cov=. $PYCOV_ARGS ${{ inputs.unittest_directory }} --color=yes
|
||||
|
||||
|
||||
21
.github/workflows/UnitTesting.yml
vendored
21
.github/workflows/UnitTesting.yml
vendored
@@ -48,10 +48,15 @@ on:
|
||||
required: false
|
||||
default: ''
|
||||
type: string
|
||||
unittest_directory:
|
||||
description: 'Path to the directory containing unit tests.'
|
||||
test_directory:
|
||||
description: 'Path to the directory containing tests (test working directory).'
|
||||
required: false
|
||||
default: 'tests/unit'
|
||||
default: 'tests'
|
||||
type: string
|
||||
unittest_directory:
|
||||
description: 'Path to the directory containing unit tests (from test_directory).'
|
||||
required: false
|
||||
default: 'unit'
|
||||
type: string
|
||||
artifact:
|
||||
description: "Generate unit test report with junitxml and upload results as an artifact."
|
||||
@@ -113,20 +118,22 @@ jobs:
|
||||
- name: ☑ Run unit tests
|
||||
if: matrix.system == 'windows'
|
||||
run: |
|
||||
$PYTEST_ARGS = if ("${{ inputs.artifact }}".length -gt 0) { "--junitxml=TestReport.xml" } else { "" }
|
||||
cd ${{ inputs.test_directory }}
|
||||
$PYTEST_ARGS = if ("${{ inputs.artifact }}".length -gt 0) { "--junitxml=TestReportSummary.xml" } else { "" }
|
||||
python -m pytest -rA ${{ inputs.unittest_directory }} $PYTEST_ARGS --color=yes
|
||||
|
||||
- name: ☑ Run unit tests
|
||||
if: matrix.system != 'windows'
|
||||
run: |
|
||||
[ 'x${{ inputs.artifact }}' != 'x' ] && PYTEST_ARGS='--junitxml=TestReport.xml' || unset PYTEST_ARGS
|
||||
cd ${{ inputs.test_directory }}
|
||||
[ 'x${{ inputs.artifact }}' != 'x' ] && PYTEST_ARGS='--junitxml=TestReportSummary.xml' || unset PYTEST_ARGS
|
||||
python -m pytest -rA ${{ inputs.unittest_directory }} $PYTEST_ARGS --color=yes
|
||||
|
||||
- name: 📤 Upload 'TestReport.xml' artifact
|
||||
- name: 📤 Upload 'TestReportSummary.xml' artifact
|
||||
if: inputs.artifact != ''
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{ inputs.artifact }}-${{ matrix.system }}-${{ matrix.python }}
|
||||
path: TestReport.xml
|
||||
path: ${{ inputs.test_directory }}/TestReportSummary.xml
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
|
||||
@@ -52,7 +52,8 @@ jobs:
|
||||
python-coverage:p
|
||||
python-lxml:p
|
||||
mingw_requirements: '-r tests/requirements.mingw.txt'
|
||||
unittest_directory: 'tests/unit'
|
||||
test_directory: 'tests'
|
||||
unittest_directory: 'unit'
|
||||
artifact: ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}
|
||||
|
||||
Coverage:
|
||||
@@ -64,6 +65,8 @@ jobs:
|
||||
# Optional
|
||||
python_version: ${{ fromJson(needs.Params.outputs.params).python_version }}
|
||||
requirements: '-r tests/requirements.txt'
|
||||
test_directory: 'tests'
|
||||
unittest_directory: 'unit'
|
||||
secrets:
|
||||
codacy_token: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
||||
|
||||
@@ -164,7 +167,16 @@ jobs:
|
||||
with:
|
||||
package: ${{ fromJson(needs.Params.outputs.params).artifacts.package }}
|
||||
remaining: |
|
||||
${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-*
|
||||
${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-ubuntu-3.8
|
||||
${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-ubuntu-3.9
|
||||
${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-ubuntu-3.10
|
||||
${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-windows-3.8
|
||||
${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-windows-3.9
|
||||
${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-windows-3.10
|
||||
${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-msys2-3.9
|
||||
${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-macos-3.8
|
||||
${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-macos-3.9
|
||||
${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-macos-3.10
|
||||
${{ fromJson(needs.Params.outputs.params).artifacts.coverage }}
|
||||
${{ fromJson(needs.Params.outputs.params).artifacts.typing }}
|
||||
${{ fromJson(needs.Params.outputs.params).artifacts.doc }}
|
||||
|
||||
Reference in New Issue
Block a user