Skip to content

On Commit action

On Commit action #676

Workflow file for this run

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