Releasing 0.8.0 #59
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Push actions | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- custom_components/** | |
- tests/** | |
- pylintrc | |
- requirements*.txt | |
- setup.cfg | |
- .github/workflows/push.yml | |
workflow_dispatch: | |
jobs: | |
cache-requirements-install: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Cache pip dependencies | |
uses: actions/cache@v3 | |
id: cache-dependencies | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements*.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
if: steps.cache-dependencies.outputs.cache-hit != 'true' | |
run: | | |
pip install -r requirements_test.txt | |
validate: | |
runs-on: "ubuntu-latest" | |
name: Validate | |
steps: | |
- uses: actions/checkout@v3 | |
- name: HACS validation | |
uses: "hacs/action@main" | |
with: | |
category: "integration" | |
ignore: brands | |
- name: Hassfest validation | |
uses: "home-assistant/actions/hassfest@master" | |
style: | |
runs-on: "ubuntu-latest" | |
name: Check style formatting | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- run: python3 -m pip install black | |
- run: black . | |
tests: | |
needs: cache-requirements-install | |
runs-on: ubuntu-latest | |
name: Run tests | |
steps: | |
- name: Check out code from GitHub | |
uses: actions/checkout@v3 | |
- name: Setup Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Restore pip cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements*.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install requirements | |
run: python3 -m pip install -r requirements_test.txt | |
- name: Run tests | |
run: | | |
pytest \ | |
-qq \ | |
--timeout=9 \ | |
--durations=10 \ | |
-n auto \ | |
--cov custom_components.bouncie \ | |
-o console_output_style=count \ | |
-p no:sugar \ | |
--cov-report html \ | |
--cov-report xml \ | |
--alluredir=./allure-results \ | |
--cov-fail-under=100 \ | |
tests && rm htmlcov/.gitignore | |
- name: Upload coverage artifacts | |
uses: actions/upload-artifact@v3 | |
if: ${{ success() }} | |
with: | |
name: coverage-output | |
path: htmlcov | |
retention-days: 1 | |
- name: Checkout gh-pages | |
uses: actions/checkout@v3 | |
if: always() | |
continue-on-error: true | |
with: | |
ref: gh-pages | |
path: gh-pages | |
- name: Generate Allure Report | |
uses: simple-elf/allure-report-action@master | |
if: always() | |
with: | |
allure_results: allure-results | |
subfolder: test-results | |
allure_report: allure-report | |
allure_history: allure-history | |
keep_reports: 100 | |
- name: Generate badges | |
run: | | |
python generate_badges.py | |
- name: Upload tests artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-output | |
path: allure-history/test-results/ | |
retention-days: 1 | |
- name: Upload coverage artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-output | |
path: htmlcov | |
retention-days: 1 | |
- name: Upload badges artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: badges-output | |
path: badges | |
retention-days: 1 | |
publish-test-report: | |
needs: tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download test artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: test-output | |
path: allure-history | |
- name: Checkout gh-pages | |
uses: actions/checkout@v3 | |
if: always() | |
continue-on-error: true | |
with: | |
ref: gh-pages | |
path: gh-pages | |
- name: Publish test report to gh-pages | |
if: always() | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
deploy_key: ${{ secrets.DEPLOY_PRIVATE_KEY }} | |
publish_branch: gh-pages | |
publish_dir: allure-history | |
destination_dir: test-results | |
publish-coverage-report: | |
needs: publish-test-report | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download coverage artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: coverage-output | |
path: coverage | |
- name: Checkout gh-pages | |
uses: actions/checkout@v3 | |
if: always() | |
continue-on-error: true | |
with: | |
ref: gh-pages | |
path: gh-pages | |
- name: Publish test coverage to gh-pages | |
if: always() | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
deploy_key: ${{ secrets.DEPLOY_PRIVATE_KEY }} | |
publish_branch: gh-pages | |
publish_dir: coverage | |
destination_dir: test-coverage | |
publish-badges: | |
needs: publish-coverage-report | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download badges artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: badges-output | |
path: badges | |
- name: Checkout gh-pages | |
uses: actions/checkout@v3 | |
if: always() | |
continue-on-error: true | |
with: | |
ref: gh-pages | |
path: gh-pages | |
- name: Publish badges to gh-pages | |
if: always() | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
deploy_key: ${{ secrets.DEPLOY_PRIVATE_KEY }} | |
publish_branch: gh-pages | |
publish_dir: badges | |
destination_dir: badges |