Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .buildkite/hooks/post-command
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
# Copyright (c) 2020 Linaro Limited
#
# SPDX-License-Identifier: Apache-2.0

# report disk usage:
echo "--- $0 disk usage"
df -h
38 changes: 38 additions & 0 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
# Copyright (c) 2020 Linaro Limited
#
# SPDX-License-Identifier: Apache-2.0

# Save off where we started so we can go back there
WORKDIR=${PWD}

if [ -n "${BUILDKITE_PULL_REQUEST_BASE_BRANCH}" ]; then
git fetch -v origin ${BUILDKITE_PULL_REQUEST_BASE_BRANCH}
git checkout FETCH_HEAD
git config --local user.email "[email protected]"
git config --local user.name "Zephyr CI"
git merge --no-edit "${BUILDKITE_COMMIT}" || {
local merge_result=$?
echo "Merge failed: ${merge_result}"
git merge --abort
exit $merge_result
}
fi

mkdir -p /var/lib/buildkite-agent/zephyr-ccache/

# create cache dirs, no-op if they already exist
mkdir -p /var/lib/buildkite-agent/zephyr-module-cache/modules
mkdir -p /var/lib/buildkite-agent/zephyr-module-cache/tools
mkdir -p /var/lib/buildkite-agent/zephyr-module-cache/bootloader

# Clean cache - if it already exists
cd /var/lib/buildkite-agent/zephyr-module-cache
find -type f -not -path "*/.git/*" -not -name ".git" -delete

# Remove any stale locks
find -name index.lock -delete

# return from where we started so we can find pipeline files from
# git repo
cd ${WORKDIR}
28 changes: 28 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
steps:
- command:
- .buildkite/run.sh
env:
ZEPHYR_TOOLCHAIN_VARIANT: "zephyr"
ZEPHYR_SDK_INSTALL_DIR: "/opt/sdk/zephyr-sdk-0.11.3"
parallelism: 20
timeout_in_minutes: 120
retry:
manual: true
plugins:
- docker#v3.5.0:
image: "zephyrprojectrtos/ci:v0.11.8"
propagate-environment: true
volumes:
- "/var/lib/buildkite-agent/git-mirrors:/var/lib/buildkite-agent/git-mirrors"
- "/var/lib/buildkite-agent/zephyr-module-cache:/var/lib/buildkite-agent/zephyr-module-cache"
- "/var/lib/buildkite-agent/zephyr-ccache:/root/.ccache"
workdir: "/workdir/zephyr"
agents:
- "queue=default"

- wait: ~
continue_on_failure: true

- plugins:
- junit-annotate#v1.7.0:
artifacts: sanitycheck-*.xml
50 changes: 50 additions & 0 deletions .buildkite/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash
# Copyright (c) 2020 Linaro Limited
#
# SPDX-License-Identifier: Apache-2.0

echo "--- run $0"

git log -n 5 --oneline --decorate --abbrev=12

# Setup module cache
cd /workdir
ln -s /var/lib/buildkite-agent/zephyr-module-cache/modules
ln -s /var/lib/buildkite-agent/zephyr-module-cache/tools
ln -s /var/lib/buildkite-agent/zephyr-module-cache/bootloader
cd /workdir/zephyr

export JOB_NUM=$((${BUILDKITE_PARALLEL_JOB}+1))

# ccache stats
echo ""
echo "--- ccache stats at start"
ccache -s

if [ -n "${BUILDKITE_PULL_REQUEST_BASE_BRANCH}" ]; then
./scripts/ci/run_ci.sh -c -b ${BUILDKITE_PULL_REQUEST_BASE_BRANCH} -r origin \
-m ${JOB_NUM} -M ${BUILDKITE_PARALLEL_JOB_COUNT} -p ${BUILDKITE_PULL_REQUEST}
else
./scripts/ci/run_ci.sh -c -b ${BUILDKITE_BRANCH} -r origin \
-m ${JOB_NUM} -M ${BUILDKITE_PARALLEL_JOB_COUNT};
fi;

SANITY_EXIT_STATUS=$?

# Rename sanitycheck junit xml for use with junit-annotate-buildkite-plugin
# create dummy file if sanitycheck did nothing
if [ ! -f sanity-out/sanitycheck.xml ]; then
touch sanity-out/sanitycheck.xml
fi
mv sanity-out/sanitycheck.xml sanitycheck-${BUILDKITE_JOB_ID}.xml
buildkite-agent artifact upload sanitycheck-${BUILDKITE_JOB_ID}.xml

