Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actions cleanup #2574

Merged
merged 3 commits into from
Mar 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 16 additions & 25 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,42 @@ name: "CodeQL"

on:
push:
branches: [main]
branches:
- main
pull_request:
branches: [main]
branches:
- main
schedule:
- cron: '0 4 * * *'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: 📥 Checkout the repository
uses: actions/checkout@v3.0.0
with:
fetch-depth: 2

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
- name: 🔁 Initialize CodeQL
uses: github/codeql-action/init@v1.1.5
with:
languages: python

# 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
- name: 🛠️ Autobuild
uses: github/codeql-action/autobuild@v1.1.5

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
- name: 🏃 Run CodeQL Analysis
uses: github/codeql-action/analyze@v1.1.5

# ✏️ 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

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

- name: Discord notification
- name: 📨 Discord notification
if: ${{ github.event_name == 'schedule' && failure() }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_ACTION_FAILURE }}
uses: Ilshidur/action-discord@0.3.2
with:
args: "[Scheduled action failed!](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})"
args: "[Scheduled action failed!](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})"
46 changes: 24 additions & 22 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ on:
jobs:
matrix:
runs-on: ubuntu-latest
name: Run ${{ matrix.checks }}
name: Run ${{ matrix.check }}
strategy:
matrix:
checks:
check:
- pyupgrade
- black
- codespell
Expand All @@ -24,53 +24,55 @@ jobs:
- check-ast
- mixed-line-ending
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: 📥 Checkout the repository
uses: actions/checkout@v3.0.0

- name: Set up Python
uses: actions/setup-python@v3
- name: 🛠️ Set up Python
uses: actions/setup-python@v3.0.0
id: python
with:
python-version: "3.x"
cache: 'pip'

- name: Install pre-commit
- name: 📦 Install pre-commit
run: |
python3 -m pip install pre-commit
pre-commit install-hooks --config .github/pre-commit-config.yaml

- name: Run the check (${{ matrix.checks }})
run: pre-commit run --hook-stage manual ${{ matrix.checks }} --all-files --config .github/pre-commit-config.yaml
- name: 🏃 Run the check (${{ matrix.check }})
run: pre-commit run --hook-stage manual ${{ matrix.check }} --all-files --config .github/pre-commit-config.yaml

lint-custom:
runs-on: ubuntu-latest
name: With bellybutton
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: 📥 Checkout the repository
uses: actions/checkout@v3.0.0

- name: Set up Python
uses: actions/setup-python@v3
- name: 🛠️ Set up Python
uses: actions/setup-python@v3.0.0
with:
python-version: "3.x"
cache: 'pip'

- name: Install dependencies
run: make requirements
- name: 📦 Install dependencies
run: make requirements

- name: Add problem matcher
- name: Add problem matcher
run: echo "::add-matcher::.github/matchers/bellybutton.json"

- name: Validation
- name: 🏃 Run validation
run: bellybutton lint

lint-json:
runs-on: ubuntu-latest
name: With JQ
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: 📥 Checkout the repository
uses: actions/checkout@v3.0.0

- name: Install dependencies
run: make requirements
- name: 📦 Install dependencies
run: make requirements

