Sync betaflight to Gitea

This commit is contained in:
2026-08-03 16:37:10 +08:00
commit ad3163cf91
4712 changed files with 3301380 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
name: Auto close bad PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
on:
pull_request_target:
permissions:
pull-requests: write
issues: write
jobs:
close-pr:
runs-on: ubuntu-latest
steps:
- name: Code Checkout
uses: actions/checkout@v5
- name: autoclose
shell: bash
if: github.head_ref == 'master'
run: gh pr close ${{github.event.pull_request.number}} --comment "Auto-closing pull request because the source branch is named 'master'. Please create a feature branch instead. https://betaflight.com/docs/development#using-git-and-github"
+38
View File
@@ -0,0 +1,38 @@
name: Release
on:
release:
types: [published]
jobs:
ci:
name: CI
uses: ./.github/workflows/ci.yml
with:
release_build: true
release:
name: Release
needs: ci
runs-on: ubuntu-latest
steps:
- name: Fetch build artifacts
uses: actions/download-artifact@v5
- name: List downloaded artifacts
run: ls -al
- name: Attach assets to release
run: |
set -x
ASSETS=()
for asset in ./*/*.hex ./*/*.uf2; do
if [ -f "$asset" ]; then
ASSETS+=("$asset")
echo "$asset"
fi
done
TAG_NAME="${GITHUB_REF##*/}"
gh release upload "${TAG_NAME}" "${ASSETS[@]}" -R "${GITHUB_REPOSITORY}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+157
View File
@@ -0,0 +1,157 @@
# Per-SDK CI Pipeline
#
# Reusable workflow that caches an SDK toolchain and builds all
# targets belonging to that SDK.
name: SDK Pipeline
on:
workflow_call:
inputs:
sdk:
description: 'SDK name (arm, pico_sdk, stm32h5, stm32n6, esp_idf, none)'
required: true
type: string
targets:
description: 'JSON array of build targets for this SDK'
required: true
type: string
tools-cache-key:
description: 'Base cache key for toolchain'
required: true
type: string
release_build:
description: 'Whether to build without commit hash in filenames'
default: false
required: false
type: boolean
jobs:
cache:
name: Cache (${{ inputs.sdk == 'none' && 'Generic' || inputs.sdk }})
runs-on: ubuntu-latest
steps:
- name: Checkout code
if: inputs.sdk != 'none'
uses: actions/checkout@v5
- name: Cache tools
if: inputs.sdk != 'none'
uses: actions/cache@v5
id: cache-tools
with:
path: tools
key: ${{ inputs.tools-cache-key }}-${{ inputs.sdk }}
- name: Restore ARM tools as base
if: inputs.sdk != 'none' && inputs.sdk != 'arm' && steps.cache-tools.outputs.cache-hit != 'true'
uses: actions/cache/restore@v5
with:
path: tools
key: ${{ inputs.tools-cache-key }}-arm
- name: Get SDK cache info
if: inputs.sdk != 'arm' && inputs.sdk != 'none'
id: sdk-info
run: |
SUBMODULE=$(make SDK=${{ inputs.sdk }} platform-sdk-cache-paths-print 2>/dev/null | head -1)
if [ "$SUBMODULE" != "tools" ]; then
echo "has-submodule=true" >> $GITHUB_OUTPUT
echo "paths<<EOF" >> $GITHUB_OUTPUT
make SDK=${{ inputs.sdk }} platform-sdk-cache-paths-print >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "key=${{ runner.os }}-sdk-${{ inputs.sdk }}-$(make SDK=${{ inputs.sdk }} platform-sdk-cache-key-print)" >> $GITHUB_OUTPUT
fi
- name: Cache platform SDK
if: steps.sdk-info.outputs.has-submodule == 'true'
uses: actions/cache@v5
id: cache-sdk
with:
path: ${{ steps.sdk-info.outputs.paths }}
key: ${{ steps.sdk-info.outputs.key }}
- name: Hydrate SDK
if: steps.sdk-info.outputs.has-submodule == 'true' && steps.cache-sdk.outputs.cache-hit != 'true'
run: make SDK=${{ inputs.sdk }} platform-sdk-hydrate
- name: Install tools
if: inputs.sdk != 'none' && steps.cache-tools.outputs.cache-hit != 'true'
run: make SDK=${{ inputs.sdk }} platform-tools-install
build:
name: Build (${{ matrix.target }})
needs: cache
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: ${{ fromJson(inputs.targets) }}
steps:
- name: Checkout code
if: matrix.target != 'None'
uses: actions/checkout@v5
- name: Init config submodule
if: matrix.target != 'None'
run: git submodule update --init -- src/config
- name: Get SDK cache info
if: matrix.target != 'None' && inputs.sdk != 'arm' && inputs.sdk != 'none'
id: sdk-info
run: |
SUBMODULE=$(make SDK=${{ inputs.sdk }} platform-sdk-cache-paths-print 2>/dev/null | head -1)
if [ "$SUBMODULE" != "tools" ]; then
echo "has-submodule=true" >> $GITHUB_OUTPUT
echo "paths<<EOF" >> $GITHUB_OUTPUT
make SDK=${{ inputs.sdk }} platform-sdk-cache-paths-print >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "key=${{ runner.os }}-sdk-${{ inputs.sdk }}-$(make SDK=${{ inputs.sdk }} platform-sdk-cache-key-print)" >> $GITHUB_OUTPUT
fi
- name: Restore platform SDK from cache
if: matrix.target != 'None' && steps.sdk-info.outputs.has-submodule == 'true'
uses: actions/cache/restore@v5
id: cache-sdk
with:
path: ${{ steps.sdk-info.outputs.paths }}
key: ${{ steps.sdk-info.outputs.key }}
- name: Hydrate platform SDK (fallback)
if: matrix.target != 'None' && steps.sdk-info.outputs.has-submodule == 'true' && steps.cache-sdk.outputs.cache-hit != 'true'
run: make SDK=${{ inputs.sdk }} platform-sdk-hydrate
- name: Restore toolchain from cache
if: matrix.target != 'None' && inputs.sdk != 'none'
uses: actions/cache/restore@v5
id: cache-tools
with:
path: tools
key: ${{ inputs.tools-cache-key }}-${{ inputs.sdk }}
- name: Install tools (fallback)
if: matrix.target != 'None' && inputs.sdk != 'none' && steps.cache-tools.outputs.cache-hit != 'true'
run: make SDK=${{ inputs.sdk }} platform-tools-install
- name: Hydrate configuration
if: matrix.target != 'None'
run: make configs
- name: Build target (without revision)
if: matrix.target != 'None' && inputs.release_build == true
run: make EXTRA_FLAGS=-Werror ${{ matrix.target }}
- name: Build target (with revision)
if: matrix.target != 'None' && inputs.release_build == false
run: make EXTRA_FLAGS=-Werror ${{ matrix.target }}_rev
- name: Publish build artifacts
if: matrix.target != 'None'
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.target }}
path: |
obj/*.hex
obj/*.uf2
obj/*_${{ matrix.target }}*
retention-days: 60
+102
View File
@@ -0,0 +1,102 @@
# Builds Betaflight Firmware.
#
name: CI
on:
workflow_call:
inputs:
release_build:
description: 'Specifies if it is a build that should include commit hash in hex file names or not'
default: false
required: false
type: boolean
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
outputs:
sdk-config: ${{ steps.sdk-config.outputs.matrix }}
tools-cache-key: ${{ steps.tools-key.outputs.key }}
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Init config submodule
run: git submodule update --init -- src/config
- name: Compute tools cache key
id: tools-key
run: echo "key=${{ runner.os }}-tools-v2-${{ hashFiles('mk/tools.mk', 'src/platform/*/mk/*.mk') }}" >> $GITHUB_OUTPUT
- name: Hydrate configuration
run: make configs
- name: Build SDK pipeline config
id: sdk-config
run: |
# Get grouped targets (sdk:target1 target2 ...)
grouped=$(make targets-ci-grouped-print)
declare -A sdk_targets
while IFS=: read -r sdk targets; do
sdk_targets[$sdk]=$(echo "$targets" | jq -R -c 'split(" ")')
done <<< "$grouped"
# Get all registered SDKs + none
all_sdks="$(make platform-sdk-list-print) none"
# Build matrix include array
json="["
first=true
for sdk in $all_sdks; do
targets=${sdk_targets[$sdk]:-'["None"]'}
$first || json="$json,"
json="$json{\"sdk\":\"$sdk\",\"targets\":$(echo "$targets" | jq -R -c .)}"
first=false
done
json="$json]"
echo "matrix=$json" >> "$GITHUB_OUTPUT"
sdk-pipeline:
name: ${{ matrix.sdk }}
needs: setup
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.setup.outputs.sdk-config) }}
uses: ./.github/workflows/ci-sdk.yml
with:
sdk: ${{ matrix.sdk }}
targets: ${{ matrix.targets }}
tools-cache-key: ${{ needs.setup.outputs.tools-cache-key }}
release_build: ${{ inputs.release_build }}
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install dependencies
run: sudo apt-get install -y libblocksruntime-dev clang-18
- name: Run sanity checks
run: make EXTRA_FLAGS=-Werror checks
- name: Run all unit tests
run: make EXTRA_FLAGS=-Werror test-all
result:
name: Complete
needs: [sdk-pipeline, test]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Check SDK pipeline result
if: ${{ needs.sdk-pipeline.result != 'success' }}
run: exit 1
- name: Check test result
if: ${{ needs.test.result != 'success' }}
run: exit 1
+17
View File
@@ -0,0 +1,17 @@
name: No Response
on:
issue_comment:
types: [created]
schedule:
- cron: 0 4 * * *
jobs:
no-response:
runs-on: ubuntu-latest
steps:
- uses: lee-dohm/no-response@9bb0a4b5e6a45046f00353d5de7d90fb8bd773bb # v0.5.0
with:
daysUntilClose: 1
responseRequiredLabel: Missing Information
token: ${{ github.token }}
+24
View File
@@ -0,0 +1,24 @@
name: PR cloud build comment
on:
pull_request_target:
types: [opened]
branches:
- master
- '*-maintenance'
permissions:
pull-requests: write
jobs:
comment-pr:
runs-on: ubuntu-latest
steps:
- name: Add comment about cloud build
uses: thollander/actions-comment-pull-request@v2
with:
message: |
**Do you want to test this code? You can flash it directly from the Betaflight App:**
- Simply put `#${{ github.event.number }}` (this pull request number) in the `Select commit` field in the Firmware Flasher tab (you need to `Enable expert mode`, `Show release candidates` and `Development`).
_**WARNING:** It may be unstable. Use only for testing!_
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+12
View File
@@ -0,0 +1,12 @@
name: PR
on:
pull_request:
branches:
- master
- '*-maintenance'
jobs:
ci:
name: CI
uses: ./.github/workflows/ci.yml
+12
View File
@@ -0,0 +1,12 @@
name: Push
on:
push:
branches:
- master
- '*-maintenance'
jobs:
ci:
name: CI
uses: ./.github/workflows/ci.yml
+31
View File
@@ -0,0 +1,31 @@
name: Stale Issues and PRs
on:
schedule:
- cron: 30 4 * * *
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v8
with:
exempt-all-milestones: true
days-before-stale: 30
days-before-close: 7
stale-issue-message: >
This issue has been automatically marked as stale because it
has not had recent activity. It will be closed if no further activity occurs
within a week.
close-issue-message: Issue closed automatically as inactive.
stale-issue-label: Inactive
exempt-issue-labels: BUG,Feature Request,Pinned
stale-pr-message: >
This pull request has been automatically marked as stale because it
has not had recent activity. It will be closed if no further activity occurs
within a week.
close-pr-message: Pull request closed automatically as inactive.
stale-pr-label: Inactive
exempt-pr-labels: Pinned