Remove epo's #80
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: CI | |
# yamllint disable-line rule:truthy | |
on: | |
push: | |
branches: | |
- main | |
pull_request: ~ | |
jobs: | |
code-style: | |
name: Code style | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Run prettier | |
uses: creyD/prettier_action@v4.3 | |
with: | |
prettier_options: --check . | |
- name: Run yamllint | |
uses: frenck/action-yamllint@v1 | |
list-configurations: | |
name: Prepare matrix to build all configurations | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Set matrix values | |
id: set-matrix | |
run: echo "matrix=$(grep -l "esphome:" *.yaml | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT | |
build: | |
name: Building ${{ matrix.configuration }} | |
runs-on: ubuntu-latest | |
needs: | |
- list-configurations | |
- code-style | |
strategy: | |
fail-fast: false | |
matrix: | |
configuration: ${{ fromJson(needs.list-configurations.outputs.matrix) }} | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Mock secrets | |
uses: golles/mock-yaml-secrets-action@v1 | |
with: | |
configFile: ".github/workflows/mock-secrets-config.json" | |
- name: Build ESPHome firmware | |
uses: esphome/build-action@v3 | |
id: esphome-build | |
with: | |
yaml_file: ${{ matrix.configuration }} | |
- name: Prepare firmware for upload | |
run: | | |
mkdir output | |
mv "${{ steps.esphome-build.outputs.name }}" output/ | |
- name: Upload firmware | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.esphome-build.outputs.name }} | |
path: output | |
results: | |
# see https://github.saobby.my.eu.orgmunity/t/status-check-for-a-matrix-jobs/127354/7 | |
name: Final results | |
runs-on: ubuntu-latest | |
if: ${{ always() }} | |
needs: build | |
steps: | |
- name: Check all job status | |
# see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#needs-context | |
# see https://stackoverflow.com/a/67532120/4907315 | |
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }} | |
run: exit 1 |