Bump home-assistant/builder from 2023.06.0 to 2023.08.0 #47
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: Lint Addons | |
on: | |
push: | |
tags: | |
- v* | |
branches: | |
- main | |
pull_request: | |
env: | |
PYTHON_VERSION: ^3.9.0 | |
permissions: | |
contents: read | |
jobs: | |
find: | |
name: Find add-ons | |
runs-on: ubuntu-latest | |
outputs: | |
addons: ${{ steps.addons.outputs.addons_list }} | |
steps: | |
- name: ⤵️ Check out code from GitHub | |
uses: actions/checkout@v3.5.0 | |
- name: 🔍 Find add-on directories | |
id: addons | |
uses: home-assistant/actions/helpers/find-addons@master | |
lint: | |
name: Lint add-on ${{ matrix.path }} | |
runs-on: ubuntu-latest | |
needs: find | |
strategy: | |
matrix: | |
path: ${{ fromJson(needs.find.outputs.addons) }} | |
steps: | |
- name: ⤵️ Check out code from GitHub | |
uses: actions/checkout@v3.5.0 | |
- name: 🚀 Run Home Assistant Add-on Lint | |
uses: frenck/action-addon-linter@v2.13 | |
with: | |
path: "./${{ matrix.path }}" | |
pre-commit: | |
name: Pre-commit | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v3.5.0 | |
- name: Set up Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v4.6.0 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.work | |
- name: Upgrade pip | |
run: | | |
pip install --constraint=.github/workflows/constraints.txt pip | |
pip --version | |
- name: Install Python modules | |
run: | | |
pip install --constraint=.github/workflows/constraints.txt pre-commit | |
- name: Run pre-commit on all files | |
run: | | |
pre-commit run --all-files --show-diff-on-failure --color=always | |
golangci: | |
name: golangci-lint add-on ${{ matrix.path }} | |
runs-on: ubuntu-latest | |
needs: find | |
# Use a matrix strategy because golangci doesn't seem to support go.work | |
# correctly. https://github.com/golangci/golangci-lint/issues/2654 | |
strategy: | |
matrix: | |
path: ${{ fromJson(needs.find.outputs.addons) }} | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v3.5.0 | |
- name: Check if the add-on is go-based | |
id: check_is_go | |
run: | | |
if [[ -f "./${{ matrix.path }}/go.mod" ]]; then | |
echo "is_go=true" >> "${GITHUB_OUTPUT}" | |
else | |
echo "is_go=false" >> "${GITHUB_OUTPUT}" | |
fi | |
- name: Set up Go | |
if: steps.check_is_go.outputs.is_go == 'true' | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.work | |
- name: golangci-lint | |
if: steps.check_is_go.outputs.is_go == 'true' | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version | |
version: latest | |
# Optional: working directory, useful for monorepos | |
working-directory: ${{ matrix.path }} | |
# Optional: golangci-lint command line arguments. | |
# args: --issues-exit-code=0 | |
# Optional: show only new issues if it's a pull request. The default value is `false`. | |
# Can't set this yet, because working-directory is not compatible with only-new-issues | |
# only-new-issues: true | |
# Optional: if set to true then the all caching functionality will be complete disabled, | |
# takes precedence over all other caching options. | |
# skip-cache: true | |
# Optional: if set to true then the action don't cache or restore ~/go/pkg. | |
# skip-pkg-cache: true | |
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build. | |
# skip-build-cache: true |