-
Notifications
You must be signed in to change notification settings - Fork 27
106 lines (92 loc) · 3.07 KB
/
on-commit.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: On Commit action
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
push:
branches: ["main"]
jobs:
get_base_commit:
runs-on: ubuntu-24.04
outputs:
commit_number: ${{ steps.get_commits.outputs.commit_number }}
steps:
- name: get number of commits pushed
id: get_commits
env:
EVENT_COMMITS: ${{toJson(github.event.commits)}}
run: |
echo "$EVENT_COMMITS" > commits.json
tr -d '\n' < commits.json > commits_oneline.json
LL=$( jq '. | length' commits_oneline.json)
echo 'Number of commits pushed: $LL'
echo "commit_number=$LL" > $GITHUB_OUTPUT
verify_changes:
if: ${{github.event.schedule}} != ""
needs: get_base_commit
uses: ./.github/workflows/validate_code_style.yml
with:
reference_commit: "HEAD~${{needs.get_base_commit.outputs.commit_number}}"
discover_target_boards:
runs-on: ubuntu-24.04
outputs:
targets: ${{ steps.platforms.outputs.targets }}
steps:
- name: install yq
run: pip install yq
- name: Checkout
uses: actions/checkout@v4
with:
path: sidewalk
- name: get_platforms
id: platforms
run: |
result=$(yq '.common.platform_allow' sidewalk/samples/sid_end_device/sample.yaml -c)
echo "targets=$result" >> $GITHUB_OUTPUT;
echo "$result"
build_samples:
needs: [discover_target_boards]
uses: ./.github/workflows/samples_build.yml
with:
boards_to_test: ${{needs.discover_target_boards.outputs.targets}}
build_and_run_tests:
needs: [discover_target_boards]
uses: ./.github/workflows/run_tests.yml
with:
boards_to_test: ${{needs.discover_target_boards.outputs.targets}}
Post_fail_to_Teams:
needs: [verify_changes, build_samples, build_and_run_tests]
if: ${{ failure() }}
runs-on: ubuntu-24.04
steps:
- uses: neonidian/teams-notify-build-status@v4
with:
webhookUrl: ${{ secrets.MSTEAMS_WEBHOOK }}
status: failure
message: On Commit tests failed!
env:
SHOULD_DISPLAY_ACTOR_LABEL: false
SHOULD_DISPLAY_VIEW_RUN_BUTTON: true
SHOULD_DISPLAY_VIEW_COMMIT_BUTTON: true
compare_configuration:
needs: [build_samples, build_and_run_tests, verify_changes]
uses: ./.github/workflows/compare_config.yml
with:
current_run_id: ${{ github.run_id }}
post_configuration_diff:
needs: [compare_configuration]
runs-on: ubuntu-24.04
if: ${{ fromJson(needs.compare_configuration.outputs.diff_detected)}}
steps:
- uses: actions/download-artifact@v4
with:
name: configuration_diff
- uses: neonidian/teams-notify-build-status@v4
name: Notify Teams
with:
webhookUrl: ${{ secrets.MSTEAMS_WEBHOOK }}
message: Detected change in .config ${{needs.compare_configuration.outputs.artifact_url}}
env:
SHOULD_DISPLAY_ACTOR_LABEL: false
SHOULD_DISPLAY_VIEW_RUN_BUTTON: true
SHOULD_DISPLAY_VIEW_COMMIT_BUTTON: false