Closed harperreed closed 1 month ago
To address your request for adding a GitHub Action to run the test suite on PR and merge, as well as updating the README with a status badge, I'll make the following changes:
.github/workflows/test.yml
to set up the GitHub Action workflow:.github/workflows/test.yml
---
+++
@@ -1 +1,29 @@
+name: Test
+on:
+ push:
+ branches: [ main ]
+ pull_request:
+ branches: [ main ]
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ python-version: [3.9, "3.10", "3.11"]
+
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v4
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install pytest
+ pip install -r requirements.txt
+ - name: Run tests
+ run: |
+ pytest custom_components/firststreet/test_firststreet_api.py
This workflow will:
test_firststreet_api.py
fileREADME.md
---
+++
@@ -1,3 +1,5 @@
# FirstStreet Integration for Home Assistant 🌍💧🔥
+[![Test](https://github.com/harperreed/hass-firststreet/actions/workflows/test.yml/badge.svg)](https://github.com/harperreed/hass-firststreet/actions/workflows/test.yml)
+
Welcome to the **FirstStreet Integration for Home Assistant**! This project enables users to monitor risk factors associated with environmental conditions such as flooding, fires, heatwaves, winds, and air quality, all based on property location. The data is sourced directly from the FirstStreet API.
These changes will implement the GitHub Action to run the test suite on PR and merge, and add a badge to the README showing the status of the test workflow.
To verify that the GitHub Action runs successfully:
The custom_components/firststreet/test_firststreet_api.py
file is explicitly included in the test command in the GitHub Actions workflow, ensuring it will be run as part of the test suite.
Note: The workflow assumes that there's a requirements.txt
file in the root of your repository. If you don't have one, you should create it and list all the dependencies required for your project. Based on the files we've seen, it should at least include:
requests
voluptuous
homeassistant
If you need to add or modify the requirements.txt
file, let me know, and I can help you with that as well.
Continue the conversation with Sweep here: https://app.sweep.dev/c/94fc2afc-77c7-4c3d-b80b-9ef056aa38bd.
:book: For more information on how to use Sweep, please read our documentation.
Add GitHub Action for running test suite on PR and merge
Description:
Implement a GitHub Action workflow to automatically run the test suite when a pull request is opened or updated, and when code is merged into the main branch.
Tasks:
.github/workflows/test.yml
in the repository rootTest:
Additional tasks:
README.md
to include a badge showing the status of the test workflowcustom_components/firststreet/test_firststreet_api.py
file is included in the test suite run by the GitHub Action