# ccache stats
echo "--- ccache stats at finish"
ccache -s

# disk usage
echo "--- disk usage at finish"
df -h

exit ${SANITY_EXIT_STATUS}
114 changes: 114 additions & 0 deletions .github/workflows/compliance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Compliance

on: pull_request

jobs:
compliance_job:
runs-on: ubuntu-latest
name: Run compliance checks on patch series (PR)
steps:
- name: Checkout the code
uses: actions/checkout@v1

- name: cache-pip
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-doc-pip

- name: Install python dependencies
run: |
pip3 install setuptools
pip3 install wheel
pip3 install python-magic junitparser gitlint pylint pykwalify
pip3 install west

- name: Run Compliance Tests
id: compliance
env:
BASE_REF: ${{ github.base_ref }}
run: |
export PATH=$PATH:~/.local/bin
export ZEPHYR_BASE=$PWD
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
git rebase origin/${BASE_REF}
./scripts/ci/check_compliance.py -m Codeowners -m Devicetree -m Gitlint -m Identity -m Nits -m pylint -m checkpatch -m Kconfig -c origin/${BASE_REF}.. || true

- name: upload-results
uses: actions/upload-artifact@master
continue-on-error: True
with:
name: compliance.xml
path: compliance.xml

- name: check-warns
run: |
if [ -s Nits.txt ]; then
errors=$(cat Nits.txt)
errors="${errors//'%'/'%25'}"
errors="${errors//$'\n'/'%0A'}"
errors="${errors//$'\r'/'%0D'}"
echo "::error file=Nits.txt::$errors"
exit=1
fi
if [ -s checkpatch.txt ]; then
errors=$(cat checkpatch.txt)
errors="${errors//'%'/'%25'}"
errors="${errors//$'\n'/'%0A'}"
errors="${errors//$'\r'/'%0D'}"
echo "::error file=Checkpatch.txt::$errors"
exit=1
fi
if [ -s Identity.txt ]; then
errors=$(cat Identity.txt)
errors="${errors//'%'/'%25'}"
errors="${errors//$'\n'/'%0A'}"
errors="${errors//$'\r'/'%0D'}"
echo "::error file=Identity.txt::$errors"
exit=1
fi
if [ -s Gitlint.txt ]; then
errors=$(cat Gitlint.txt)
errors="${errors//'%'/'%25'}"
errors="${errors//$'\n'/'%0A'}"
errors="${errors//$'\r'/'%0D'}"
echo "::error file=Gitlint.txt::$errors"
exit=1
fi
if [ -s pylint.txt ]; then
errors=$(cat pylint.txt)
errors="${errors//'%'/'%25'}"
errors="${errors//$'\n'/'%0A'}"
errors="${errors//$'\r'/'%0D'}"
echo "::error file=pylint.txt::$errors"
exit=1
fi
if [ -s Devicetree.txt ]; then
errors=$(cat Devicetree.txt)
errors="${errors//'%'/'%25'}"
errors="${errors//$'\n'/'%0A'}"
errors="${errors//$'\r'/'%0D'}"
echo "::error file=Devicetree.txt::$errors"
exit=1
fi
if [ -s Kconfig.txt ]; then
errors=$(cat Kconfig.txt)
errors="${errors//'%'/'%25'}"
errors="${errors//$'\n'/'%0A'}"
errors="${errors//$'\r'/'%0D'}"
echo "::error file=Kconfig.txt::$errors"
exit=1
fi
if [ -s Codeowners.txt ]; then
errors=$(cat Codeowners.txt)
errors="${errors//'%'/'%25'}"
errors="${errors//$'\n'/'%0A'}"
errors="${errors//$'\r'/'%0D'}"
echo "::error file=Codeowners.txt::$errors"
exit=1
fi

if [ ${exit} == 1 ]; then
exit 1;
fi
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
/.known-issues/ @nashif
/.github/ @nashif
/.github/workflows/ @galak @nashif
/.buildkite/ @galak
/arch/arc/ @vonhust @ruuddw
/arch/arm/ @MaureenHelm @galak @ioannisg
/arch/arm/core/aarch32/cortex_m/cmse/ @ioannisg
Expand Down
Loading