diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql-advanced.yml similarity index 89% rename from .github/workflows/codeql.yml rename to .github/workflows/codeql-advanced.yml index 059de14..c1b05f9 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql-advanced.yml @@ -1,14 +1,3 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# name: "CodeQL Advanced" on: diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/lint-and-test-matrix.yml similarity index 66% rename from .github/workflows/pythonpackage.yml rename to .github/workflows/lint-and-test-matrix.yml index fcd53a2..f3f39c8 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/lint-and-test-matrix.yml @@ -1,7 +1,7 @@ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions -name: Python package +name: Lint and test multiple Python versions on: push: @@ -10,7 +10,7 @@ on: branches: [ master ] jobs: - build: + lint: runs-on: ubuntu-latest strategy: @@ -37,7 +37,28 @@ jobs: options: "--check --verbose" src: "./PyTado" use_pyproject: true - + + test: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install -e . + - name: Run Tests with Coverage run: | pip install coverage pytest pytest-cov @@ -45,9 +66,8 @@ jobs: coverage report -m coverage html - # Optionally upload coverage reports as an artifact. - name: Upload coverage report - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: coverage-html-report + name: coverage-html-report-${{ matrix.python-version }} path: coverage_html_report \ No newline at end of file diff --git a/.github/workflows/python-publish.yml b/.github/workflows/publish-to-pypi.yml similarity index 96% rename from .github/workflows/python-publish.yml rename to .github/workflows/publish-to-pypi.yml index 6a82b72..221a279 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -1,4 +1,4 @@ -name: Upload Python Package +name: Build and deploy to pypi on: release: diff --git a/.github/workflows/report-test-results.yml b/.github/workflows/report-test-results.yml new file mode 100644 index 0000000..df8d425 --- /dev/null +++ b/.github/workflows/report-test-results.yml @@ -0,0 +1,57 @@ +name: Output test results + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + report: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: 3.12 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install -e . + + - name: Run Tests with Coverage + run: | + pip install coverage pytest pytest-cov + coverage run -m pytest --maxfail=1 --disable-warnings -q + coverage report -m + coverage html + coverage xml + + - name: Code Coverage Report + uses: irongut/CodeCoverageSummary@v1.3.0 + with: + filename: coverage.xml + badge: true + fail_below_min: true + format: markdown + hide_branch_rate: false + hide_complexity: false + indicators: true + output: both + thresholds: '60 80' + + - name: Add Coverage PR Comment + uses: marocchino/sticky-pull-request-comment@v2 + if: github.event_name == 'pull_request' + with: + recreate: true + path: code-coverage-results.md + + - name: Output code coverage results to GitHub step summary + run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY