Skip to content

Commit

Permalink
Merge branch 'robbrad:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
m26dvd authored Nov 1, 2024
2 parents 7c5ce18 + 11e06fa commit a881649
Show file tree
Hide file tree
Showing 29 changed files with 2,493 additions and 337 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ USER vscode
# Define the version of Poetry to install (default is 1.4.2)
# Define the directory of python virtual environment
ARG PYTHON_VIRTUALENV_HOME=/home/vscode/ukbc-py-env \
POETRY_VERSION=1.8.3
POETRY_VERSION=1.8.4

ENV POETRY_VIRTUALENVS_IN_PROJECT=false \
POETRY_NO_INTERACTION=true
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@
"python.testing.autoTestDiscoverOnSaveEnabled": false,
"python.defaultInterpreterPath": "/home/vscode/ukbc-py-env",
"python.testing.pytestArgs": [
"--disable-socket",
"--allow-unix-socket",
"${workspaceFolder}/uk_bin_collection",
"${workspaceFolder}/custom_components/uk_bin_collection/tests",
"--headless=False",
"-o cache_dir=${workspaceFolder}/.pytest_cache"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ labels: ["bug", "home assistant custom component"]
body:
- type: markdown
attributes:
value: If you were trying to add a specific council, please check it is listed as working [here](https://robbrad.github.io/UKBinCollectionData/3.11/) and open a [Council Issue](https://github.com/robbrad/UKBinCollectionData/issues/new/choose) instead if it's failing
value: If you were trying to add a specific council, please check it is listed as working [here](https://robbrad.github.io/UKBinCollectionData/3.12/) and open a [Council Issue](https://github.com/robbrad/UKBinCollectionData/issues/new/choose) instead if it's failing
- type: input
id: ha_version
attributes:
Expand Down Expand Up @@ -46,7 +46,7 @@ body:
options:
- label: I searched for similar issues at https://github.com/robbrad/UKBinCollectionData/issues?q=is:issue and found no duplicates
required: true
- label: If trying to add a specific council, I've checked it is listed as working at https://robbrad.github.io/UKBinCollectionData/3.11/
- label: If trying to add a specific council, I've checked it is listed as working at https://robbrad.github.io/UKBinCollectionData/3.12/
required: true
- label: I have provided a detailed explanation of the issue as well as steps to replicate the issue
required: true
Expand Down
255 changes: 178 additions & 77 deletions .github/workflows/behave.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,71 +3,51 @@ name: Test Councils
on:
workflow_dispatch:
push:
# Trigger unless only the wiki directory changed
paths-ignore:
- "wiki/**"
- "**/**.md"
- "**/*.md"
- "uk_bin_collection_api_server/**"
branches: [ "master" ]
pull_request:
# Trigger unless only the wiki directory changed
paths-ignore:
- "wiki/**"
- "**/**.md"
- "**/*.md"
- "uk_bin_collection_api_server/**"
branches: [ "master" ]
schedule:
- cron: '0 0 * * *'
- cron: '0 0 * * *' # Nightly schedule for full test run

jobs:
build:
if: "!startsWith(github.event.head_commit.message, 'bump:')"
setup:
name: Setup Environment
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11, 3.12]
poetry-version: [1.8.3]
services:
selenium:
image: selenium/standalone-chrome:latest
options: --shm-size=2gb --name selenium --hostname selenium
ports:
- 4444:4444
steps:
- uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry==${{ matrix.poetry-version }}
- name: Install Poetry
run: pipx install poetry==1.8.4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
#cache: 'poetry'
python-version: 3.12

- name: Install
- name: Install Dependencies
run: make install

- name: Lint JSON
run: jq empty uk_bin_collection/tests/input.json

- name: Check Parity of Councils / input.json / Feature file
run: |
repo=${{ github.event.pull_request.head.repo.full_name || 'robbrad/UKBinCollectionData' }}
branch=${{ github.event.pull_request.head.ref || 'master' }}
make parity-check repo=$repo branch=$branch
- name: Get all councils files that have changed
- name: Get All Council Files That Have Changed
id: changed-council-files
uses: tj-actions/changed-files@v45
with:
files: |
uk_bin_collection/uk_bin_collection/councils/**.py
- name: Get all councils
env:
ALL_CHANGED_FILES: ${{ steps.changed-council-files.outputs.all_changed_files }}
- name: Set Council Tests Environment Variable
id: set-council-tests
run: |
IFS=' ' read -ra FILES <<< "$ALL_CHANGED_FILES"
IFS=' ' read -ra FILES <<< "${{ steps.changed-council-files.outputs.all_changed_files }}"
COUNCIL_TESTS=""
for file in "${FILES[@]}"; do
FILENAME=$(basename "$file" .py)
Expand All @@ -77,89 +57,210 @@ jobs:
COUNCIL_TESTS="$COUNCIL_TESTS or $FILENAME"
fi
done
echo "COUNCIL_TESTS=${COUNCIL_TESTS}" >> $GITHUB_ENV
echo "council_tests=$COUNCIL_TESTS" >> $GITHUB_OUTPUT
- name: Run integration tests
env:
HEADLESS: True
run: make matrix=${{ matrix.python-version }} councils="${{ env.COUNCIL_TESTS }}" integration-tests
continue-on-error: true
outputs:
council_tests: ${{ steps.set-council-tests.outputs.council_tests }}

- name: Run unit tests
run: make unit-tests
continue-on-error: true
unit-tests:
name: Run Unit Tests
needs: setup
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.12]
poetry-version: [1.8.4]
steps:
- uses: actions/checkout@v4

#- name: Upload test coverage to Codecov
# uses: codecov/codecov-action@v4
# with:
# gcov_ignore: uk_bin_collection/tests/**
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Upload test results to Codecov
- name: Install Poetry
run: pipx install poetry==${{ matrix.poetry-version }}

- name: Install Dependencies
run: make install

- name: Run Unit Tests
run: make unit-tests

- name: Upload Test Results to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.xml

parity-check:
name: Parity Check
needs: setup
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.12]
poetry-version: [1.8.4]
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
run: pipx install poetry==${{ matrix.poetry-version }}

- name: Install Dependencies
run: make install

- name: Check Parity of Councils / input.json / Feature file
run: |
repo=${{ github.event.pull_request.head.repo.full_name || 'robbrad/UKBinCollectionData' }}
branch=${{ github.event.pull_request.head.ref || 'master' }}
make parity-check repo=$repo branch=$branch
integration-tests:
name: Run Integration Tests
needs: setup
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.12]
poetry-version: [1.8.4]
services:
selenium:
image: selenium/standalone-chrome:latest
options: --shm-size=2gb --name selenium --hostname selenium
ports:
- 4444:4444
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
run: pipx install poetry==${{ matrix.poetry-version }}

- name: Get Allure history
- name: Install Dependencies
run: make install

- name: Run Integration Tests
env:
HEADLESS: True
COUNCIL_TESTS: ${{ needs.setup.outputs.council_tests }}
run: make matrix=${{ matrix.python-version }} councils="${{ env.COUNCIL_TESTS }}" integration-tests
continue-on-error: true

report:
name: Generate and Upload Reports
needs: [unit-tests, parity-check, integration-tests]
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.12]
steps:
- uses: actions/checkout@v4

# Fetch Allure History
- name: Get Allure history - Full Report
if: github.event_name == 'schedule' || github.event_name == 'push'
uses: actions/checkout@v4
if: github.ref == 'refs/heads/master'
continue-on-error: true
with:
ref: gh-pages
path: gh-pages
path: gh-pages/allure-full-history

- name: Get Allure history - Partial Report
if: github.event_name != 'schedule' && github.event_name != 'push'
uses: actions/checkout@v4
continue-on-error: true
with:
ref: gh-pages
path: gh-pages/allure-partial-history

# Generate Allure Reports
- name: Allure report action for Full Run
uses: simple-elf/allure-report-action@master
if: github.event_name == 'schedule' || github.event_name == 'push'
with:
allure_results: build/${{ matrix.python-version }}/allure-results
subfolder: ${{ matrix.python-version }}
allure_history: gh-pages/allure-full-history
keep_reports: 20

- name: Allure report action from marketplace
- name: Allure report action for Partial Run
uses: simple-elf/allure-report-action@master
if: github.ref == 'refs/heads/master'
if: github.event_name != 'schedule' && github.event_name != 'push'
with:
allure_results: build/${{ matrix.python-version }}/allure-results
subfolder: ${{ matrix.python-version }}
allure_history: allure-history
allure_history: gh-pages/allure-partial-history
keep_reports: 20

- name: Tar report
if: github.ref == 'refs/heads/master'
run: tar -cvf allure_history_${{ matrix.python-version }}.tar allure-history/${{ matrix.python-version }}
# Archive Reports
- name: Tar full report
if: github.event_name == 'schedule' || github.event_name == 'push'
run: tar -cvf allure_full_history_${{ matrix.python-version }}.tar gh-pages/allure-full-history/${{ matrix.python-version }}

- name: Tar partial report
if: github.event_name != 'schedule' && github.event_name != 'push'
run: tar -cvf allure_partial_history_${{ matrix.python-version }}.tar gh-pages/allure-partial-history/${{ matrix.python-version }}

- name: Upload artifact
# Upload Report Artifacts
- name: Upload artifact for Full Report
uses: actions/upload-artifact@v4
if: github.ref == 'refs/heads/master'
if: github.event_name == 'schedule' || github.event_name == 'push'
with:
name: allure_history_${{ matrix.python-version }}
path: allure_history_${{ matrix.python-version }}.tar
name: allure_full_history_${{ matrix.python-version }}
path: allure_full_history_${{ matrix.python-version }}.tar

- name: Upload artifact for Partial Report
uses: actions/upload-artifact@v4
if: github.event_name != 'schedule' && github.event_name != 'push'
with:
name: allure_partial_history_${{ matrix.python-version }}
path: allure_partial_history_${{ matrix.python-version }}.tar

deploy:
name: Deploy Reports
runs-on: ubuntu-latest
needs: build
needs: report
if: github.ref == 'refs/heads/master'
steps:

- uses: actions/download-artifact@v4
name: Download 3.11 artifacts
name: Download Full Artifacts
with:
name: allure_history_3.11
path: allure-history/tars
name: allure_full_history_3.12
path: allure-history/tars/full

- uses: actions/download-artifact@v4
name: Download 3.12 artifacts
name: Download Partial Artifacts
with:
name: allure_history_3.12
path: allure-history/tars
name: allure_partial_history_3.12
path: allure-history/tars/partial

- name: Untar reports
run: for i in allure-history/tars/*.tar; do tar -xvf "$i" allure-history ;done
- name: Untar Full Reports
run: for i in allure-history/tars/full/*.tar; do tar -xvf "$i" -C allure-history/full ;done

- name: Remove tar reports
- name: Untar Partial Reports
run: for i in allure-history/tars/partial/*.tar; do tar -xvf "$i" -C allure-history/partial ;done

- name: Remove Tar Reports
run: rm -rf allure-history/tars

- name: Display structure of downloaded files
run: ls -R
- name: Deploy Full Report
uses: peaceiris/actions-gh-pages@v4
with:
personal_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: allure-history/full

- name: Deploy
- name: Deploy Partial Report
uses: peaceiris/actions-gh-pages@v4
with:
PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: allure-history
personal_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: allure-history/partial
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Run image
uses: abatilo/actions-poetry@v3.0.1
with:
poetry-version: '1.8.3'
poetry-version: '1.8.4'

- name: Install dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wiki.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Run image
uses: abatilo/actions-poetry@v3.0.1
with:
poetry-version: '1.8.3'
poetry-version: '1.8.4'

- name: Install
run: make install
Expand Down
Loading

0 comments on commit a881649

Please sign in to comment.