ESPHome #1381
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: ESPHome | |
# yamllint disable-line rule:truthy | |
on: | |
pull_request: | |
paths: | |
- 'esphome/**' | |
- '.github/workflows/esphome**' | |
push: | |
branches: [main] | |
paths: | |
- 'esphome/**' | |
- '.github/workflows/esphome**' | |
schedule: | |
- cron: 0 12 * * * | |
jobs: | |
files: # Job that lists files | |
name: Discover ESPHome files | |
runs-on: ubuntu-latest | |
outputs: | |
file: ${{ steps.set-files.outputs.file }} # generate output name file by using inner step output | |
steps: | |
- name: Getting your configuration from GitHub | |
uses: actions/checkout@v4 | |
- name: Get list of files | |
id: set-files # Give it an id to handle to get step outputs in the outputs key above | |
run: echo "::set-output name=file::$(ls esphome/*.yaml | jq -R -s -c 'split("\n")[:-1]')" | |
# Define step output named file base on ls command transformed to JSON thanks to jq | |
loop-stable: | |
name: Test ESPHome Stable firmware | |
runs-on: ubuntu-latest | |
needs: [files] # Depends on previous job | |
strategy: | |
matrix: | |
file: ${{fromJson(needs.files.outputs.file)}} # List matrix strategy from files dynamically | |
steps: | |
- name: Getting your configuration from GitHub | |
uses: actions/checkout@v4 | |
- name: ESPHome Version | |
uses: "docker://esphome/esphome:stable" | |
with: | |
args: "version" | |
- name: Copy stub files into configuration folder | |
if: ${{ steps.esphome-test-required.outputs.ESPHOME_CHANGES != 'false' }} | |
run: | | |
cp -R esphome/travis_secrets.yaml.txt esphome/common/secrets.yaml | |
cp -R esphome/travis_secrets.yaml.txt esphome/secrets.yaml | |
- name: Compile all ESPHome ${{matrix.file}} | |
uses: esphome/build-action@v4 | |
with: | |
version: stable | |
yaml-file: ${{matrix.file}} | |
loop-beta: | |
name: Test ESPHome Beta firmware | |
runs-on: ubuntu-latest | |
needs: [files] # Depends on previous job | |
strategy: | |
matrix: | |
file: ${{fromJson(needs.files.outputs.file)}} # List matrix strategy from files dynamically | |
steps: | |
- name: Getting your configuration from GitHub | |
uses: actions/checkout@v4 | |
- name: ESPHome Version | |
uses: "docker://esphome/esphome:beta" | |
with: | |
args: "version" | |
- name: Copy stub files into configuration folder | |
if: ${{ steps.esphome-test-required.outputs.ESPHOME_CHANGES != 'false' }} | |
run: | | |
cp -R esphome/travis_secrets.yaml.txt esphome/common/secrets.yaml | |
cp -R esphome/travis_secrets.yaml.txt esphome/secrets.yaml | |
- name: Compile all ESPHome ${{matrix.file}} | |
uses: esphome/build-action@v4 | |
with: | |
version: beta | |
yaml-file: ${{matrix.file}} | |
# This is used by branch protections | |
final: | |
name: Final ESPHome check | |
runs-on: ubuntu-latest | |
needs: [loop-stable, loop-beta] | |
steps: | |
- name: Getting your configuration from GitHub | |
uses: actions/checkout@v4 |