2022-08-02 14:05:31 +00:00
|
|
|
name: 'Check submodules branch'
|
2022-01-12 14:06:39 +00:00
|
|
|
|
|
|
|
on:
|
2022-08-02 14:05:31 +00:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- dev
|
|
|
|
- "release*"
|
|
|
|
tags:
|
|
|
|
- '*'
|
2022-01-12 14:06:39 +00:00
|
|
|
pull_request:
|
|
|
|
|
|
|
|
jobs:
|
2022-08-02 14:05:31 +00:00
|
|
|
check_protobuf:
|
|
|
|
runs-on: [self-hosted, FlipperZeroShell]
|
2022-01-12 14:06:39 +00:00
|
|
|
steps:
|
2022-08-02 14:05:31 +00:00
|
|
|
- name: 'Decontaminate previous build leftovers'
|
|
|
|
run: |
|
2022-09-03 07:09:03 +00:00
|
|
|
if [ -d .git ]; then
|
|
|
|
git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)"
|
2022-08-02 14:05:31 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
- name: 'Checkout code'
|
2022-12-10 13:10:51 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-08-02 14:05:31 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-08-23 11:29:26 +00:00
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
2022-08-02 14:05:31 +00:00
|
|
|
|
|
|
|
- name: 'Check protobuf branch'
|
|
|
|
run: |
|
2022-10-12 15:31:25 +00:00
|
|
|
git submodule update --init
|
2022-08-02 14:05:31 +00:00
|
|
|
SUB_PATH="assets/protobuf";
|
|
|
|
SUB_BRANCH="dev";
|
|
|
|
SUB_COMMITS_MIN=40;
|
|
|
|
cd "$SUB_PATH";
|
|
|
|
SUBMODULE_HASH="$(git rev-parse HEAD)";
|
|
|
|
BRANCHES=$(git branch -r --contains "$SUBMODULE_HASH");
|
|
|
|
COMMITS_IN_BRANCH="$(git rev-list --count dev)";
|
|
|
|
if [ $COMMITS_IN_BRANCH -lt $SUB_COMMITS_MIN ]; then
|
2022-12-10 13:10:51 +00:00
|
|
|
echo "name=fails::error" >> $GITHUB_OUTPUT
|
2022-08-02 14:05:31 +00:00
|
|
|
echo "::error::Error: Too low commits in $SUB_BRANCH of submodule $SUB_PATH: $COMMITS_IN_BRANCH(expected $SUB_COMMITS_MIN+)";
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
if ! grep -q "/$SUB_BRANCH" <<< "$BRANCHES"; then
|
2022-12-10 13:10:51 +00:00
|
|
|
echo "name=fails::error" >> $GITHUB_OUTPUT
|
2022-08-02 14:05:31 +00:00
|
|
|
echo "::error::Error: Submodule $SUB_PATH is not on branch $SUB_BRANCH";
|
|
|
|
exit 1;
|
|
|
|
fi
|