mirror of https://github.com/ARMmbed/mbed-os.git
travis ci migration to github action
parent
e14b9617dd
commit
91fa6801f8
|
@ -0,0 +1,269 @@
|
||||||
|
# This workflow performs the checks like license check,
|
||||||
|
# doxygen, unit tests etc.
|
||||||
|
name: Basic Checks
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
license-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ghcr.io/armmbed/mbed-os-env:master-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
-
|
||||||
|
name: install dependencies
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
pip install scancode-toolkit
|
||||||
|
|
||||||
|
-
|
||||||
|
name: license check
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
mkdir -p SCANCODE
|
||||||
|
|
||||||
|
git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \
|
||||||
|
| ( grep '.\(c\|cpp\|h\|hpp\|py\)$' || true )
|
||||||
|
echo $?
|
||||||
|
git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \
|
||||||
|
| ( grep '.\(c\|cpp\|h\|hpp\|py\)$' || true ) \
|
||||||
|
| ( grep -v '^tools/test/toolchains/api_test.py' || true ) \
|
||||||
|
| while read file; do cp --parents "${file}" SCANCODE; done
|
||||||
|
ls SCANCODE
|
||||||
|
scancode -l --json-pp scancode.json SCANCODE
|
||||||
|
python ./tools/test/ci/scancode-evaluate.py scancode.json || true
|
||||||
|
cat scancode-evaluate.log
|
||||||
|
COUNT=$(cat scancode-evaluate.log | grep 'File:' | grep -v 'SPDX' | wc -l) || true
|
||||||
|
if [ $COUNT = 0 ]; then
|
||||||
|
echo "License check OK";
|
||||||
|
true;
|
||||||
|
else
|
||||||
|
echo "License check failed, please review license issues found in files";
|
||||||
|
false;
|
||||||
|
fi
|
||||||
|
|
||||||
|
include-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ghcr.io/armmbed/mbed-os-env:master-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
-
|
||||||
|
name: include check
|
||||||
|
run: |
|
||||||
|
# checks mbed.h is not included in MbedOS files except in tests
|
||||||
|
! git grep '^#include\s["'"']mbed.h['"'"]$' -- '*.c' '*.h' '*.cpp' '*.hpp' \
|
||||||
|
':!*platform_mbed.h' ':!*TESTS/*' ':!TEST_APPS/' ':!UNITTESTS/' \
|
||||||
|
':!*tests/*' ':!*targets/*' ':!*TARGET_*' ':!*unsupported/*' \
|
||||||
|
':!*events/tests/*' ':!*drivers/tests/*'
|
||||||
|
|
||||||
|
style-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ghcr.io/armmbed/mbed-os-env:master-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
-
|
||||||
|
name: UTF-8 Check
|
||||||
|
run: |
|
||||||
|
# Make sure we're not introducing any text which is not UTF-8 encoded
|
||||||
|
git diff origin/${GITHUB_BASE_REF} -U0 | ( grep -a '^+' || true ) | ( ! grep -axv '.*' )
|
||||||
|
|
||||||
|
|
||||||
|
-
|
||||||
|
name: astyle checks
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \
|
||||||
|
| ( grep '.*\.\(c\|cpp\|h\|hpp\)$' || true ) \
|
||||||
|
| ( grep -v -f .codecheckignore || true ) \
|
||||||
|
| while read file; do astyle -n --options=.astylerc "${file}"; done
|
||||||
|
git diff --exit-code --diff-filter=d --color
|
||||||
|
|
||||||
|
|
||||||
|
docs-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ghcr.io/armmbed/mbed-os-env:master-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
-
|
||||||
|
name: spell checks
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
./tools/test/ci/doxy-spellchecker/spell.sh drivers .codecheckignore
|
||||||
|
./tools/test/ci/doxy-spellchecker/spell.sh platform .codecheckignore
|
||||||
|
./tools/test/ci/doxy-spellchecker/spell.sh events .codecheckignore
|
||||||
|
./tools/test/ci/doxy-spellchecker/spell.sh rtos .codecheckignore
|
||||||
|
./tools/test/ci/doxy-spellchecker/spell.sh connectivity/netsocket .codecheckignore
|
||||||
|
|
||||||
|
-
|
||||||
|
name: doxygen
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
ccache -s
|
||||||
|
mkdir BUILD
|
||||||
|
# Assert that the Doxygen build produced no warnings.
|
||||||
|
# The strange command below asserts that the Doxygen command had an
|
||||||
|
# output of zero length
|
||||||
|
doxygen doxyfile_options 2>&1
|
||||||
|
# Once Mbed OS has been fixed, enable the full test by replacing the top line with this:
|
||||||
|
# - ( ! doxygen doxyfile_options 2>&1 | grep . )
|
||||||
|
# Assert that all binary libraries are named correctly
|
||||||
|
# The strange command below asserts that there are exactly 0 libraries
|
||||||
|
# that do not start with lib
|
||||||
|
find "(" -name "*.a" -or -name "*.ar" ")" -and -not -name "lib*" |
|
||||||
|
tee BUILD/badlibs |
|
||||||
|
sed -e "s/^/Bad library name found: /" && [ ! -s BUILD/badlibs ]
|
||||||
|
# Assert that all assembler files are named correctly
|
||||||
|
# The strange command below asserts that there are exactly 0 libraries
|
||||||
|
# that do end with .s
|
||||||
|
find -name "*.s" | tee BUILD/badasm |
|
||||||
|
sed -e "s/^/Bad Assembler file name found: /" && [ ! -s BUILD/badasm ]
|
||||||
|
|
||||||
|
python-tests:
|
||||||
|
# these tests run in 3.7, hence running in vm not in pre-built docker
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: '3.7'
|
||||||
|
|
||||||
|
-
|
||||||
|
name: install dependencies
|
||||||
|
run: |
|
||||||
|
pip install -r requirements.txt
|
||||||
|
pip install mock==2.0.0 attrs==19.1.0 pytest==3.3.0 'pylint>=1.9,<2' 'hypothesis>=3,<4' 'coverage>=4.5,<5'
|
||||||
|
|
||||||
|
-
|
||||||
|
name: pytest
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
coverage run -a -m pytest tools/test
|
||||||
|
python tools/test/pylint.py
|
||||||
|
coverage run -a tools/project.py -S | sed -n '/^Total/p'
|
||||||
|
coverage html
|
||||||
|
|
||||||
|
pin-validation:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ghcr.io/armmbed/mbed-os-env:master-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
-
|
||||||
|
name: validate pins
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \
|
||||||
|
| ( grep '.*[\\|\/]PinNames.h$' || true ) \
|
||||||
|
| while read file; do python ./hal/tests/pinvalidate/pinvalidate.py -vvvfp "${file}"; done
|
||||||
|
git diff --exit-code --diff-filter=d --color
|
||||||
|
|
||||||
|
cmake-checks:
|
||||||
|
env:
|
||||||
|
NAME: mbed-test-mode-check
|
||||||
|
ROOT: tools/cmake/tests/mbed_test_mode/
|
||||||
|
TOOLCHAIN: GCC_ARM
|
||||||
|
TARGET_NAME: K64F
|
||||||
|
PROFILE: develop
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ghcr.io/armmbed/mbed-os-env:master-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
-
|
||||||
|
name: cmake build
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
mbedtools configure -p ${{ env.ROOT}} -t ${{ env.TOOLCHAIN }} -m ${{ env.TARGET_NAME }} --mbed-os-path .
|
||||||
|
cmake -S ${{env.ROOT}} -B ${{ env.ROOT }}/cmake_build/${{env.TARGET_NAME}}/${{ env.PROFILE }}/${{ env.TOOLCHAIN }}/ -GNinja -DCMAKE_BUILD_TYPE=${{ env.PROFILE }}
|
||||||
|
cmake --build ${{ env.ROOT }}/cmake_build/${{ env.TARGET_NAME }}/${{ env.PROFILE }}/${{ env.TOOLCHAIN }}/
|
||||||
|
|
||||||
|
-
|
||||||
|
name: cmake unittest
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
ctest --build-and-test . build --build-generator Ninja --build-options -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=ON --test-command ctest
|
||||||
|
gcovr --gcov-executable gcov -r . ./build -s -e ".*\.h" --exclude-directories=${GITHUB_WORKSPACE}/build/UNITTESTS --exclude-directories=${GITHUB_WORKSPACE}/build/_deps
|
||||||
|
ccache -s
|
||||||
|
|
||||||
|
# Reject any changes to tools that would require a re-release of the
|
||||||
|
# tools for the online compiler.
|
||||||
|
frozen-tools-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ghcr.io/armmbed/mbed-os-env:master-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
-
|
||||||
|
name: frozen tool check
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
git diff --name-only origin/${GITHUB_BASE_REF} \
|
||||||
|
| egrep \
|
||||||
|
-e "^tools/build_api*" \
|
||||||
|
-e "^tools/config*" \
|
||||||
|
-e "^tools/export*" \
|
||||||
|
-e "^tools/notifier*" \
|
||||||
|
-e "^tools/paths*" \
|
||||||
|
-e "^tools/resources*" \
|
||||||
|
-e "^tools/targets*" \
|
||||||
|
-e "^tools/toolchains*" \
|
||||||
|
-e "^tools/utils*" \
|
||||||
|
-e "^$" > output.log | true
|
||||||
|
frozen_files=`cat output.log`
|
||||||
|
|
||||||
|
if [ -z "$frozen_files" ]; then
|
||||||
|
echo "Success!";
|
||||||
|
else
|
||||||
|
echo -e "Failure: Frozen files were modified\n$frozen_files";
|
||||||
|
echo -e "Please see https://os.mbed.com/blog/entry/Introducing-the-new-Mbed-Tools/" \
|
||||||
|
"\nfor why we've frozen the legacy tools.";
|
||||||
|
false;
|
||||||
|
fi
|
46
.mergify.yml
46
.mergify.yml
|
@ -35,10 +35,17 @@ pull_request_rules:
|
||||||
remove: ['needs: review', 'needs: CI']
|
remove: ['needs: review', 'needs: CI']
|
||||||
|
|
||||||
# From needs: review to needs: work - CI failure
|
# From needs: review to needs: work - CI failure
|
||||||
- name: "label needs: work when travis-ci failed"
|
- name: "label needs: work when GitHub Actions jobs have failed"
|
||||||
conditions:
|
conditions:
|
||||||
# Travis failing
|
# GitHub Actions are failing
|
||||||
- status-failure~=Travis CI - Pull Request
|
- check-failure=license-check
|
||||||
|
- check-failure=include-check
|
||||||
|
- check-failure=style-check
|
||||||
|
- check-failure=docs-check
|
||||||
|
- check-failure=python-tests
|
||||||
|
- check-failure=pin-validation
|
||||||
|
- check-failure=cmake-checks
|
||||||
|
- check-failure=frozen-tools-check
|
||||||
- "label!=mergify skip"
|
- "label!=mergify skip"
|
||||||
actions:
|
actions:
|
||||||
label:
|
label:
|
||||||
|
@ -49,7 +56,7 @@ pull_request_rules:
|
||||||
- name: "label needs: work when Jenkins CI failed - pr head"
|
- name: "label needs: work when Jenkins CI failed - pr head"
|
||||||
conditions:
|
conditions:
|
||||||
# Jenkins CI failing
|
# Jenkins CI failing
|
||||||
- status-failure~=continuous-integration/jenkins/pr-head
|
- check-failure~=continuous-integration/jenkins/pr-head
|
||||||
- "label!=mergify skip"
|
- "label!=mergify skip"
|
||||||
actions:
|
actions:
|
||||||
label:
|
label:
|
||||||
|
@ -60,7 +67,7 @@ pull_request_rules:
|
||||||
- name: "label needs: work when Jenkins CI failed - any of the pipeline"
|
- name: "label needs: work when Jenkins CI failed - any of the pipeline"
|
||||||
conditions:
|
conditions:
|
||||||
# Jenkins CI failing - any of the pipeline
|
# Jenkins CI failing - any of the pipeline
|
||||||
- status-failure~=^jenkins-ci
|
- check-failure~=^jenkins-ci
|
||||||
- "label!=mergify skip"
|
- "label!=mergify skip"
|
||||||
actions:
|
actions:
|
||||||
label:
|
label:
|
||||||
|
@ -80,11 +87,18 @@ pull_request_rules:
|
||||||
# No conflict with the base branch
|
# No conflict with the base branch
|
||||||
- -conflict
|
- -conflict
|
||||||
|
|
||||||
# CI green policy, at least Travis should be green
|
# CI green policy, at least GitHub Actions jobs should be green
|
||||||
- status-success~=Travis CI - Pull Request
|
- check-success=license-check
|
||||||
|
- check-success=include-check
|
||||||
|
- check-success=style-check
|
||||||
|
- check-success=docs-check
|
||||||
|
- check-success=python-tests
|
||||||
|
- check-success=pin-validation
|
||||||
|
- check-success=cmake-checks
|
||||||
|
- check-success=frozen-tools-check
|
||||||
# new CI needs to be done (neutral does not work, lets check if it failed or passed, if none, we need to run again)
|
# new CI needs to be done (neutral does not work, lets check if it failed or passed, if none, we need to run again)
|
||||||
- -status-success~=continuous-integration/jenkins/pr-head
|
- -check-success~=continuous-integration/jenkins/pr-head
|
||||||
- -status-failure~=continuous-integration/jenkins/pr-head
|
- -check-failure~=continuous-integration/jenkins/pr-head
|
||||||
actions:
|
actions:
|
||||||
label:
|
label:
|
||||||
add: ['needs: CI']
|
add: ['needs: CI']
|
||||||
|
@ -132,11 +146,19 @@ pull_request_rules:
|
||||||
- "#changes-requested-reviews-by=0"
|
- "#changes-requested-reviews-by=0"
|
||||||
|
|
||||||
# CI green policy
|
# CI green policy
|
||||||
- status-success~=Travis CI - Pull Request
|
- check-success=license-check
|
||||||
|
- check-success=include-check
|
||||||
|
- check-success=style-check
|
||||||
|
- check-success=docs-check
|
||||||
|
- check-success=python-tests
|
||||||
|
- check-success=pin-validation
|
||||||
|
- check-success=cmake-checks
|
||||||
|
- check-success=frozen-tools-check
|
||||||
|
|
||||||
# Internal Jenkins - we rely on PR head to provide status
|
# Internal Jenkins - we rely on PR head to provide status
|
||||||
- status-success~=continuous-integration/jenkins/pr-head
|
- check-success~=continuous-integration/jenkins/pr-head
|
||||||
# any of the jenkins pipeline needs to be green. We rely on not failure means all good (if skipped or executed)
|
# any of the jenkins pipeline needs to be green. We rely on not failure means all good (if skipped or executed)
|
||||||
- -status-failure~=^jenkins-ci
|
- -check-failure~=^jenkins-ci
|
||||||
actions:
|
actions:
|
||||||
label:
|
label:
|
||||||
add: ['ready for merge']
|
add: ['ready for merge']
|
||||||
|
|
341
.travis.yml
341
.travis.yml
|
@ -1,341 +0,0 @@
|
||||||
# Copyright (c) 2013-2019 Arm Limited. All rights reserved.
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
#
|
|
||||||
# Licensed 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
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
language: sh
|
|
||||||
os: linux
|
|
||||||
dist: focal
|
|
||||||
|
|
||||||
|
|
||||||
env:
|
|
||||||
global:
|
|
||||||
- deps_url="https://mbed-os-ci-public.s3-eu-west-1.amazonaws.com/jenkins-ci/deps"
|
|
||||||
- deps_dir="${HOME}/.cache/deps"
|
|
||||||
|
|
||||||
cache:
|
|
||||||
pip: true
|
|
||||||
ccache: true
|
|
||||||
directories:
|
|
||||||
- ${HOME}/.cache/deps
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
- source tools/test/travis-ci/functions.sh
|
|
||||||
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- sourceline: 'deb https://apt.kitware.com/ubuntu/ focal main'
|
|
||||||
key_url: 'https://apt.kitware.com/keys/kitware-archive-latest.asc'
|
|
||||||
packages:
|
|
||||||
- cmake
|
|
||||||
- ninja-build
|
|
||||||
- gcovr
|
|
||||||
- libncursesw5
|
|
||||||
- g++-7
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
|
|
||||||
### Basic Tests ###
|
|
||||||
- &basic-vm
|
|
||||||
stage: "Basic"
|
|
||||||
name: "file attributes"
|
|
||||||
env: NAME=gitattributestest
|
|
||||||
script:
|
|
||||||
- git diff --exit-code
|
|
||||||
|
|
||||||
- <<: *basic-vm
|
|
||||||
name: "license check"
|
|
||||||
env: NAME=licence_check
|
|
||||||
language: python
|
|
||||||
python: 3.6.8 # scancode-toolkit v3.1.1 requires v3.6.8
|
|
||||||
install:
|
|
||||||
# workaround for https://github.com/ARMmbed/mbed-os/issues/13322
|
|
||||||
- pip install pdfminer.six==20200517
|
|
||||||
- pip install scancode-toolkit==3.1.1
|
|
||||||
before_script:
|
|
||||||
- mkdir -p SCANCODE
|
|
||||||
- mkdir -p SCANCODE_NEW_FILES
|
|
||||||
# Fetch the base branch to compare against
|
|
||||||
- git fetch origin "${TRAVIS_BRANCH}" --depth=1
|
|
||||||
script:
|
|
||||||
# scancode does not support list of files, only one file or directory
|
|
||||||
# we use SCANCODE directory for all changed files (their copies with full tree)
|
|
||||||
- >-
|
|
||||||
git diff --name-only --diff-filter=ad FETCH_HEAD..HEAD \
|
|
||||||
| ( grep '.\(c\|cpp\|h\|hpp\|py\)$' || true ) \
|
|
||||||
| ( grep -v '^tools/test/toolchains/api_test.py' || true ) \
|
|
||||||
| while read file; do cp --parents "${file}" SCANCODE; done
|
|
||||||
- scancode -l --json-pp scancode.json SCANCODE
|
|
||||||
- python ./tools/test/travis-ci/scancode-evaluate.py scancode.json || true
|
|
||||||
# run the same but for new files. All new files must have SPDX
|
|
||||||
- >-
|
|
||||||
git diff --name-only --diff-filter=A FETCH_HEAD..HEAD \
|
|
||||||
| ( grep '.\(c\|cpp\|h\|hpp\|py\)$' || true ) \
|
|
||||||
| ( grep -v '^tools/test/toolchains/api_test.py' || true ) \
|
|
||||||
| while read file; do cp --parents "${file}" SCANCODE_NEW_FILES; done
|
|
||||||
- scancode -l --json-pp scancode_new_files.json SCANCODE_NEW_FILES
|
|
||||||
- python ./tools/test/travis-ci/scancode-evaluate.py scancode_new_files.json || true
|
|
||||||
- cat scancode-evaluate.log
|
|
||||||
- COUNT=$(cat scancode-evaluate.log | grep 'File:' | grep -v 'SPDX' | wc -l) || true
|
|
||||||
- python ./tools/test/travis-ci/scancode-evaluate.py scancode_new_files.json
|
|
||||||
- cat scancode-evaluate.log
|
|
||||||
- COUNT_NEW_FILES=$(cat scancode-evaluate.log | grep 'File:' | grep -v 'SPDX' | wc -l) || true
|
|
||||||
- |
|
|
||||||
if [ $COUNT == 0 ] && [ $COUNT_NEW_FILES == 0 ]; then
|
|
||||||
echo "License check OK";
|
|
||||||
true;
|
|
||||||
elif [ $COUNT_NEW_FILES != 0 ]; then
|
|
||||||
echo "License check failed, new files with the license issues found";
|
|
||||||
false;
|
|
||||||
else
|
|
||||||
echo "License check failed, please review license issues found in modified files";
|
|
||||||
false;
|
|
||||||
fi
|
|
||||||
|
|
||||||
- <<: *basic-vm
|
|
||||||
name: "UTF-8 Check"
|
|
||||||
script:
|
|
||||||
# Make sure we're not introducing any text which is not UTF-8 encoded
|
|
||||||
- git diff $TRAVIS_BRANCH...HEAD -U0 | ( grep -a '^+' || true ) | ( ! grep -axv '.*' )
|
|
||||||
|
|
||||||
- <<: *basic-vm
|
|
||||||
name: "include check"
|
|
||||||
env: NAME=include_check
|
|
||||||
script:
|
|
||||||
- |
|
|
||||||
! git grep '^#include\s["'"']mbed.h['"'"]$' -- '*.c' '*.h' '*.cpp' '*.hpp' \
|
|
||||||
':!*platform_mbed.h' ':!*TESTS/*' ':!TEST_APPS/' ':!UNITTESTS/' \
|
|
||||||
':!*tests/*' ':!*targets/*' ':!*TARGET_*' ':!*unsupported/*' \
|
|
||||||
':!*events/tests/*' ':!*drivers/tests/*'
|
|
||||||
|
|
||||||
### Docs Tests ###
|
|
||||||
- &docs-vm
|
|
||||||
stage: "Docs"
|
|
||||||
name: "astyle"
|
|
||||||
env: NAME=astyle
|
|
||||||
install:
|
|
||||||
- >-
|
|
||||||
curl -L0 https://mbed-os-ci-public.s3-eu-west-1.amazonaws.com/jenkins-ci/deps/astyle_3.1_linux.tar.gz --output astyle.tar.gz;
|
|
||||||
mkdir -p BUILD && tar xf astyle.tar.gz -C BUILD;
|
|
||||||
cd BUILD/astyle/build/gcc;
|
|
||||||
make;
|
|
||||||
export PATH="${PWD}/bin:${PATH}";
|
|
||||||
cd -
|
|
||||||
- astyle --version
|
|
||||||
# Fetch the base branch to compare against
|
|
||||||
- git fetch origin "${TRAVIS_BRANCH}" --depth=1
|
|
||||||
script:
|
|
||||||
- >-
|
|
||||||
git diff --name-only --diff-filter=d FETCH_HEAD..HEAD \
|
|
||||||
| ( grep '.*\.\(c\|cpp\|h\|hpp\)$' || true ) \
|
|
||||||
| ( grep -v -f .codecheckignore || true ) \
|
|
||||||
| while read file; do astyle -n --options=.astylerc "${file}"; done
|
|
||||||
- git diff --exit-code --diff-filter=d --color
|
|
||||||
|
|
||||||
- <<: *docs-vm
|
|
||||||
name: "spellcheck"
|
|
||||||
env: NAME=doxy-spellcheck
|
|
||||||
install:
|
|
||||||
- source_pkg aspell
|
|
||||||
script:
|
|
||||||
# TODO: run checks on all directories once all mispellings are fixed
|
|
||||||
- ./tools/test/travis-ci/doxy-spellchecker/spell.sh drivers .codecheckignore
|
|
||||||
- ./tools/test/travis-ci/doxy-spellchecker/spell.sh platform .codecheckignore
|
|
||||||
- ./tools/test/travis-ci/doxy-spellchecker/spell.sh events .codecheckignore
|
|
||||||
- ./tools/test/travis-ci/doxy-spellchecker/spell.sh rtos .codecheckignore
|
|
||||||
- ./tools/test/travis-ci/doxy-spellchecker/spell.sh connectivity/netsocket .codecheckignore
|
|
||||||
|
|
||||||
- <<: *docs-vm
|
|
||||||
name: "doxygen"
|
|
||||||
env: NAME=docs
|
|
||||||
install:
|
|
||||||
# Build doxygen
|
|
||||||
- >
|
|
||||||
(git clone --depth=1 --single-branch --branch Release_1_8_14 https://github.com/doxygen/doxygen;
|
|
||||||
cd doxygen;
|
|
||||||
mkdir build;
|
|
||||||
cd build;
|
|
||||||
cmake -G "Unix Makefiles" ..;
|
|
||||||
make;
|
|
||||||
sudo make install)
|
|
||||||
# Create BUILD directory for tests
|
|
||||||
- ccache -s
|
|
||||||
- mkdir BUILD
|
|
||||||
script:
|
|
||||||
# Assert that the Doxygen build produced no warnings.
|
|
||||||
# The strange command below asserts that the Doxygen command had an
|
|
||||||
# output of zero length
|
|
||||||
- doxygen doxyfile_options 2>&1
|
|
||||||
# Once Mbed OS has been fixed, enable the full test by replacing the top line with this:
|
|
||||||
# - ( ! doxygen doxyfile_options 2>&1 | grep . )
|
|
||||||
# Assert that all binary libraries are named correctly
|
|
||||||
# The strange command below asserts that there are exactly 0 libraries
|
|
||||||
# that do not start with lib
|
|
||||||
- >
|
|
||||||
find "(" -name "*.a" -or -name "*.ar" ")" -and -not -name "lib*" |
|
|
||||||
tee BUILD/badlibs |
|
|
||||||
sed -e "s/^/Bad library name found: /" && [ ! -s BUILD/badlibs ]
|
|
||||||
# Assert that all assembler files are named correctly
|
|
||||||
# The strange command below asserts that there are exactly 0 libraries
|
|
||||||
# that do end with .s
|
|
||||||
- >
|
|
||||||
find -name "*.s" | tee BUILD/badasm |
|
|
||||||
sed -e "s/^/Bad Assembler file name found: /" && [ ! -s BUILD/badasm ]
|
|
||||||
|
|
||||||
### Python Tests ###
|
|
||||||
- &pytools-vm
|
|
||||||
stage: "Pytest"
|
|
||||||
name: "tools-py35"
|
|
||||||
env: NAME=tools-py3.5
|
|
||||||
language: python
|
|
||||||
python: 3.7
|
|
||||||
install:
|
|
||||||
# Install gcc
|
|
||||||
- source_pkg gcc
|
|
||||||
- arm-none-eabi-gcc --version
|
|
||||||
# Install additional python modules
|
|
||||||
- python --version
|
|
||||||
- |-
|
|
||||||
tr -d ' ' >> requirements.txt <<< "
|
|
||||||
mock==2.0.0
|
|
||||||
attrs==19.1.0
|
|
||||||
pytest==3.3.0
|
|
||||||
pylint>=1.9,<2
|
|
||||||
hypothesis>=3,<4
|
|
||||||
coverage>=4.5,<5
|
|
||||||
"
|
|
||||||
- pip install --upgrade pip
|
|
||||||
- pip install -r requirements.txt
|
|
||||||
- pip list --verbose
|
|
||||||
script:
|
|
||||||
# Run local testing on tools
|
|
||||||
- PYTHONPATH=. coverage run -a -m pytest tools/test
|
|
||||||
- python tools/test/pylint.py
|
|
||||||
- coverage run -a tools/project.py -S | sed -n '/^Total/p'
|
|
||||||
- coverage html
|
|
||||||
|
|
||||||
- &extended-vm
|
|
||||||
stage: "Pin validation"
|
|
||||||
name: "pinvalidate"
|
|
||||||
env: NAME=pinvalidate
|
|
||||||
language: python
|
|
||||||
python: 3.7
|
|
||||||
install:
|
|
||||||
# Install python modules
|
|
||||||
- pip install --upgrade pip
|
|
||||||
- pip install tabulate argparse
|
|
||||||
- pip list --verbose
|
|
||||||
# Fetch the base branch to compare against
|
|
||||||
- git fetch origin "${TRAVIS_BRANCH}" --depth=1
|
|
||||||
script:
|
|
||||||
- >-
|
|
||||||
git diff --name-only --diff-filter=d FETCH_HEAD..HEAD \
|
|
||||||
| ( grep '.*[\\|\/]PinNames.h$' || true ) \
|
|
||||||
| while read file; do python ./hal/tests/pinvalidate/pinvalidate.py -vvvfp "${file}"; done
|
|
||||||
- git diff --exit-code --diff-filter=d --color
|
|
||||||
|
|
||||||
### CMake Check ###
|
|
||||||
- &cmake-vm
|
|
||||||
stage: "CMake Check"
|
|
||||||
name: "Backward compatiblity check - MBED_TEST_MODE"
|
|
||||||
env: NAME=mbed-test-mode-check ROOT=tools/cmake/tests/mbed_test_mode/ TOOLCHAIN=GCC_ARM TARGET_NAME=K64F PROFILE=develop
|
|
||||||
language: python
|
|
||||||
python: 3.8
|
|
||||||
install:
|
|
||||||
# Hide Travis-preinstalled CMake
|
|
||||||
# The Travis-preinstalled CMake is unfortunately not installed via apt, so we
|
|
||||||
# can't replace it with an apt-supplied version very easily. Additionally, we
|
|
||||||
# can't permit the Travis-preinstalled copy to survive, as the Travis default
|
|
||||||
# path lists the Travis CMake install location ahead of any place where apt
|
|
||||||
# would install CMake to. Instead of apt removing or upgrading to a new CMake
|
|
||||||
# version, we must instead delete the Travis copy of CMake.
|
|
||||||
- sudo rm -rf /usr/local/cmake*
|
|
||||||
# Setup ccache
|
|
||||||
- ccache -o compiler_check=content
|
|
||||||
- ccache -M 1G
|
|
||||||
- pushd /usr/lib/ccache
|
|
||||||
- sudo ln -s ../../bin/ccache arm-none-eabi-gcc
|
|
||||||
- sudo ln -s ../../bin/ccache arm-none-eabi-g++
|
|
||||||
- export PATH="/usr/lib/ccache:$PATH"
|
|
||||||
- popd
|
|
||||||
# Install arm-none-eabi-gcc
|
|
||||||
- pushd /home/travis/build && mkdir arm-gcc && cd arm-gcc
|
|
||||||
- curl -L0 "https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2?revision=05382cca-1721-44e1-ae19-1e7c3dc96118&la=en&hash=D7C9D18FCA2DD9F894FD9F3C3DC9228498FA281A" --output gcc-arm-none-eabi-9-2020-q2-update.tar.bz2
|
|
||||||
- tar xf gcc-arm-none-eabi-9-2020-q2-update.tar.bz2
|
|
||||||
- export PATH="$PATH:${PWD}/gcc-arm-none-eabi-9-2020-q2-update/bin"
|
|
||||||
- popd
|
|
||||||
- arm-none-eabi-gcc --version
|
|
||||||
# Install python modules
|
|
||||||
- pip install --upgrade mbed-tools
|
|
||||||
- pip install -r tools/cmake/requirements.txt
|
|
||||||
script:
|
|
||||||
- mbedtools configure -p ${ROOT} -t ${TOOLCHAIN} -m ${TARGET_NAME} --mbed-os-path .
|
|
||||||
- cmake -S ${ROOT} -B ${ROOT}/cmake_build/${TARGET_NAME}/${PROFILE}/${TOOLCHAIN}/ -GNinja -DCMAKE_BUILD_TYPE=${PROFILE}
|
|
||||||
- cmake --build ${ROOT}/cmake_build/${TARGET_NAME}/${PROFILE}/${TOOLCHAIN}/
|
|
||||||
|
|
||||||
### Mbed OS unittest ###
|
|
||||||
- &cmake-build-run-unittest
|
|
||||||
stage: "CMake"
|
|
||||||
name: "CMake unittest build"
|
|
||||||
env: NAME=cmake_unittest
|
|
||||||
install:
|
|
||||||
# Hide Travis-preinstalled CMake
|
|
||||||
# The Travis-preinstalled CMake is unfortunately not installed via apt, so we
|
|
||||||
# can't replace it with an apt-supplied version very easily. Additionally, we
|
|
||||||
# can't permit the Travis-preinstalled copy to survive, as the Travis default
|
|
||||||
# path lists the Travis CMake install location ahead of any place where apt
|
|
||||||
# would install CMake to. Instead of apt removing or upgrading to a new CMake
|
|
||||||
# version, we must instead delete the Travis copy of CMake.
|
|
||||||
- sudo rm -rf /usr/local/cmake*
|
|
||||||
script:
|
|
||||||
- echo ctest --build-and-test . build --build-generator Ninja --build-options -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=ON -DCMAKE_CXX_COMPILER=g++-7 -DCMAKE_C_COMPILER=gcc-7 --test-command ctest
|
|
||||||
- ctest --build-and-test . build --build-generator Ninja --build-options -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=ON -DCMAKE_CXX_COMPILER=g++-7 -DCMAKE_C_COMPILER=gcc-7 --test-command ctest
|
|
||||||
- gcovr --gcov-executable gcov-7 -r . ./build -s -e ".*\.h" --exclude-directories=$TRAVIS_BUILD_DIR/build/UNITTESTS --exclude-directories=$TRAVIS_BUILD_DIR/build/_deps
|
|
||||||
- ccache -s
|
|
||||||
|
|
||||||
### Frozen tools check ###
|
|
||||||
- &frozen-tools-vm
|
|
||||||
stage: "Frozen tools check"
|
|
||||||
name: "Frozen tools check"
|
|
||||||
env: NAME=frozen_tools_check
|
|
||||||
before_script:
|
|
||||||
# Fetch the base branch to compare against
|
|
||||||
- git fetch origin "${TRAVIS_BRANCH}" --depth=1
|
|
||||||
script:
|
|
||||||
# Reject any changes to tools that would require a re-release of the
|
|
||||||
# tools for the online compiler.
|
|
||||||
- >-
|
|
||||||
frozen_files=`\
|
|
||||||
git diff --name-only FETCH_HEAD..HEAD \
|
|
||||||
| egrep \
|
|
||||||
-e "^tools/build_api*" \
|
|
||||||
-e "^tools/config*" \
|
|
||||||
-e "^tools/export*" \
|
|
||||||
-e "^tools/notifier*" \
|
|
||||||
-e "^tools/paths*" \
|
|
||||||
-e "^tools/resources*" \
|
|
||||||
-e "^tools/targets*" \
|
|
||||||
-e "^tools/toolchains*" \
|
|
||||||
-e "^tools/utils*" \
|
|
||||||
-e "^$"`
|
|
||||||
if [ -z "$frozen_files" ]; then
|
|
||||||
echo "Success!";
|
|
||||||
else
|
|
||||||
echo -e "Failure: Frozen files were modified\n$frozen_files";
|
|
||||||
echo -e "Please see https://os.mbed.com/blog/entry/Introducing-the-new-Mbed-Tools/" \
|
|
||||||
"\nfor why we've frozen the legacy tools.";
|
|
||||||
false;
|
|
||||||
fi
|
|
|
@ -1,15 +1,12 @@
|
||||||
[![Mbed OS][mbed-os-logo]][mbed-os-link]
|
[![Mbed OS][mbed-os-logo]][mbed-os-link]
|
||||||
|
|
||||||
[![Build status release][mbed-travis-release-svg]][mbed-travis-release]
|
[![Build status master][mbed-master-svg]][mbed-master]
|
||||||
[![Build status master][mbed-travis-master-svg]][mbed-travis-master]
|
|
||||||
[![Tools coverage status][mbed-coveralls-tools-svg]][mbed-coveralls-tools]
|
[![Tools coverage status][mbed-coveralls-tools-svg]][mbed-coveralls-tools]
|
||||||
|
|
||||||
[mbed-os-logo]: logo.png
|
[mbed-os-logo]: logo.png
|
||||||
[mbed-os-link]: https://www.mbed.com/en/platform/mbed-os/
|
[mbed-os-link]: https://www.mbed.com/en/platform/mbed-os/
|
||||||
[mbed-travis-master]: https://travis-ci.org/ARMmbed/mbed-os
|
[mbed-master]: https://github.com/ARMmbed/mbed-os/actions/workflows/basic_checks.yml
|
||||||
[mbed-travis-master-svg]: https://travis-ci.org/ARMmbed/mbed-os.svg?branch=master
|
[mbed-master-svg]: https://github.com/ARMmbed/mbed-os/actions/workflows/basic_checks.yml/badge.svg
|
||||||
[mbed-travis-release]: https://travis-ci.org/ARMmbed/mbed-os/branches
|
|
||||||
[mbed-travis-release-svg]: https://travis-ci.org/ARMmbed/mbed-os.svg?branch=latest
|
|
||||||
[mbed-coveralls-tools]: https://coveralls.io/github/ARMmbed/mbed-os?branch=master
|
[mbed-coveralls-tools]: https://coveralls.io/github/ARMmbed/mbed-os?branch=master
|
||||||
[mbed-coveralls-tools-svg]: https://coveralls.io/repos/github/ARMmbed/mbed-os/badge.svg?branch=master
|
[mbed-coveralls-tools-svg]: https://coveralls.io/repos/github/ARMmbed/mbed-os/badge.svg?branch=master
|
||||||
|
|
||||||
|
|
|
@ -123,6 +123,6 @@ echo "Total Errors Found: ${ERRORS}"
|
||||||
|
|
||||||
if [ ${ERRORS} -ne 0 ]; then
|
if [ ${ERRORS} -ne 0 ]; then
|
||||||
echo "If any of the failed words should be considered valid please add them to the ignore.en.pws file"\
|
echo "If any of the failed words should be considered valid please add them to the ignore.en.pws file"\
|
||||||
"found in tools/test/travis-ci/doxy-spellchecker between the _code_ and _doxy_ tags."
|
"found in tools/test/ci/doxy-spellchecker between the _code_ and _doxy_ tags."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
|
@ -31,7 +31,7 @@
|
||||||
],
|
],
|
||||||
"files":[
|
"files":[
|
||||||
{
|
{
|
||||||
"path":"tools/test/travis-ci/scancode_test/test.h",
|
"path":"tools/test/ci/scancode_test/test.h",
|
||||||
"type":"file",
|
"type":"file",
|
||||||
"licenses":[
|
"licenses":[
|
||||||
{
|
{
|
||||||
|
@ -141,7 +141,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path":"tools/test/travis-ci/scancode_test/test2.h",
|
"path":"tools/test/ci/scancode_test/test2.h",
|
||||||
"type":"file",
|
"type":"file",
|
||||||
"licenses":[
|
"licenses":[
|
||||||
{
|
{
|
||||||
|
@ -251,7 +251,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path":"tools/test/travis-ci/scancode_test/test3.h",
|
"path":"tools/test/ci/scancode_test/test3.h",
|
||||||
"type":"file",
|
"type":"file",
|
||||||
"licenses":[
|
"licenses":[
|
||||||
{
|
{
|
||||||
|
@ -361,7 +361,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path":"tools/test/travis-ci/scancode_test/test4.h",
|
"path":"tools/test/ci/scancode_test/test4.h",
|
||||||
"type":"file",
|
"type":"file",
|
||||||
"licenses":[
|
"licenses":[
|
||||||
{
|
{
|
||||||
|
@ -471,7 +471,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path":"tools/test/travis-ci/scancode_test/test5.c",
|
"path":"tools/test/ci/scancode_test/test5.c",
|
||||||
"type":"file",
|
"type":"file",
|
||||||
"licenses":[
|
"licenses":[
|
||||||
{
|
{
|
||||||
|
@ -548,7 +548,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path":"tools/test/travis-ci/scancode_test/test6.c",
|
"path":"tools/test/ci/scancode_test/test6.c",
|
||||||
"type":"file",
|
"type":"file",
|
||||||
"licenses":[
|
"licenses":[
|
||||||
{
|
{
|
||||||
|
@ -625,7 +625,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path":"tools/test/travis-ci/scancode_test/test7.c",
|
"path":"tools/test/ci/scancode_test/test7.c",
|
||||||
"type":"file",
|
"type":"file",
|
||||||
"licenses":[
|
"licenses":[
|
||||||
{
|
{
|
||||||
|
@ -702,7 +702,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path":"tools/test/travis-ci/scancode_test/test8.c",
|
"path":"tools/test/ci/scancode_test/test8.c",
|
||||||
"type":"file",
|
"type":"file",
|
||||||
"licenses":[
|
"licenses":[
|
||||||
{
|
{
|
|
@ -5,11 +5,11 @@
|
||||||
"tool_version":"3.1.1",
|
"tool_version":"3.1.1",
|
||||||
"options":{
|
"options":{
|
||||||
"input":[
|
"input":[
|
||||||
"tools/test/travis-ci/scancode_test/test.h",
|
"tools/test/ci/scancode_test/test.h",
|
||||||
"tools/test/travis-ci/scancode_test/test2.h",
|
"tools/test/ci/scancode_test/test2.h",
|
||||||
"tools/test/travis-ci/scancode_test/test3.h",
|
"tools/test/ci/scancode_test/test3.h",
|
||||||
"tools/test/travis-ci/scancode_test/test4.h",
|
"tools/test/ci/scancode_test/test4.h",
|
||||||
"tools/test/travis-ci/scancode_test/test5.h"
|
"tools/test/ci/scancode_test/test5.h"
|
||||||
],
|
],
|
||||||
"--json-pp":"scancode.json",
|
"--json-pp":"scancode.json",
|
||||||
"--license":true
|
"--license":true
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
],
|
],
|
||||||
"files":[
|
"files":[
|
||||||
{
|
{
|
||||||
"path":"tools/test/travis-ci/scancode_test/test.h",
|
"path":"tools/test/ci/scancode_test/test.h",
|
||||||
"type":"file",
|
"type":"file",
|
||||||
"licenses":[
|
"licenses":[
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path":"tools/test/travis-ci/scancode_test/test3.h",
|
"path":"tools/test/ci/scancode_test/test3.h",
|
||||||
"type":"file",
|
"type":"file",
|
||||||
"licenses":[
|
"licenses":[
|
||||||
{
|
{
|
||||||
|
@ -85,7 +85,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path":"tools/test/travis-ci/scancode_test/test4.h",
|
"path":"tools/test/ci/scancode_test/test4.h",
|
||||||
"type":"file",
|
"type":"file",
|
||||||
"licenses":[
|
"licenses":[
|
||||||
{
|
{
|
||||||
|
@ -129,7 +129,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path":"tools/test/travis-ci/scancode_test/test5.h",
|
"path":"tools/test/ci/scancode_test/test5.h",
|
||||||
"type":"file",
|
"type":"file",
|
||||||
"licenses":[
|
"licenses":[
|
||||||
{
|
{
|
||||||
|
@ -173,7 +173,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path":"tools/test/travis-ci/scancode_test/test6.h",
|
"path":"tools/test/ci/scancode_test/test6.h",
|
||||||
"type":"file",
|
"type":"file",
|
||||||
"licenses":[
|
"licenses":[
|
||||||
{
|
{
|
|
@ -24,7 +24,7 @@
|
||||||
],
|
],
|
||||||
"files":[
|
"files":[
|
||||||
{
|
{
|
||||||
"path":"tools/test/travis-ci/scancode_test/test3.h",
|
"path":"tools/test/ci/scancode_test/test3.h",
|
||||||
"type":"file",
|
"type":"file",
|
||||||
"licenses":[
|
"licenses":[
|
||||||
{
|
{
|
|
@ -1,213 +0,0 @@
|
||||||
#!/bin/bash -euf
|
|
||||||
#
|
|
||||||
# Copyright (c) 2013-2018 Arm Limited. All rights reserved.
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
#
|
|
||||||
# Licensed 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
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Helper functions for printing status information.
|
|
||||||
# Uses 'echo' instead of 'printf' due to Travis CI stdout sync issues.
|
|
||||||
#
|
|
||||||
info() { echo -e "I: ${1}"; }
|
|
||||||
die() { echo -e "E: ${1}" 1>&2; exit "${2:-1}"; }
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Sets the GitHub job status for a given commit.
|
|
||||||
#
|
|
||||||
set_status()
|
|
||||||
{
|
|
||||||
local job_name="${NAME}"
|
|
||||||
local payload=""
|
|
||||||
|
|
||||||
payload=$(<<< "
|
|
||||||
{
|
|
||||||
'state': '${1}',
|
|
||||||
'description': '${2}',
|
|
||||||
'context': 'travis-ci/${job_name}',
|
|
||||||
'target_url': 'https://travis-ci.org/${TRAVIS_REPO_SLUG}/jobs/${TRAVIS_JOB_ID}'
|
|
||||||
}" tr "'" '"')
|
|
||||||
|
|
||||||
curl --silent --output /dev/null --user "${MBED_BOT}" --request POST \
|
|
||||||
"https://api.github.com/repos/${TRAVIS_REPO_SLUG}/statuses/${TRAVIS_PULL_REQUEST_SHA:-${TRAVIS_COMMIT}}" \
|
|
||||||
--data @- <<< "${payload}"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Sources a pre-compiled GCC installation from AWS, installing the archive by
|
|
||||||
# extracting and prepending the executable directory to PATH.
|
|
||||||
# Ccache is enabled for `arm-none-eabi-`.
|
|
||||||
#
|
|
||||||
# Note: Expects 'deps_url' and 'deps_dir' to already be defined.
|
|
||||||
#
|
|
||||||
_install_gcc_and_ccache()
|
|
||||||
{
|
|
||||||
# Enable Ccache in Travis
|
|
||||||
ccache -o compiler_check=content
|
|
||||||
ccache -M 1G
|
|
||||||
pushd /usr/lib/ccache
|
|
||||||
sudo ln -s ../../bin/ccache arm-none-eabi-gcc
|
|
||||||
sudo ln -s ../../bin/ccache arm-none-eabi-g++
|
|
||||||
export "PATH=/usr/lib/ccache:${PATH}"
|
|
||||||
popd
|
|
||||||
|
|
||||||
# Legacy Mbed build tool passes a new time stamp in commmand line argument
|
|
||||||
# every time mbed-os is built. This causes ccache cache miss. But there is a
|
|
||||||
# provision to read the time stamp from environment variable
|
|
||||||
# (MBED_BUILD_TIMESTAMP). Setting this variable to a fixed value improves
|
|
||||||
# ccache cache hits.
|
|
||||||
export "MBED_BUILD_TIMESTAMP=0"
|
|
||||||
|
|
||||||
# Ignore shellcheck warnings: Variables defined in .travis.yml
|
|
||||||
# shellcheck disable=SC2154
|
|
||||||
local url="${deps_url}/gcc9-linux.tar.bz2"
|
|
||||||
|
|
||||||
# shellcheck disable=SC2154
|
|
||||||
local gcc_path="${deps_dir}/gcc/gcc-arm-none-eabi-9-2019-q4-major"
|
|
||||||
|
|
||||||
local archive="gcc.tar.bz2"
|
|
||||||
|
|
||||||
info "URL: ${url}"
|
|
||||||
|
|
||||||
if [ ! -d "${deps_dir}/gcc" ]; then
|
|
||||||
|
|
||||||
info "Downloading archive"
|
|
||||||
curl --location "${url}" --output "${deps_dir}/${archive}"
|
|
||||||
ls -al "${deps_dir}"
|
|
||||||
|
|
||||||
info "Extracting 'gcc'"
|
|
||||||
mkdir -p "${deps_dir}/gcc"
|
|
||||||
tar -xf "${deps_dir}/${archive}" -C "${deps_dir}/gcc"
|
|
||||||
rm "${deps_dir}/${archive}"
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
info "Installing 'gcc'"
|
|
||||||
export "PATH=${PATH}:${gcc_path}/bin"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Downloads a list of packages from AWS, really fast.
|
|
||||||
#
|
|
||||||
_fetch_deps()
|
|
||||||
{
|
|
||||||
local pkg="${1}"
|
|
||||||
local dep_list="${2}"
|
|
||||||
local pid_list=""
|
|
||||||
|
|
||||||
local PID;
|
|
||||||
|
|
||||||
info "Fetching '${pkg}' archives"
|
|
||||||
|
|
||||||
while read -r dep; do
|
|
||||||
|
|
||||||
curl --location "${deps_url}/${dep}.deb" \
|
|
||||||
--output "${deps_dir}/${dep}.deb" \
|
|
||||||
|| die "Download failed ('${dep}')" \
|
|
||||||
&& info "Fetched ${deps_url}/${dep}.deb" &
|
|
||||||
|
|
||||||
PID=$!
|
|
||||||
pid_list="${pid_list} ${PID}"
|
|
||||||
|
|
||||||
done <<< "${dep_list}"
|
|
||||||
|
|
||||||
# Ignoring shellcheck warning, since we need to allow parameter expansion to
|
|
||||||
# turn the list string into parametesr.
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
wait ${pid_list}
|
|
||||||
|
|
||||||
info "Fetch completed."
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Installs a list of Debian packages, fetching them if not locally found.
|
|
||||||
#
|
|
||||||
_install_deps()
|
|
||||||
{
|
|
||||||
local pkg="${1}"
|
|
||||||
local dep_list="${2}"
|
|
||||||
local first_dep=""
|
|
||||||
|
|
||||||
# Assume that if the first package isn't cached, none are.
|
|
||||||
first_dep=$(<<< "${dep_list}" head -n1)
|
|
||||||
[ ! -f "${deps_dir}/${first_dep}.deb" ] && _fetch_deps "${pkg}" "${dep_list}"
|
|
||||||
|
|
||||||
# Install dependencies
|
|
||||||
info "Installing '${pkg}' packages"
|
|
||||||
|
|
||||||
# Ignore shellcheck warnings: Word splitting is specifically used to build
|
|
||||||
# command in one go, and expression non-expansion
|
|
||||||
# is intentional.
|
|
||||||
# shellcheck disable=SC2046 disable=SC2016
|
|
||||||
sudo dpkg -i $(<<< "${dep_list}" sed -e 's_^ *__' -e 's_^\(.*\)$_'"${deps_dir}"'/\1.deb_' | tr $'\n' ' ')
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Wrapper for installing a given package.
|
|
||||||
#
|
|
||||||
source_pkg()
|
|
||||||
{
|
|
||||||
# Debian dependencies needed for a single package.
|
|
||||||
local aspell_deps="aspell
|
|
||||||
aspell-en
|
|
||||||
dictionaries-common
|
|
||||||
libaspell15"
|
|
||||||
|
|
||||||
local libfuse_deps="libfuse-dev
|
|
||||||
libpcre3-dev
|
|
||||||
libpcre32-3
|
|
||||||
libpcrecpp0v5
|
|
||||||
libselinux1-dev
|
|
||||||
libsepol1-dev
|
|
||||||
libc-bin"
|
|
||||||
|
|
||||||
local pkg="${1}"
|
|
||||||
|
|
||||||
case "${pkg}" in
|
|
||||||
|
|
||||||
"fuse" )
|
|
||||||
# 'fuse' does not require an 'apt-get update' to install in Travis CI, so
|
|
||||||
# there's no reason to upload it or its dependencies into AWS.
|
|
||||||
sudo apt-get -o=dir::cache="${deps_dir}/apt-get" install fuse \
|
|
||||||
|| die "Installation failed"
|
|
||||||
;;
|
|
||||||
|
|
||||||
"aspell" )
|
|
||||||
_install_deps aspell "${aspell_deps}" \
|
|
||||||
|| die "Installation failed"
|
|
||||||
;;
|
|
||||||
"libfuse-dev" )
|
|
||||||
_install_deps libfuse-dev "${libfuse_deps}" \
|
|
||||||
|| die "Installation failed"
|
|
||||||
;;
|
|
||||||
|
|
||||||
"gcc" )
|
|
||||||
_install_gcc_and_ccache \
|
|
||||||
|| die "Installation failed"
|
|
||||||
;;
|
|
||||||
|
|
||||||
* )
|
|
||||||
die "Package not supported: '${pkg}'"
|
|
||||||
;;
|
|
||||||
|
|
||||||
esac
|
|
||||||
}
|
|
Loading…
Reference in New Issue