diff --git a/.github/workflows/basic_checks.yml b/.github/workflows/basic_checks.yml new file mode 100644 index 00000000000..3da472d6fd3 --- /dev/null +++ b/.github/workflows/basic_checks.yml @@ -0,0 +1,196 @@ +# This workflow performs the checks like license check, +# doxygen, unit tests etc. + +name: Basic Checks + +on: + pull_request: + push: + branches: + - mbed-os-5.15 + +jobs: + + license-check: + runs-on: ubuntu-latest + container: + image: ghcr.io/armmbed/mbed-os-env:mbed-os-5.15-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - + 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:mbed-os-5.15-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - + name: "include check" + run: | + ! git grep '^#include\s["'"']mbed.h['"'"]$' -- '*.c' '*.h' '*.cpp' '*.hpp' \ + ':!*platform_mbed.h' ':!*TESTS/*' ':!TEST_APPS/' ':!UNITTESTS/' \ + ':!*tests/*' ':!*targets/*' ':!*TARGET_*' ':!*unsupported/*' + + docs-check: + runs-on: ubuntu-latest + container: + image: ghcr.io/armmbed/mbed-os-env:mbed-os-5.15-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - + name: spell checks + run: | + ./tools/test/ci/doxy-spellchecker/spell.sh drivers + ./tools/test/ci/doxy-spellchecker/spell.sh platform + ./tools/test/ci/doxy-spellchecker/spell.sh events + ./tools/test/ci/doxy-spellchecker/spell.sh rtos + ./tools/test/ci/doxy-spellchecker/spell.sh connectivity/netsocket + + - + name: doxygen + run: | + 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 ] + + + style-check: + runs-on: ubuntu-latest + container: + image: ghcr.io/armmbed/mbed-os-env:mbed-os-5.15-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - + name: astyle checks + run: | + git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \ + | ( grep '.*\.\(c\|cpp\|h\|hpp\)$' || true ) \ + | ( grep -v -f .astyleignore || true ) \ + | while read file; do astyle -n --options=.astylerc "${file}"; done + git diff --exit-code --diff-filter=d --color + + - + 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 '.*' ) + + + python-tests: + # these tests run in 3.7, hence running in vm not in pre-built docker + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [ '3.5', '3.6', '3.7' ] + + steps: + - + name: Checkout repo + uses: actions/checkout@v2 + + + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - + 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: | + # 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 + + events-library: + runs-on: ubuntu-latest + container: + image: ghcr.io/armmbed/mbed-os-env:mbed-os-5.15-latest + + steps: + + - + name: Checkout repo + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - + name: run test + shell: bash + run: | + # Check that example compiles + sed -n '/``` cpp/,/```/{/```$/Q;/```/d;p;}' events/README.md > main.cpp + python tools/make.py -t GCC_ARM -m K64F --source=. --build=BUILD/K64F/GCC_ARM -j0 + # Check that example compiles without rtos + sed -n '/``` cpp/,/```/{/```$/Q;/```/d;p;}' events/README.md > main.cpp + rm -r rtos drivers/source/usb features/cellular features/netsocket features/nanostack \ + features/lwipstack features/frameworks/greentea-client \ + features/frameworks/utest features/frameworks/unity components BUILD + python tools/make.py -t GCC_ARM -m DISCO_F401VC --source=. --build=BUILD/DISCO_F401VC/GCC_ARM -j0 + # Run local equeue tests + make -C events/source test + # Run profiling tests + make -C events/source prof | tee prof diff --git a/.github/workflows/docker_management.publish.yml b/.github/workflows/docker_management.publish.yml new file mode 100644 index 00000000000..8a043b05f63 --- /dev/null +++ b/.github/workflows/docker_management.publish.yml @@ -0,0 +1,121 @@ + +name: Publish or Update docker image for mbed-os-5.15 + +on: + push: + branches: + - mbed-os-5.15 + + paths: + - requirements.txt + - docker_images/mbed-os-env/** + - .github/workflows/docker_management.publish.yml + + # manual trigger when needed + workflow_dispatch: + +jobs: + prepare-tags: + runs-on: ubuntu-latest + steps: + - + name: Extract branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch + + - + name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - + name: Set UUID + id: generate-uuid + uses: filipstefansson/uuid-action@v1 + +# set docker tags we are building, and intending to publish +# dev-tag is temporary for testing purpose. This should be considered as unstable. +# dated-tag is created for versioning purpose +# prod-tag-latest could be used by customers, CI etc for keeping up to date + - + name: Get build information + shell: bash + run: | + mkdir -p build_info + date=$(date +"%Y.%m.%dT%H.%M.%S") + echo dev-${{ steps.extract_branch.outputs.branch }}-${date}-${{ steps.generate-uuid.outputs.uuid }} > build_info/dev_tag + echo ${{ steps.extract_branch.outputs.branch }}-${date} > build_info/prod_tag_dated + echo ${{ steps.extract_branch.outputs.branch }}-latest > build_info/prod_tag_latest + echo ${{ steps.extract_branch.outputs.branch }} > build_info/mbed_os_version + echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]' > build_info/repository_owner + + - + name: Archive information + uses: actions/upload-artifact@v2 + with: + name: build-info + path: build_info + + + build-container: + runs-on: ubuntu-latest + needs: prepare-tags + + steps: + - + name: unarchive artefacts + uses: actions/download-artifact@v2 + with: + name: build-info + + - + name: Get build info from archive + shell: bash + id: build_info + run: | + value=`cat dev_tag` + echo "DEV TAG is $value" + echo "::set-output name=DOCKER_DEV_TAG::$value" + value=`cat prod_tag_dated` + echo "PROD TAG DATED is $value" + echo "::set-output name=DOCKER_PROD_TAG_DATED::$value" + value=`cat prod_tag_latest` + echo "::set-output name=DOCKER_PROD_TAG_LATEST::$value" + echo "PROD TAG is $value" + value=`cat repository_owner` + echo "::set-output name=REPO_OWNER::$value" + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - + name: Login to ghcr.io + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - + name: Checkout + uses: actions/checkout@v2 + + - + name: Build docker containers + uses: docker/build-push-action@v2 + id: docker_build_dev + with: + context: . + platforms: linux/amd64 + push: true + file: ./docker_images/mbed-os-env/Dockerfile + tags: ghcr.io/${{ steps.build_info.outputs.REPO_OWNER }}/mbed-os-env:${{ steps.build_info.outputs.DOCKER_PROD_TAG_LATEST }} + + # as docker tags are reused, copy also to a "fixed tag" + # for troubleshooting purpose if needed + - + name: copy tag to fixed tag + run: | + docker run quay.io/skopeo/stable --src-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} --dest-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} copy --all docker://ghcr.io/${{ steps.build_info.outputs.REPO_OWNER }}/mbed-os-env:${{ steps.build_info.outputs.DOCKER_PROD_TAG_LATEST }} docker://ghcr.io/${{ steps.build_info.outputs.REPO_OWNER }}/mbed-os-env:${{ steps.build_info.outputs.DOCKER_PROD_TAG_DATED }} diff --git a/.github/workflows/docker_management.test.yml b/.github/workflows/docker_management.test.yml new file mode 100644 index 00000000000..c15877c4bc3 --- /dev/null +++ b/.github/workflows/docker_management.test.yml @@ -0,0 +1,72 @@ +name: Build and test docker image + +# This workflow is triggered when Dockerfile related or github action itself changes are made in a PR +# The workflow is quite simple - builds and test the image. Release of newer version is done only when PR is merged. + +on: + pull_request: + branches: [ mbed-os-5.15 ] + paths: + - docker_images/mbed-os-env/** + - .github/workflows/docker_management.* + - requirements.txt + +jobs: + + build-container: + runs-on: ubuntu-latest + + strategy: + matrix: + platform: [linux/amd64] + + steps: + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + # use mbed-os-5.15 branch of blinky + - + name: Checkout + uses: actions/checkout@v2 + with: + repository: ARMmbed/mbed-os-example-blinky + path: mbed-os-example-blinky + ref: mbed-os-5.15 + + - + name: Remove mbed-os from example-application + shell: bash + run: | + cd mbed-os-example-blinky + rm -rf mbed-os + - + name: Checkout + uses: actions/checkout@v2 + with: + path: mbed-os-example-blinky/mbed-os + + - + name: Build container + uses: docker/build-push-action@v2 + id: docker_build_dev + with: + context: ./mbed-os-example-blinky/mbed-os + platforms: ${{ matrix.platform }} + file: ./mbed-os-example-blinky/mbed-os/docker_images/mbed-os-env/Dockerfile + load: true + tags: mbed-os-env:a_pr_test + + - + name: test the container + id: test + uses: addnab/docker-run-action@v2 + with: + options: -v ${{ github.workspace }}:/work -w=/work + image: mbed-os-env:a_pr_test + shell: bash + run: | + uname -m + cd mbed-os-example-blinky + # build using CLI1 + mbed compile -m K64F -t GCC_ARM \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e9c91932722..00000000000 --- a/.travis.yml +++ /dev/null @@ -1,315 +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: xenial - - -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 - directories: - - ${HOME}/.cache/deps - - -before_install: - - source tools/test/travis-ci/functions.sh - - set_status "pending" "Test started." - -after_success: - - set_status "success" "Success!" - -after_failure: - - set_status "failure" "Test failed." - - -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 - script: - - | - ! grep --recursive --max-count=100 --ignore-case --exclude .travis.yml \ - "gnu general\|gnu lesser\|lesser general\|public license" - - - <<: *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/*' - - - ### 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 remaining information needed for branch comparison - - git fetch --all --unshallow --tags - - git fetch origin "${TRAVIS_BRANCH}" - script: - - >- - git diff --name-only --diff-filter=d FETCH_HEAD..HEAD \ - | ( grep '.\(c\|cpp\|h\|hpp\)$' || true ) \ - | ( grep -v -f .astyleignore || 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: - - ./tools/test/travis-ci/doxy-spellchecker/spell.sh drivers - - ./tools/test/travis-ci/doxy-spellchecker/spell.sh platform - - ./tools/test/travis-ci/doxy-spellchecker/spell.sh events - - ./tools/test/travis-ci/doxy-spellchecker/spell.sh rtos - - ./tools/test/travis-ci/doxy-spellchecker/spell.sh features/netsocket - - - <<: *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 - - 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 assebler 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.5 - 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 - " - - python -m pip install --upgrade pip==18.1 - - python -m pip install --upgrade setuptools==40.4.3 - - 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 - - - <<: *pytools-vm - name: "tools-py36" - env: NAME=tools-py3.6 - python: 3.6 - - - <<: *pytools-vm - name: "tools-py37" - env: NAME=tools-py3.7 - python: 3.7 - - - ### Extended Tests ### - - &extended-vm - stage: "Extended" - name: "psa autogen" - env: NAME=psa-autogen - language: python - python: 3.7 - install: - # Install gcc - - source_pkg gcc - - arm-none-eabi-gcc --version - # Install python modules - - python -m pip install --upgrade pip==18.1 - - python -m pip install --upgrade setuptools==40.4.3 - - pip install -r requirements.txt - - pip list --verbose - script: - - python tools/psa/generate_partition_code.py - - git diff --exit-code - - - <<: *extended-vm - name: "events" - env: NAME=events EVENTS=events - script: - # Check that example compiles - - sed -n '/``` cpp/,/```/{/```$/Q;/```/d;p;}' ${EVENTS}/README.md > main.cpp - - python tools/make.py -t GCC_ARM -m K64F --source=. --build=BUILD/K64F/GCC_ARM -j0 - # Check that example compiles without rtos - - sed -n '/``` cpp/,/```/{/```$/Q;/```/d;p;}' ${EVENTS}/README.md > main.cpp - - | - rm -r rtos drivers/source/usb features/cellular features/netsocket features/nanostack \ - features/lwipstack features/frameworks/greentea-client \ - features/frameworks/utest features/frameworks/unity components BUILD - - python tools/make.py -t GCC_ARM -m DISCO_F401VC --source=. --build=BUILD/DISCO_F401VC/GCC_ARM -j0 - # Run local equeue tests - - make -C ${EVENTS}/source test - # Run profiling tests - - make -C ${EVENTS}/source prof | tee prof - after_success: - # Update status, comparing with master if possible. - - | - CURR=$(grep -o '[0-9]\+ cycles' prof | awk '{sum += $1} END {print sum}') - PREV=$(curl -u "${MBED_BOT}" https://api.github.com/repos/${TRAVIS_REPO_SLUG}/status/master \ - | jq -re "select(.sha != \"${TRAVIS_COMMIT}\") - | .statuses[] | select(.context == \"travis-ci/${NAME}\").description - | capture(\"runtime is (?[0-9]+)\").runtime" \ - || echo 0) - - delta="" - [ "${PREV}" -ne 0 ] && delta="($(printf "%+d" "$(( ${CURR} - ${PREV} ))" cycles)" - - set_status "success" "Success! Runtime is ${CURR} cycles. ${delta}" - - - <<: *extended-vm - name: "littlefs" - env: NAME=littlefs LITTLEFS=features/storage/filesystem/littlefs - install: - # Install gcc - - source_pkg gcc - - arm-none-eabi-gcc --version - # Install python modules - - python -m pip install --upgrade pip==18.1 - - python -m pip install --upgrade setuptools==40.4.3 - - pip install -r requirements.txt - - pip list --verbose - # Install test-specific packages - - source_pkg fuse - - source_pkg libfuse-dev - - fusermount --version - before_script: - # Setup and patch littlefs-fuse - - git clone https://github.com/armmbed/littlefs-fuse littlefs_fuse - - git -C littlefs_fuse checkout 3f1ed6e37799e49e3710830dc6abb926d5503cf2 - - echo '*' > littlefs_fuse/.mbedignore - - rm -rf littlefs_fuse/littlefs/* - - cp -r $(git ls-tree --name-only HEAD ${LITTLEFS}/littlefs/) littlefs_fuse/littlefs - # Create file-backed disk - - mkdir MOUNT - - sudo chmod a+rw /dev/loop0 - - dd if=/dev/zero bs=512 count=2048 of=DISK - - losetup /dev/loop0 DISK - - CFLAGS="-Werror -Wno-format" - script: - # Check that example compiles - - export CFLAGS="-Werror -Wno-format" - - sed -n '/``` c++/,/```/{/```/d;p;}' ${LITTLEFS}/README.md > main.cpp - - python tools/make.py -t GCC_ARM -m K82F --source=. --build=BUILD/K82F/GCC_ARM -j0 - # Run local littlefs tests - - make -C${LITTLEFS}/littlefs test QUIET=1 - # Run local littlefs tests with set of variations - - make -C${LITTLEFS}/littlefs test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=64 -DLFS_PROG_SIZE=64" - - make -C${LITTLEFS}/littlefs test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=1 -DLFS_PROG_SIZE=1" - - make -C${LITTLEFS}/littlefs test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=512 -DLFS_PROG_SIZE=512" - - make -C${LITTLEFS}/littlefs test QUIET=1 CFLAGS+="-DLFS_BLOCK_COUNT=1023 -DLFS_LOOKAHEAD=2048" - - make -C${LITTLEFS}/littlefs clean test QUIET=1 CFLAGS+="-DLFS_NO_INTRINSICS" - # Self-hosting littlefs fuzz test with littlefs-fuse - - make -Clittlefs_fuse - - littlefs_fuse/lfs --format /dev/loop0 - - littlefs_fuse/lfs /dev/loop0 MOUNT - - ls MOUNT - - mkdir MOUNT/littlefs - - cp -r $(git ls-tree --name-only HEAD ${LITTLEFS}/littlefs/) MOUNT/littlefs - - ls MOUNT/littlefs - - CFLAGS="-Wno-format" make -CMOUNT/littlefs -B test_dirs test_files QUIET=1 - # Compile and find the code size with smallest configuration - - cd ${TRAVIS_BUILD_DIR}/${LITTLEFS}/littlefs - - make clean size - CC='arm-none-eabi-gcc -mthumb' - OBJ="$(ls lfs*.o | tr '\n' ' ')" - CFLAGS+="-DLFS_NO_ASSERT -DLFS_NO_DEBUG -DLFS_NO_WARN -DLFS_NO_ERROR" - | tee sizes - after_success: - # Update status, comparing with master if possible. - - | - CURR=$(tail -n1 sizes | awk '{print $1}') - PREV=$(curl -u "${MBED_BOT}" https://api.github.com/repos/${TRAVIS_REPO_SLUG}/status/master \ - | jq -re "select(.sha != \"${TRAVIS_COMMIT}\") - | .statuses[] | select(.context == \"travis-ci/${NAME}\").description - | capture(\"code size is (?[0-9]+)\").size" \ - || echo 0) - - delta="" - [ "${PREV}" -ne 0 ] && delta="($(printf "%+0.2f%%" "$(<<< "100 * ((${CURR} - ${PREV})/${PREV})" bc -l)"))" - - set_status "success" "Success! Code size is ${CURR}B. ${delta}" diff --git a/README.md b/README.md index e4cfea0aaef..10ff7cee1a5 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,13 @@ [![Mbed OS][mbed-os-logo]][mbed-os-link] -[![Build status release][mbed-travis-release-svg]][mbed-travis-release] -[![Build status master][mbed-travis-master-svg]][mbed-travis-master] + +[![Build status][mbed-os-5.15-svg]][mbed-os-5.15] [![Tools coverage status][mbed-coveralls-tools-svg]][mbed-coveralls-tools] [mbed-os-logo]: logo.png [mbed-os-link]: https://www.mbed.com/en/platform/mbed-os/ -[mbed-travis-master]: https://travis-ci.org/ARMmbed/mbed-os -[mbed-travis-master-svg]: https://travis-ci.org/ARMmbed/mbed-os.svg?branch=master -[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-os-5.15]: https://github.com/armmbed/mbed-os/actions/workflows/basic_checks.yml +[mbed-os-5.15-svg]: https://github.com/armmbed/mbed-os/actions/workflows/basic_checks.yml/badge.svg?branch=mbed-os-5.15 [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 diff --git a/docker_images/mbed-os-env/Dockerfile b/docker_images/mbed-os-env/Dockerfile new file mode 100644 index 00000000000..cbac5430b48 --- /dev/null +++ b/docker_images/mbed-os-env/Dockerfile @@ -0,0 +1,89 @@ +# ------------------------------------------------------------------------------ +# Pull base image +FROM ubuntu:20.04 + +# ------------------------------------------------------------------------------ +# Arguments +ARG WORKDIR=/root + +# ------------------------------------------------------------------------------ +# Install tools via apt +ENV DEBIAN_FRONTEND=noninteractive +RUN set -x \ + && apt -y update \ + && apt -y install \ + git \ + wget \ + python3 \ + python3-dev \ + python3-setuptools \ + python3-pip \ + build-essential \ + astyle \ + mercurial \ + ninja-build \ + libssl-dev \ + cargo \ + flex \ + bison \ + doxygen \ + aspell \ + ccache \ + gcovr \ + && apt clean && rm -rf /var/lib/apt/lists \ + && update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 \ + && : # last line + +# Set up Mbed environment +WORKDIR /tmp/ +COPY requirements.txt . +RUN set -x \ + && pip3 install -r requirements.txt \ + && : # last line + +# ------------------------------------------------------------------------------ +# Install Python modules (which are not included in requirements.txt) +RUN set -x \ + && pip3 install -U \ + mbed-cli \ + && : # last line + +# ------------------------------------------------------------------------------ +# install scancode-toolkit, which is available only in x86_64 +RUN set -x \ + && [ "$(uname -m)" = "x86_64" ] && \ + pip install scancode-toolkit + +# ------------------------------------------------------------------------------ +# Install arm-none-eabi-gcc +WORKDIR /opt/mbed-os-toolchain + +RUN set -x \ + && [ "$(uname -m)" = "aarch64" ] && \ + TARBALL="gcc-arm-none-eabi-9-2019-q4-major-aarch64-linux.tar.bz2" || \ + TARBALL="gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2" \ + && wget -q https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/${TARBALL} \ + && tar -xjf ${TARBALL} \ + && rm ${TARBALL} \ + && : # last line + +# ------------------------------------------------------------------------------ + +# Configure environment variables +ENV MBED_GCC_ARM_PATH=/opt/mbed-os-toolchain/gcc-arm-none-eabi-9-2019-q4-major/bin/ +ENV PATH="${PATH}:${MBED_GCC_ARM_PATH}" + +# ------------------------------------------------------------------------------ +# Display, check and save environment settings +# NOTE: using bash instead of Ubuntu default bash due to unsupport for pipefail +# Pipefail is crucial here, if the tools didn't install properly, docker build should not pass because of piping +RUN /bin/bash -c \ + "set -x -o pipefail \ + && arm-none-eabi-gcc --version | grep arm-none-eabi-gcc | tee env_settings \ + && python --version 2>&1 | tee -a env_settings \ + && (echo -n 'mbed-cli ' && mbed --version) | tee -a env_settings \ + && (echo -n 'mbed-greentea ' && mbedgt --version | grep ^[0-9]) | tee -a env_settings \ + && (echo -n 'mbed-host-tests ' && mbedhtrun --version) | tee -a env_settings \ + && : # LAST LINE" + +WORKDIR /root diff --git a/docker_images/mbed-os-env/README.md b/docker_images/mbed-os-env/README.md new file mode 100644 index 00000000000..e1ccabf9752 --- /dev/null +++ b/docker_images/mbed-os-env/README.md @@ -0,0 +1,49 @@ +# Mbed OS development environment Docker image + +This Docker image is the official Mbed OS development environment. + +* It is based on Ubuntu 20.04 +* Arm-none-eabi-gcc toolchain is installed +* Latest released version of mbed-cli and mbed-greentea are installed +* All other Mbed OS dependency tools are installed. + +# How to use the Docker image: + +## Pull the Docker image +```bash +docker pull ghcr.io/armmbed/mbed-os-env: