-
-
Notifications
You must be signed in to change notification settings - Fork 35
62 lines (60 loc) · 2.07 KB
/
codeql-analysis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Build ESPHome
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: '0 */6 * * *'
jobs:
matrix_maker:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.create_matrix.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create yaml file matrix
id: create_matrix
run: |
# Read the list of YAML files and create a matrix
yaml_files=$(find . -not -name "secrets.yaml" -maxdepth 1 -type f -name "*.yaml" -exec echo {} \; | tr '\n' ' ')
yaml_array="[\"$(echo "$yaml_files" | sed 's/ /", "/g')\"]"
yaml_array=$(echo $yaml_array | sed 's/.....$/]/')
DATA=$(echo $yaml_array | jq -c )
echo "matrix=$DATA" >> $GITHUB_OUTPUT
- name: Debug output
run: echo "${{ steps.create_matrix.outputs.matrix }}"
build:
needs: matrix_maker
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
name: ${{ fromJSON(needs.matrix_maker.outputs.matrix) }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: "Replace component branch reference"
run: sed -i "s|@main \#update_to_head_ref|@${{ github.head_ref }}|g" ${{ matrix.name }}
- name: Debug output
run: cat ${{ matrix.name }}
- name: CLang Format Lint
uses: DoozyX/[email protected]
with:
source: '.'
extensions: 'h,cpp'
style: file
exclude: '*/version.h'
clangFormatVersion: 15
- name: Create secrets file
run: |
echo "d2lmaV9ic3NpZDogIjFDOjg3OjJDOjcwOkMyOkMyIgp3aWZpX3NzaWQ6ICJzc2lkIgp3aWZpX3Bhc3N3b3JkOiAid2lmaXBhc3MiCndpZmlfZmFsbGJhY2tfcGFzc3dvcmQ6ICJ3aWZpZmFsbGJhY2twYXNzIgphcGlfZW5jcnlwdGlvbjogImFwaWVuY3J5cHRpb24iCm90YV9lbmNyeXB0aW9uOiAib3RhZW5jcnlwdGlvbiIK" | base64 --decode > secrets.yaml
- name: Build esphome
uses: esphome/[email protected]
with:
# version: dev
yaml_file: ${{ matrix.name }}