- name: Validation
- name: 🏃 Run validation
run: jq -r -e -c . tests/fixtures/*.json
10 changes: 8 additions & 2 deletions .github/workflows/lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ on:
schedule:
- cron: "0 * * * *"

concurrency:
group: lock

jobs:
lock:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: dessant/lock-threads@v3
- name: 🔒 Lock closed issues and PRs
uses: dessant/lock-threads@v3.0.0
with:
github-token: ${{ github.token }}
issue-inactive-days: "14"
issue-lock-reason: ""
pr-inactive-days: "1"
Expand Down
29 changes: 16 additions & 13 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,55 @@ name: Publish

on:
release:
types: [published]
types:
- published
push:
branches: [main]
branches:
- main

jobs:
release_zip_file:
name: Publish HACS zip file asset
runs-on: ubuntu-latest
permissions:
contents: write # Required to upload release assets
contents: write
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: 📥 Checkout the repository
uses: actions/checkout@v3.0.0

- name: Set up Python
uses: actions/setup-python@v3
- name: 🛠️ Set up Python
uses: actions/setup-python@v3.0.0
with:
python-version: "3.x"
cache: 'pip'

- name: Get version
- name: 🔢 Get version
id: version
uses: home-assistant/actions/helpers/version@master

- name: "Set version number"
- name: 🔢 Set version number
run: |
sed -i "/MINIMUM_HA_VERSION = /c\MINIMUM_HA_VERSION = \"$(jq .homeassistant -r ${{ github.workspace }}/hacs.json)\"" ${{ github.workspace }}/custom_components/hacs/const.py
python3 ${{ github.workspace }}/manage/update_manifest.py --version ${{ steps.version.outputs.version }}

- name: Download HACS frontend
- name: Download HACS frontend
run: ${{ github.workspace }}/manage/install_frontend

- name: Upload zip to action
- name: 📤 Upload zip to action
uses: actions/upload-artifact@v2
if: ${{ github.event_name == 'push' }}
with:
name: hacs
path: ${{ github.workspace }}/custom_components/hacs

# Pack the HACS dir as a zip and upload to the release
- name: ZIP HACS Dir
- name: 📦 ZIP HACS Dir
if: ${{ github.event_name == 'release' }}
run: |
cd ${{ github.workspace }}/custom_components/hacs
zip hacs.zip -r ./

- name: Upload zip to release
- name: 📤 Upload zip to release
uses: softprops/action-gh-release@v0.1.14
if: ${{ github.event_name == 'release' }}
with:
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,23 @@ jobs:
python-version: [3.9, "3.10"]
steps:
- name: 📥 Checkout the repository
uses: actions/checkout@v3
uses: actions/checkout@v3.0.0

- name: 🛠️ Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v3.0.0
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: 📦 Install dependencies
run: make init
run: |
make init
python3 -m pip install pytest pytest-cov

- name: 🏃 Run tests
env:
PYTEST: true
run: |
python3 -m pip install pytest pytest-cov
python3 -m pytest

- name: 📤 Upload coverage to Codecov
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ jobs:
runs-on: ubuntu-latest
name: With hassfest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: 📥 Checkout the repository
uses: actions/checkout@v3.0.0

- name: Hassfest validation
- name: 🏃 Hassfest validation
uses: "home-assistant/actions/hassfest@master"

- name: Discord notification
- name: 📨 Discord notification
if: ${{ github.event_name == 'schedule' && failure() }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_ACTION_FAILURE }}
Expand All @@ -33,16 +33,16 @@ jobs:
runs-on: ubuntu-latest
name: With HACS Action
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: 📥 Checkout the repository
uses: actions/checkout@v3.0.0

- name: HACS validation
- name: 🏃 HACS validation
uses: hacs/action@main
with:
category: integration
comment: false

- name: Discord notification
- name: 📨 Discord notification
if: ${{ github.event_name == 'schedule' && failure() }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_ACTION_FAILURE }}
Expand All @@ -58,7 +58,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout the repository
uses: actions/checkout@v3
uses: actions/checkout@v3.0.0

- name: 📋 Copy sample configuration for Home Assistant
run: |
Expand All @@ -68,14 +68,14 @@ jobs:
echo "hacs:" >> ./test_configuration/configuration.yaml
echo " token: CHANGE_ME" >> ./test_configuration/configuration.yaml

- name: 👷 Setup Home Assistant
- name: 🛠️ Setup Home Assistant
id: homeassistant
uses: ludeeus/setup-homeassistant@main
with:
tag: ${{ matrix.channel }}
config-dir: test_configuration

- name: Discord notification
- name: 📨 Discord notification
if: ${{ github.event_name == 'schedule' && failure() }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_ACTION_FAILURE }}
Expand Down