name: Unit Testing on: workflow_call: inputs: TestReport: description: "Generate unit test report with junitxml and upload results as an artifact." required: false default: false type: string jobs: UnitTesting: name: ${{ matrix.icon }} Unit Tests using Python ${{ matrix.python }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: # - {python: "3.6", icon: 🔴} # until 23.12.2021 - {python: "3.7", icon: 🟠} # until 27.06.2023 - {python: "3.8", icon: 🟡} # until Oct. 2024 - {python: "3.9", icon: 🟢} # until Oct. 2025 - {python: "3.10", icon: 🟢} # until Oct. 2026 steps: - name: ⏬ Checkout repository uses: actions/checkout@v2 - name: 🐍 Setup Python ${{ matrix.python }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python }} - name: 🔧 Install dependencies run: | python -m pip install --upgrade pip pip install -r tests/requirements.txt - name: ☑ Run unit tests run: | [ '${{ inputs.TestReport }}' = 'true' ] && 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 }} path: TestReport.xml if-no-files-found: error retention-days: 1