3.12 #255
Workflow file for this run
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: Code-checker | |
on: | |
pull_request: | |
jobs: | |
black: | |
runs-on: "ubuntu-latest" | |
strategy: | |
matrix: | |
python-version: | |
- "3.11" | |
env: | |
SRC_FOLDER: custom_components/tibber_data | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Install depencency | |
run: | | |
pip install isort black | |
- name: isort | |
run: isort $SRC_FOLDER | |
- name: Check for modified files | |
id: git-check-isort | |
run: git diff --quiet || echo "::set-output name=modified::true" | |
- name: Push changes isort | |
if: steps.git-check-isort.outputs.modified == 'true' && github.event.pull_request.head.repo.full_name == github.repository | |
run: | | |
git config --global user.name 'Daniel Hoyer' | |
git config --global user.email 'mail@dahoiv.net' | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY | |
git fetch --depth=1; | |
git checkout $GITHUB_HEAD_REF | |
git commit -am "fixup! Format Python code with isort" | |
git push | |
- name: black | |
run: black $SRC_FOLDER | |
- name: Check for modified files | |
id: git-check-black | |
run: git diff --quiet || echo "::set-output name=modified::true" | |
- name: Push changes black | |
if: steps.git-check-black.outputs.modified == 'true' && github.event.pull_request.head.repo.full_name == github.repository | |
run: | | |
git config --global user.name 'Daniel Hoyer' | |
git config --global user.email 'mail@dahoiv.net' | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY | |
git fetch --depth=1; | |
git checkout $GITHUB_HEAD_REF | |
git commit -am "fixup! Format Python code with black" | |
git push | |
- name: get sha | |
id: sha | |
run: | | |
sha_new=$(git rev-parse HEAD) | |
echo $sha_new | |
echo "::set-output name=SHA::$sha_new" | |
- run: | |
echo ${{ steps.sha.outputs.SHA }} | |
validate: | |
needs: black | |
runs-on: "ubuntu-latest" | |
strategy: | |
matrix: | |
python-version: | |
- "3.11" | |
- "3.12" | |
env: | |
SRC_FOLDER: custom_components/tibber_data | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ needs.black.outputs.new_sha }} | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Install depencency | |
run: | | |
pip install dlint flakeheaven flake8-deprecated flake8-executable pylint mypy homeassistant pyTibber | |
- name: Flake8 Code Linter | |
run: flakeheaven lint $SRC_FOLDER | |
# - name: Mypy Code Linter | |
# run: mypy $SRC_FOLDER | |
- name: Pylint Code Linter | |
run: pylint $SRC_FOLDER | |