fby4: sd: Support PLDM host power control #1881
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Analyze | |
on: | |
pull_request: # Kick off this on every PR | |
workflow_call: # We may want to run this workflow from other places, like nightly builds | |
inputs: | |
nightly: | |
required: false | |
type: boolean | |
default: false | |
secrets: | |
GIST_SECRET: | |
required: true | |
jobs: | |
Build-Platforms: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# This job matrix will generate a separate job for all platforms listed. | |
# Add platforms in alphabetical order. | |
platform: [ | |
at-cb, | |
at-mc, | |
gt-cc, | |
wc-mb, | |
yv3-dl, | |
yv3-vf, | |
yv35-bb, | |
yv35-cl, | |
yv35-gl, | |
yv35-hd, | |
yv35-rf, | |
yv4-sd, | |
yv4-ff, | |
] | |
# Need to set this to false otherwise it will cancel all platform builds if one fails. | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
path: ${{ github.event.repository.name }} | |
- name: Install Dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install --no-install-recommends \ | |
ninja-build \ | |
gperf \ | |
ccache \ | |
dfu-util \ | |
device-tree-compiler \ | |
gcc-multilib \ | |
g++-multilib \ | |
libsdl2-dev \ | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
# Exactly what it says on the tin. | |
- name: Install requirements | |
run: | | |
pip install --user -U west | |
pip install pyelftools | |
- name: Init West Project | |
run: | | |
west init --local ${{ github.event.repository.name }} | |
# Sets up python and loads packages from the cache. | |
- name: Try Cache | |
id: python | |
uses: actions/cache@v2 | |
with: | |
path: | | |
./modules | |
./zephyr | |
key: west-yml-${{ hashFiles('OpenBIC/west.yml') }} | |
- name: Cache SDK Toolchain | |
id: cache-sdk | |
uses: actions/cache@v2 | |
with: | |
path: /home/runner/zephyr-sdk-0.12.4 | |
key: zephyr-sdk-0.12.4 | |
- name: Get SDK Toolchain | |
if: steps.cache-sdk.outputs.cache-hit != 'true' | |
id: download-sdk | |
run: | | |
wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.12.4/zephyr-sdk-0.12.4-x86_64-linux-setup.run | |
chmod +x zephyr-sdk-0.12.4-x86_64-linux-setup.run | |
./zephyr-sdk-0.12.4-x86_64-linux-setup.run --quiet -- -d /home/runner/zephyr-sdk-0.12.4 | |
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr | |
export ZEPHYR_SDK_INSTALL_DIR=/home/runner/zephyr-sdk-0.12.4 | |
- name: Update West Project | |
run: | | |
cd OpenBIC | |
west update | |
- name: Apply Kernel Patches | |
run: | | |
${{ github.event.repository.name }}/scripts/build/apply_patches.py --source="${{ github.event.repository.name }}/fix_patch/" --destination="zephyr" | |
- name: Build Platform | |
id: build | |
continue-on-error: true | |
run: | | |
cd ${{ github.event.repository.name }} | |
touch meta-facebook/${{ matrix.platform }}/CMakeLists.txt | |
west build -p auto -b ast1030_evb meta-facebook/${{ matrix.platform }}/ | |
- name: Get Build Status | |
env: | |
OUTCOME: ${{ steps.build.outcome }} | |
run: | | |
ret="$OUTCOME" | |
echo "$ret" | |
if [ "$ret" = "success" ]; then | |
echo "badge_message=PASS" >> $GITHUB_ENV | |
echo "badge_color=green" >> $GITHUB_ENV | |
echo "build_return_code=0" >> $GITHUB_ENV | |
else | |
echo "badge_message=FAIL" >> $GITHUB_ENV | |
echo "badge_color=red" >> $GITHUB_ENV | |
echo "build_return_code=1" >> $GITHUB_ENV | |
fi | |
- name: Update Build Badges | |
if: ${{ inputs.nightly == true }} | |
uses: schneegans/[email protected] | |
with: | |
auth: ${{ secrets.GIST_SECRET }} | |
gistID: 62fb115c4fa43a02acad226534e10932 | |
filename: ${{ matrix.platform }}.json | |
label: Build | |
message: ${{ env.badge_message }} | |
color: ${{ env.badge_color }} | |
- name: Check Build Failure | |
if: ${{ env.build_return_code != '0' }} | |
run : | | |
exit 1 | |
run-cppcheck: | |
runs-on: ubuntu-latest | |
if: ${{ inputs.nightly == false }} | |
steps: | |
- name: Get PR File List | |
shell: bash | |
run: | | |
URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${{ github.event.pull_request.number }}/files" | |
curl -s -X GET -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" $URL | jq -r '.[] | .filename' > git_diff.log | |
cat git_diff.log | |
- name: Check for C/CPP Sources | |
shell: bash | |
run : | | |
CPP_FILE_LIST="/tmp/cppcheck_file_list.log" | |
# Only keep the source files to check or CPPCheck gets confused. | |
sed '/\(\.c$\|\.cpp$\|\.c$\|\.cc$\|\.cu$\|\.cxx$\|\.h$\|\.hh$\|\.hpp$\|\.hxx$\|\.tcc$\)/!d' git_diff.log > $CPP_FILE_LIST | |
if [ -s $CPP_FILE_LIST ]; then | |
echo "C/C++ source files kept:" | |
cat $CPP_FILE_LIST | |
fi | |
if [ -s $CPP_FILE_LIST ]; then | |
echo "contains_c_source=true" >> $GITHUB_ENV | |
else | |
echo "contains_c_source=false" >> $GITHUB_ENV | |
fi | |
- uses: actions/checkout@v2 | |
name: Checkout Repo | |
if: env.contains_c_source == 'true' | |
- uses: actions/setup-python@v2 | |
name: Setup Python | |
if: env.contains_c_source == 'true' | |
- name: Install CPPCheck | |
if: env.contains_c_source == 'true' | |
run: sudo apt-get install -y cppcheck | |
- name: Run CPPCheck on Modified Source Files | |
if: env.contains_c_source == 'true' | |
continue-on-error: true | |
shell: bash | |
run: | | |
# These files specify the config for cppcheck and a list of errors to suppress | |
CPPCHECK_CONFIG=scripts/linters/cppcheck/cppcheck.cfg | |
CPPCHECK_SUPPRESSED=scripts/linters/cppcheck/cppcheck-suppressions.txt | |
echo "Files to check:" | |
cat /tmp/cppcheck_file_list.log | |
options=( "-j2" | |
"--force" | |
"--inconclusive" | |
"--enable=performance,style,portability,information" | |
"--library=scripts/linters/cppcheck/cppcheck.cfg" | |
"--suppressions-list=scripts/linters/cppcheck/cppcheck-suppressions.txt" | |
"--file-list=/tmp/cppcheck_file_list.log" | |
"--template={file}:{line}:{column}:{message}" | |
"--output-file=/tmp/cppcheck.log" | |
"--report-progress") | |
cppcheck "${options[@]}" | |
if [ -s /tmp/cppcheck.log ]; then | |
echo "Errors Found:" | |
cat /tmp/cppcheck.log | |
fi | |
- uses: actions/upload-artifact@master | |
name: Upload CPPCheck error log | |
if: env.contains_c_source == 'true' | |
with: | |
name: cppcheck-output | |
path: /tmp/cppcheck.log | |
- name: Check for cppcheck output | |
if: env.contains_c_source == 'true' | |
run : | | |
if [ -s /tmp/cppcheck.log ]; then | |
exit 1 | |
fi | |
run-clang-format: | |
runs-on: ubuntu-latest | |
if: ${{ inputs.nightly == false }} | |
steps: | |
- uses: actions/checkout@v2 | |
name: Checkout Repo | |
- name: Get PR File List | |
shell: bash | |
run: | | |
URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${{ github.event.pull_request.number }}/files" | |
curl -s -X GET -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" $URL | jq -r '.[] | .filename' > /tmp/change_set.log | |
cat /tmp/change_set.log | |
- name: Check for C/CPP Sources | |
shell: bash | |
run : | | |
CLANG_FORMAT_FILE_LIST="/tmp/clang_format_file_list.log" | |
# Only keep the source files to check or clang-format starts checking everything. | |
sed '/\(\.c$\|\.cpp$\|\.c$\|\.cc$\|\.cu$\|\.cxx$\|\.h$\|\.hh$\|\.hpp$\|\.hxx$\|\.tcc$\)/!d' /tmp/change_set.log > $CLANG_FORMAT_FILE_LIST | |
if [ -s $CLANG_FORMAT_FILE_LIST ]; then | |
echo "C/C++ source files kept for clang-format:" | |
cat $CLANG_FORMAT_FILE_LIST | |
fi | |
if [ -s $CLANG_FORMAT_FILE_LIST ]; then | |
echo "contains_c_source=true" >> $GITHUB_ENV | |
echo "contains_clang_errors=false" >> $GITHUB_ENV | |
else | |
echo "contains_c_source=false" >> $GITHUB_ENV | |
fi | |
- name: Install Clang-Format | |
if: env.contains_c_source == 'true' | |
run: sudo apt-get install -y clang-format | |
- name: Run clang-format on changed fileset. | |
if: env.contains_c_source == 'true' | |
continue-on-error: true | |
shell: bash | |
run: | | |
echo "Files to check:" | |
cat /tmp/clang_format_file_list.log | |
FILE_PATHS=$(cat /tmp/clang_format_file_list.log) | |
for FILE_PATH in $FILE_PATHS | |
do | |
options=( | |
"--style=file" | |
"--dry-run" | |
"--Werror") | |
# Clang format outputs to stderr... why do you do this clang-format | |
if ! clang-format "${options[@]}" $FILE_PATH &> /dev/null ; then | |
echo -e "\u001b[31;1m$FILE_PATH has clang-format errors!\u001b[0m" | |
echo $FILE_PATH >> /tmp/clang-format.log | |
echo "contains_clang_errors=true" >> $GITHUB_ENV | |
fi | |
done | |
- name: Check for clang-format output | |
if: env.contains_c_source == 'true' && env.contains_clang_errors == 'true' | |
run : | | |
if [ -s /tmp/clang-format.log ]; then | |
exit 1 | |
fi | |
Aggregate-Lint-Output: | |
needs: [run-cppcheck, run-clang-format] | |
if: ${{ always() && inputs.nightly == false }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
name: Checkout Repo | |
- uses: reviewdog/action-setup@v1 | |
with: | |
reviewdog_version: latest | |
- name: Download all artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
path: /tmp/artifacts | |
- name: Run reviewdog | |
env: | |
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
CPP_FILE=/tmp/artifacts/cppcheck-output/cppcheck.log | |
if test -f "$CPP_FILE"; then | |
cat "$CPP_FILE" | reviewdog -efm="%f:%l:%c:%m" -filter-mode=nofilter -reporter=github-pr-check | |
fi | |