Skip to content

nimble/host: Rework locking in L2CAP #1886

nimble/host: Rework locking in L2CAP

nimble/host: Rework locking in L2CAP #1886

#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
name: Compliance check
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
jobs:
style_check:
name: Coding style
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Dependencies
shell: bash
run: |
python -m pip install clang-format
- name: Check label
id: label_check
uses: actions/github-script@v7
with:
script: |
const labelName = 'skip-style-check';
const labels = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
});
const hasLabel = labels.data.some(label => label.name === labelName);
core.setOutput('skip', hasLabel);
- name: check style
if: steps.label_check.outputs.skip != 'true'
shell: bash
run: |
set +e
INFO_URL="https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md"
GIT_BASE=$(git merge-base origin/master HEAD)
git diff -U0 "$GIT_BASE"...HEAD > diff.patch
clang-format-diff.py -p1 -style=file < diff.patch > clang-fmt.patch
if [ -s clang-fmt.patch ]; then
echo "Code formatting issues found:"
cat clang-fmt.patch
echo ""
echo "For formatting guidelines, see:"
echo " $INFO_URL"
exit 1
else
echo "All good, no formatting issues."
fi
- name: Skip style-check if label present
if: steps.label_check.outputs.skip == 'true'
run: echo "Skipping style check because 'skip-style-check' label is present."
style_license:
name: Licensing
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Dependencies
shell: bash
run: |
mkdir repos
git clone --depth=1 https://github.com/apache/mynewt-core repos/apache-mynewt-core
wget https://archive.apache.org/dist/creadur/apache-rat-0.17/apache-rat-0.17-bin.tar.gz
tar zxf apache-rat-0.17-bin.tar.gz apache-rat-0.17/apache-rat-0.17.jar
mv apache-rat-0.17/apache-rat-0.17.jar apache-rat.jar
- name: Check licensing
shell: bash
run: |
./repos/apache-mynewt-core/.github/check_license.py
style_doxygen:
name: Doxygen Style
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y doxygen graphviz
- name: Check Doxygen
shell: bash
run: |
.github/check_doxygen.py
commits-check:
name: Check commit messages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Validate commit message style
shell: bash
run: |
set -e
has_errors=0
COMMIT_URL="https://cwiki.apache.org/confluence/display/MYNEWT/Contributing+to+Apache+Mynewt"
# Determine commit range for PR or fallback to origin/master
if [ -n "${GITHUB_BASE_REF}" ]; then
base_ref="origin/${GITHUB_BASE_REF}"
else
base_ref="origin/master"
fi
base_commit=$(git merge-base HEAD ${base_ref})
echo "Checking commits from ${base_commit} to HEAD"
for commit in $(git rev-list --no-merges ${base_commit}..HEAD); do
short_sha=$(git rev-parse --short=7 $commit)
subject=$(git log -1 --pretty=format:%s $commit)
body=$(git log -1 --pretty=format:%b $commit)
if [ ${#subject} -gt 72 ]; then
echo "Commit $short_sha subject too long (${#subject} > 72):"
echo "$subject"
has_errors=1
fi
if [[ "$subject" != *:* ]]; then
echo "Commit $short_sha subject missing colon (e.g. 'subsystem: msg')"
echo "$subject"
has_errors=1
fi
if [ -z "$body" ]; then
echo "Commit $short_sha body is missing"
has_errors=1
else
line_num=0
while IFS= read -r line; do
line_num=$((line_num + 1))
if [ ${#line} -gt 72 ]; then
echo "Commit $short_sha body line $line_num too long (${#line} > 72):"
echo "$line"
has_errors=1
fi
done <<< "$body"
fi
echo ""
done
if [ "$has_errors" -eq 1 ]; then
echo "::error::Commit message check failed."
echo "For contributing guidelines, see:"
echo " $COMMIT_URL"
exit 1
else
echo "All commit messages pass style rules."
fi