Skip to content

Commit

Permalink
Merge pull request #371 from moralmunky/0.3.0
Browse files Browse the repository at this point in the history
0.3.0 - Release
  • Loading branch information
firstof9 authored Feb 22, 2021
2 parents 7b7ce95 + 4c56601 commit f4a008a
Show file tree
Hide file tree
Showing 51 changed files with 28,198 additions and 1,583 deletions.
3 changes: 3 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[report]
show_missing = True
fail_under = 95
24 changes: 24 additions & 0 deletions .github/.codecov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
codecov:
require_ci_to_pass: yes

coverage:
precision: 2
round: down
range: "70...100"

parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no

comment:
layout: "reach,diff,flags,tree"
behavior: default
require_changes: no

ignore:
- "tests/" # no need to test the tests
- "test.py" # doesn't need testing
16 changes: 9 additions & 7 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## Breaking change

<!--
If your PR contains a breaking change for existing users, it is important
to tell them what breaks, how to make it work again and why we did this.
Expand All @@ -7,35 +8,36 @@
Note: Remove this section if this PR is NOT a breaking change.
-->


## Proposed change
<!--

<!--
Describe the big picture of your changes here to communicate to the
maintainers why we should accept this pull request. If it fixes a bug
or resolves a feature request, be sure to link to that issue in the
additional information section.
-->


## Type of change

<!--
What type of change does your PR introduce?
NOTE: Please, check only 1! box!
If your PR requires multiple boxes to be checked, you'll most likely need to
split it into multiple PRs. This makes things easier and faster to code review.
-->

- [ ] Dependency upgrade
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (which adds functionality)
- [ ] Breaking change (fix/feature causing existing functionality to break)
- [ ] Code quality improvements to existing code or addition of tests
- [ ] Documentation update
- [ ] Adds a new shipper
- [ ] Update existing shipper

## Additional information

<!--
Details are important, and help maintainers processing your PR.
Please be sure to fill out additional details, if applicable.
-->

- This PR fixes or closes issue: fixes #
- This PR is related to issue:
- This PR is related to issue:
71 changes: 36 additions & 35 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
# The branches below must be a subset of the branches above
branches: [master, 0.2.0, 0.3.0]
schedule:
- cron: '0 7 * * 6'
- cron: "0 3 * * 6"

jobs:
analyze:
Expand All @@ -24,48 +24,49 @@ jobs:
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['python']
language: ["python"]

# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
124 changes: 102 additions & 22 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,112 @@
name: Validate with hassfest
name: "Validation and Formatting"

on:
push:
pull_request: ~
pull_request:
schedule:
- cron: "0 0 * * *"

jobs:
formatting:
name: Formatting Check
runs-on: "ubuntu-latest"
validate_hacs:
name: "HACS Validation"
runs-on: ubuntu-latest
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v1"
- name: HACS Action
uses: "hacs/action@main"
with:
python-version: "3.x"
- run: python3 -m pip install black
- run: black .

validate:
name: Validate component
category: "integration"
validate_hassfest:
name: "Hassfest Validation"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"

- name: HACS validation
uses: "hacs/integration/action@master"
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CATEGORY: "integration"

- name: Hassfest validation
uses: "home-assistant/actions/hassfest@master"
- uses: "actions/checkout@v2"
- uses: home-assistant/actions/hassfest@master
validate_flake8:
name: "flake8"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-3
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install --upgrade -r requirements.txt wemake-python-styleguide
- name: Check for fatal errors
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Docstrings
run: |
flake8 . --inline-quotes '"' --count --exit-zero --max-complexity=15 --max-line-length=90 --statistics --select=D,DAR
- name: Small tweaks that might help, but might conflict or be inconvenient
run: |
flake8 . --inline-quotes '"' --count --exit-zero --max-complexity=15 --max-line-length=90 --statistics --select=WPS323,WPS336,WPS305,WPS420,WPS440,WPS441,WPS515,E800\:,WPS421,W503,WPS412
- name: Trailing commas and isort
run: |
flake8 . --inline-quotes '"' --count --exit-zero --max-complexity=15 --max-line-length=90 --statistics --select=I,C81
- name: Overcomplex code
run: |
flake8 . --inline-quotes '"' --count --exit-zero --max-complexity=15 --max-line-length=90 --statistics --select=WPS201,WPS210,WPS214,WPS221,WPS229,WPS226
- name: Useless stuff
run: |
flake8 . --inline-quotes '"' --count --exit-zero --max-complexity=15 --max-line-length=90 --statistics --select=F401,F841,WPS327,WPS503,WPS504,WPS507
- name: Bandit
run: |
flake8 . --inline-quotes '"' --count --exit-zero --max-complexity=15 --max-line-length=90 --statistics --select=S
- name: Clarity and quality improvements
run: |
flake8 . --inline-quotes '"' --count --exit-zero --max-complexity=15 --max-line-length=90 --statistics --select=WPS432,WPS110,WPS111,WPS322,E501
- name: General stats
run: |
flake8 . --inline-quotes '"' --count --exit-zero --max-complexity=15 --max-line-length=90 --statistics \
--ignore=D,DAR,WPS323,WPS336,WPS305,WPS420,WPS440,WPS441,WPS515,E800\:,WPS421,W503,WPS412,I,C81,WPS201,WPS210,WPS214,WPS221,WPS229,WPS226,F401,F841,WPS327,WPS503,WPS504,WPS507,S,WPS432,WPS110,WPS111,WPS322,E501
format:
name: "Format with black and isort"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-2
restore-keys: |
${{ runner.os }}-pip-2
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install --upgrade -r requirements.txt -r requirements_format.txt
- name: Pull again
run: git pull || true
- name: Run formatting
run: |
python -m isort -v --profile black .
python -m black -v .
- name: Commit files
run: |
if [ $(git diff HEAD | wc -l) -gt 30 ]
then
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "GitHub Actions"
git commit -a --amend --no-edit || true
git push --force || true
fi
35 changes: 35 additions & 0 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Pytest

on:
push:
branches: [0.3.0]
pull_request:
branches: [0.3.0]
schedule:
- cron: "0 7 1-28/7 * *"

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements_test.txt
- name: Generate coverage report
run: |
python -m pytest
pip install pytest-cov
pytest ./tests/ --cov=custom_components/mail_and_packages/ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
16 changes: 16 additions & 0 deletions .github/workflows/release-drafter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Release Drafter

on:
push:
branches:
- master
- 0.2.0
- 0.3.0

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release

on:
release:
types: [published]

jobs:
release_zip_file:
name: Prepare release asset
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v1

- name: Get Version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}

- name: "Set version numbmer"
run: |
sed -i '/VERSION = /c\VERSION = "${{ steps.get_version.outputs.VERSION }}"' ${{ github.workspace }}/custom_components/mail_and_packages/const.py
sed -i '/version/c\ \"version\": \"${{ steps.get_version.outputs.VERSION }}\"' ${{ github.workspace }}/custom_components/mail_and_packages/manifest.json
# Pack the mail_and_packages dir as a zip and upload to the release
- name: ZIP MnP Dir
run: |
cd ${{ github.workspace }}/custom_components/mail_and_packages
zip mail_and_packages.zip -r ./
- name: Upload zip to release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ github.workspace }}/custom_components/mail_and_packages/mail_and_packages.zip
asset_name: mail_and_packages.zip
tag: ${{ github.ref }}
overwrite: true
Loading

0 comments on commit f4a008a

Please sign in to comment.