gh: use shallow clones whenever possible (#2491)
* gh: use shallow clones whenever possible * gh: reverted submodule checks * gh: lint: joined linting scripts * gh: renamed linter workflow * check python linter output * gh: reworked linter * checking c linter * gh: merged submodule check & lint * gh: renamed step * gh: removed redundant `submodules: false` Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
parent
c27d4d78f9
commit
d8385b7f91
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@ -27,7 +27,7 @@ jobs:
|
|||||||
- name: 'Checkout code'
|
- name: 'Checkout code'
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
- name: 'Get commit details'
|
- name: 'Get commit details'
|
||||||
@ -177,8 +177,8 @@ jobs:
|
|||||||
- name: 'Checkout code'
|
- name: 'Checkout code'
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
submodules: true
|
submodules: false
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
- name: 'Get commit details'
|
- name: 'Get commit details'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
name: 'Check submodules branch'
|
name: 'Lint sources & check submodule integrity'
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -9,8 +9,13 @@ on:
|
|||||||
- '*'
|
- '*'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
|
env:
|
||||||
|
TARGETS: f7
|
||||||
|
FBT_TOOLCHAIN_PATH: /runner/_work
|
||||||
|
SET_GH_OUTPUT: 1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check_protobuf:
|
lint_sources_check_submodules:
|
||||||
runs-on: [self-hosted,FlipperZeroShell]
|
runs-on: [self-hosted,FlipperZeroShell]
|
||||||
steps:
|
steps:
|
||||||
- name: 'Decontaminate previous build leftovers'
|
- name: 'Decontaminate previous build leftovers'
|
||||||
@ -22,9 +27,10 @@ jobs:
|
|||||||
- name: 'Checkout code'
|
- name: 'Checkout code'
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
|
|
||||||
- name: 'Check protobuf branch'
|
- name: 'Check protobuf branch'
|
||||||
run: |
|
run: |
|
||||||
git submodule update --init
|
git submodule update --init
|
||||||
@ -36,12 +42,28 @@ jobs:
|
|||||||
BRANCHES=$(git branch -r --contains "$SUBMODULE_HASH");
|
BRANCHES=$(git branch -r --contains "$SUBMODULE_HASH");
|
||||||
COMMITS_IN_BRANCH="$(git rev-list --count dev)";
|
COMMITS_IN_BRANCH="$(git rev-list --count dev)";
|
||||||
if [ $COMMITS_IN_BRANCH -lt $SUB_COMMITS_MIN ]; then
|
if [ $COMMITS_IN_BRANCH -lt $SUB_COMMITS_MIN ]; then
|
||||||
echo "name=fails::error" >> $GITHUB_OUTPUT
|
echo "name=fails::error" >> $GITHUB_OUTPUT;
|
||||||
echo "::error::Error: Too low commits in $SUB_BRANCH of submodule $SUB_PATH: $COMMITS_IN_BRANCH(expected $SUB_COMMITS_MIN+)";
|
echo "::error::Error: Too low commits in $SUB_BRANCH of submodule $SUB_PATH: $COMMITS_IN_BRANCH(expected $SUB_COMMITS_MIN+)";
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
if ! grep -q "/$SUB_BRANCH" <<< "$BRANCHES"; then
|
if ! grep -q "/$SUB_BRANCH" <<< "$BRANCHES"; then
|
||||||
echo "name=fails::error" >> $GITHUB_OUTPUT
|
echo "name=fails::error" >> $GITHUB_OUTPUT;
|
||||||
echo "::error::Error: Submodule $SUB_PATH is not on branch $SUB_BRANCH";
|
echo "::error::Error: Submodule $SUB_PATH is not on branch $SUB_BRANCH";
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- name: 'Check Python code formatting'
|
||||||
|
id: syntax_check_py
|
||||||
|
run: ./fbt lint_py 2>&1 >/dev/null || echo "errors=1" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: 'Check C++ code formatting'
|
||||||
|
if: always()
|
||||||
|
id: syntax_check_cpp
|
||||||
|
run: ./fbt lint 2>&1 >/dev/null || echo "errors=1" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Report code formatting errors
|
||||||
|
if: ( steps.syntax_check_py.outputs.errors || steps.syntax_check_cpp.outputs.errors ) && github.event.pull_request
|
||||||
|
run: |
|
||||||
|
echo "Code formatting errors found";
|
||||||
|
echo "Please run './fbt format' or './fbt format_py' to fix them";
|
||||||
|
exit 1;
|
47
.github/workflows/lint_c.yml
vendored
47
.github/workflows/lint_c.yml
vendored
@ -1,47 +0,0 @@
|
|||||||
name: 'Lint C/C++ with clang-format'
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- dev
|
|
||||||
- "release*"
|
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
env:
|
|
||||||
TARGETS: f7
|
|
||||||
FBT_TOOLCHAIN_PATH: /runner/_work
|
|
||||||
SET_GH_OUTPUT: 1
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
lint_c_cpp:
|
|
||||||
runs-on: [self-hosted,FlipperZeroShell]
|
|
||||||
steps:
|
|
||||||
- name: 'Decontaminate previous build leftovers'
|
|
||||||
run: |
|
|
||||||
if [ -d .git ]; then
|
|
||||||
git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: 'Checkout code'
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
|
||||||
|
|
||||||
- name: 'Check code formatting'
|
|
||||||
id: syntax_check
|
|
||||||
run: ./fbt lint
|
|
||||||
|
|
||||||
- name: Report code formatting errors
|
|
||||||
if: failure() && steps.syntax_check.outputs.errors && github.event.pull_request
|
|
||||||
uses: peter-evans/create-or-update-comment@v1
|
|
||||||
with:
|
|
||||||
issue-number: ${{ github.event.pull_request.number }}
|
|
||||||
body: |
|
|
||||||
Please fix following code formatting errors:
|
|
||||||
```
|
|
||||||
${{ steps.syntax_check.outputs.errors }}
|
|
||||||
```
|
|
||||||
You might want to run `./fbt format` for an auto-fix.
|
|
33
.github/workflows/lint_python.yml
vendored
33
.github/workflows/lint_python.yml
vendored
@ -1,33 +0,0 @@
|
|||||||
name: 'Python Lint'
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- dev
|
|
||||||
- "release*"
|
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
env:
|
|
||||||
FBT_TOOLCHAIN_PATH: /runner/_work
|
|
||||||
SET_GH_OUTPUT: 1
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
lint_python:
|
|
||||||
runs-on: [self-hosted,FlipperZeroShell]
|
|
||||||
steps:
|
|
||||||
- name: 'Decontaminate previous build leftovers'
|
|
||||||
run: |
|
|
||||||
if [ -d .git ]; then
|
|
||||||
git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: 'Checkout code'
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
|
||||||
|
|
||||||
- name: 'Check code formatting'
|
|
||||||
run: ./fbt lint_py
|
|
2
.github/workflows/merge_report.yml
vendored
2
.github/workflows/merge_report.yml
vendored
@ -21,7 +21,7 @@ jobs:
|
|||||||
- name: 'Checkout code'
|
- name: 'Checkout code'
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
- name: 'Get commit details'
|
- name: 'Get commit details'
|
||||||
|
2
.github/workflows/pvs_studio.yml
vendored
2
.github/workflows/pvs_studio.yml
vendored
@ -28,7 +28,7 @@ jobs:
|
|||||||
- name: 'Checkout code'
|
- name: 'Checkout code'
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
- name: 'Get commit details'
|
- name: 'Get commit details'
|
||||||
|
2
.github/workflows/unit_tests.yml
vendored
2
.github/workflows/unit_tests.yml
vendored
@ -21,7 +21,7 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
- name: 'Get flipper from device manager (mock)'
|
- name: 'Get flipper from device manager (mock)'
|
||||||
|
5
.github/workflows/updater_test.yml
vendored
5
.github/workflows/updater_test.yml
vendored
@ -21,7 +21,8 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
|
submodules: false
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
- name: 'Get flipper from device manager (mock)'
|
- name: 'Get flipper from device manager (mock)'
|
||||||
@ -62,7 +63,7 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
if: failure()
|
if: failure()
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
ref: ${{ steps.release_tag.outputs.tag }}
|
ref: ${{ steps.release_tag.outputs.tag }}
|
||||||
|
|
||||||
- name: 'Flash last release'
|
- name: 'Flash last release'
|
||||||
|
4
fbt
4
fbt
@ -25,10 +25,10 @@ fi
|
|||||||
|
|
||||||
if [ -z "$FBT_NO_SYNC" ]; then
|
if [ -z "$FBT_NO_SYNC" ]; then
|
||||||
if [ ! -d "$SCRIPT_PATH/.git" ]; then
|
if [ ! -d "$SCRIPT_PATH/.git" ]; then
|
||||||
echo "\".git\" directory not found, please clone repo via \"git clone --recursive\"";
|
echo "\".git\" directory not found, please clone repo via \"git clone\"";
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
git submodule update --init;
|
git submodule update --init --depth 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$SCONS_EP $SCONS_DEFAULT_FLAGS "$@"
|
$SCONS_EP $SCONS_DEFAULT_FLAGS "$@"
|
||||||
|
4
fbt.cmd
4
fbt.cmd
@ -5,9 +5,9 @@ set SCONS_EP=python -m SCons
|
|||||||
|
|
||||||
if [%FBT_NO_SYNC%] == [] (
|
if [%FBT_NO_SYNC%] == [] (
|
||||||
if exist ".git" (
|
if exist ".git" (
|
||||||
git submodule update --init
|
git submodule update --init --depth 1
|
||||||
) else (
|
) else (
|
||||||
echo Not in a git repo, please clone with git clone --recursive
|
echo Not in a git repo, please clone with "git clone"
|
||||||
exit /b 1
|
exit /b 1
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user