diff --git a/.github/ISSUE_TEMPLATE/001_bug_report.yml b/.github/ISSUE_TEMPLATE/001_bug_report.yml deleted file mode 100644 index ce542917bdfad..0000000000000 --- a/.github/ISSUE_TEMPLATE/001_bug_report.yml +++ /dev/null @@ -1,148 +0,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 -# -# 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: Bug report -description: Report a bug to improve NuttX stability -title: "[BUG] " -labels: [👀 needs triage, "Type: bug"] -body: - - type: markdown - attributes: - value: | - Hello NuttX Community member! Please keep things tidy by putting your post in the proper place: - - Reporting a bug: use this form. - Asking a question or getting help: use the [General Help](https://github.com/apache/nuttx/issues/new?assignees=&labels=question&projects=&template=003_help.yml&title=help%3A+help+title) form or [Mailing list](https://nuttx.apache.org/community/). - Requesting a new feature: use the [Feature request](https://github.com/apache/nuttx/issues/new?assignees=&labels=enhancement&projects=&template=002_feature_request.yml) form. - - type: textarea - attributes: - label: "Description / Steps to reproduce the issue" - description: "A clear and concise description of what the bug is, and why you consider it to be a bug, and steps for how to reproduce it" - placeholder: | - A description with steps to reproduce the issue. - May include logs, images, or videos. - 1. Step 1 - 2. Step 2 - validations: - required: true - - - type: markdown - attributes: - value: | - ### Environment - Please specify your environment. - - - type: dropdown - id: os - attributes: - label: On which OS does this issue occur? - multiple: true - options: - - "[OS: BSD]" - - "[OS: Linux]" - - "[OS: Mac]" - - "[OS: Windows]" - - "[OS: Other]" - validations: - required: true - - - type: input - id: os_version - attributes: - label: What is the version of your OS? - description: Please fill out the distro or OS version from the previous dropdown - placeholder: "MacOS 14, Ubuntu 23.10, Windows 10/MSYS_NT-10.0-19045, ecc" - validations: - required: true - - - type: input - attributes: - label: NuttX Version - placeholder: "e.g., master, 12.5.1, ecc" - validations: - required: true - - - type: dropdown - id: architecture - attributes: - label: Issue Architecture - description: What architecture(s) are you seeing the problem on? - multiple: true - options: - - "[Arch: all]" - - "[Arch: arm]" - - "[Arch: arm64]" - - "[Arch: avr]" - - "[Arch: ceva]" - - "[Arch: hc]" - - "[Arch: mips]" - - "[Arch: misoc]" - - "[Arch: openrisc]" - - "[Arch: renesas]" - - "[Arch: risc-v]" - - "[Arch: simulator]" - - "[Arch: sparc]" - - "[Arch: tricore]" - - "[Arch: x86]" - - "[Arch: x86_64]" - - "[Arch: xtensa]" - - "[Arch: z16]" - - "[Arch: z80]" - validations: - required: true - - - type: dropdown - id: area - attributes: - label: Issue Area - description: What area(s) are you seeing the problem on? - multiple: true - options: - - "[Area: Other]" - - "[Area: Applications]" - - "[Area: Api]" - - "[Area: Board support]" - - "[Area: Build System]" - - "[Area: Configuring]" - - "[Area: Debugging]" - - "[Area: Drivers]" - - "[Area: File System]" - - "[Area: Installing]" - - "[Area: Kconfig]" - - "[Area: Kernel]" - - "[Area: Memory Management]" - - "[Area: Native port]" - - "[Area: Networking]" - - "[Area: OS Components]" - - "[Area: Posix]" - - "[Area: Sensors]" - - "[Area: Specific Peripheral]" - validations: - required: true - - - type: markdown - attributes: - value: | - ### Before You Submit - - Please verify that you've followed these steps: - - Confirm the problem is reproducible on [**master**](https://github.com/apache/nuttx) or [**latest stable**](https://nuttx.apache.org/download) release. - - Run `make distclean` when encountering build issues. - - Search [existing issues](https://github.com/apache/nuttx/issues) (including [closed](https://github.com/apache/nuttx/issues?q=is%3Aissue+is%3Aclosed)) - - Read the [FAQ](https://nuttx.apache.org/docs/latest/faq/index.html). - - - type: checkboxes - attributes: - label: "Verification" - options: - - label: "I have verified before submitting the report." - required: true diff --git a/.github/ISSUE_TEMPLATE/002_feature_request.yml b/.github/ISSUE_TEMPLATE/002_feature_request.yml deleted file mode 100644 index 726d9d53301c3..0000000000000 --- a/.github/ISSUE_TEMPLATE/002_feature_request.yml +++ /dev/null @@ -1,62 +0,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 -# -# 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: Feature request -description: Request an enhancement for NuttX -title: "[FEATURE] <title>" -labels: ["Type: enhancement"] -body: - - type: markdown - attributes: - value: | - Hello NuttX Community member! Please keep things tidy by putting your post in the proper place: - - Requesting a new feature: use this form. - Asking a question or getting help: use the [General Help](https://github.com/apache/nuttx/issues/new?assignees=&labels=question&projects=&template=003_help.yml&title=help%3A+help+title) form or [Mailing list](https://nuttx.apache.org/community/). - Reporting a bug: use the [Bug report](https://github.com/apache/nuttx/issues/new?assignees=&labels=bug&projects=&template=001_bug_report.yml) form. - - - type: textarea - id: question-description - attributes: - label: Is your feature request related to a problem? Please describe. - description: Please provide a clear and concise description of what the problem is. Add relevant issue link. - validations: - required: true - - - type: textarea - id: solution - attributes: - label: Describe the solution you'd like - description: Please provide a clear and concise description of what you want to happen. - validations: - required: true - - - type: textarea - id: alternatives - attributes: - label: Describe alternatives you've considered - description: Please provide a clear and concise description of any alternative solutions or features you've considered. - - - type: markdown - attributes: - value: | - ### Before You Submit - - Please verify that you've followed these steps: - - Search [existing feature requests](https://github.com/apache/nuttx/issues) (including [closed](https://github.com/apache/nuttx/issues?q=is%3Aissue+is%3Aclosed)) - - - type: checkboxes - attributes: - label: "Verification" - options: - - label: "I have verified before submitting the report." - required: true diff --git a/.github/ISSUE_TEMPLATE/003_help.yml b/.github/ISSUE_TEMPLATE/003_help.yml deleted file mode 100644 index 03b14a3bb8433..0000000000000 --- a/.github/ISSUE_TEMPLATE/003_help.yml +++ /dev/null @@ -1,54 +0,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 -# -# 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: General Help -description: Get general support regarding NuttX -title: "[HELP] <title>" -labels: ["Type: question"] -body: - - type: markdown - attributes: - value: | - Hello NuttX Community member! Please keep things tidy by putting your post in the proper place: - - Asking a question or getting help: use this form or [Mailing list](https://nuttx.apache.org/community/). - Reporting a bug: use the [Bug report](https://github.com/apache/nuttx/issues/new?assignees=&labels=bug&projects=&template=001_bug_report.yml) form. - Requesting a new feature: use the [Feature request](https://github.com/apache/nuttx/issues/new?assignees=&labels=enhancement&projects=&template=002_feature_request.yml) form - - - type: markdown - attributes: - value: | - ### Whether you're a beginner or an experienced developer, NuttX Help is here to assist you with all your NuttX questions and concerns. - - - type: textarea - id: question-description - attributes: - label: Description - description: Explain the background or context of your question. This helps others understand your problem or inquiry better. - validations: - required: true - - - type: markdown - attributes: - value: | - ### Before You Submit - - Please verify that you've followed these steps: - - I have searched [NuttX Documentation](https://nuttx.apache.org/docs/latest/) and didn't find an answer to my question. - - Search [existing issues](https://github.com/apache/nuttx/issues) (including [closed](https://github.com/apache/nuttx/issues?q=is%3Aissue+is%3Aclosed)) - - - type: checkboxes - attributes: - label: "Verification" - options: - - label: "I have verified before submitting the report." - required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index 3ba13e0cec6cb..0000000000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1 +0,0 @@ -blank_issues_enabled: false diff --git a/.github/labeler.yml b/.github/labeler.yml deleted file mode 100644 index a13f0c59ccb68..0000000000000 --- a/.github/labeler.yml +++ /dev/null @@ -1,200 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# -# 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. -# - -# add arch labels - -"Arch: arm": - - changed-files: - - any-glob-to-any-file: 'arch/arm/**' - -"Arch: arm64": - - changed-files: - - any-glob-to-any-file: 'arch/arm64/**' - -"Arch: avr": - - changed-files: - - any-glob-to-any-file: 'arch/avr/**' - -"Arch: ceva": - - changed-files: - - any-glob-to-any-file: 'arch/ceva/**' - -"Arch: hc": - - changed-files: - - any-glob-to-any-file: 'arch/hc/**' - -"Arch: mips": - - changed-files: - - any-glob-to-any-file: 'arch/mips/**' - -"Arch: openrisc": - - changed-files: - - any-glob-to-any-file: 'arch/or1k/**' - -"Arch: renesas": - - changed-files: - - any-glob-to-any-file: 'arch/renesas/**' - -"Arch: risc-v": - - changed-files: - - any-glob-to-any-file: 'arch/risc-v/**' - -"Arch: simulator": - - changed-files: - - any-glob-to-any-file: 'arch/sim/**' - -"Arch: sparc": - - changed-files: - - any-glob-to-any-file: 'arch/sparc/**' - -"Arch: tricore": - - changed-files: - - any-glob-to-any-file: 'arch/tricore/**' - -"Arch: x86": - - changed-files: - - any-glob-to-any-file: 'arch/x86/**' - -"Arch: x86_64": - - changed-files: - - any-glob-to-any-file: 'arch/x86_64/**' - -"Arch: xtensa": - - changed-files: - - any-glob-to-any-file: 'arch/xtensa/**' - -"Arch: z16": - - changed-files: - - any-glob-to-any-file: 'arch/z16/**' - -"Arch: z80": - - changed-files: - - any-glob-to-any-file: 'arch/z80/**' - -# add area labels - -"Area: Audio": - - changed-files: - - any-glob-to-any-file: 'audio/**' - - any-glob-to-any-file: 'drivers/audio/**' - - any-glob-to-any-file: 'include/nuttx/audio/**' - -"Area: Binfmt": - - changed-files: - - any-glob-to-any-file: 'binfmt/**' - - any-glob-to-any-file: 'include/nuttx/binfmt/**' - -"Area: Bluetooth": - - changed-files: - - any-glob-to-any-file: 'wireless/bluetooth/**' - - any-glob-to-any-file: 'nuttx/drivers/wireless/bluetooth/**' - - any-glob-to-any-file: 'include/nuttx/wireless/bluetooth/**' - -"Area: Board support": - - changed-files: - - any-glob-to-any-file: 'boards/**' - -"Area: Build system": - - changed-files: - - any-glob-to-any-file: 'Makefile' - - any-glob-to-any-file: 'CMakeLists.txt' - - any-glob-to-any-file: 'cmake/**' - - any-glob-to-any-file: 'tools/*.mk' - -"Area: CI": - - changed-files: - - any-glob-to-any-file: '.github/**' - - any-glob-to-any-file: 'tools/ci/**' - -"Area: Crypto": - - changed-files: - - any-glob-to-any-file: 'crypto/**' - - any-glob-to-any-file: 'drivers/crypto/**' - - any-glob-to-any-file: 'include/crypto/**' - - any-glob-to-any-file: 'include/nuttx/crypto/**' - -"Area: Documentation": - - changed-files: - - any-glob-to-any-file: 'Documentation/**' - - any-glob-to-any-file: 'README.md' - - any-glob-to-any-file: 'ReleaseNotes' - - any-glob-to-any-file: 'CONTRIBUTING.md' - - any-glob-to-any-file: 'INVIOLABLES.md' - -"Area: File System": - - changed-files: - - any-glob-to-any-file: 'fs/**' - - any-glob-to-any-file: 'include/nuttx/fs/**' - -"Area: Github Actions": - - changed-files: - - any-glob-to-any-file: '.github/actions/**' - -"Area: Graphics": - - changed-files: - - any-glob-to-any-file: 'graphics/**' - - any-glob-to-any-file: 'drivers/lcd/**' - - any-glob-to-any-file: 'include/nuttx/lcd/**' - -"Area: Memory Management": - - changed-files: - - any-glob-to-any-file: 'mm/**' - - any-glob-to-any-file: 'include/nuttx/mm/**' - -"Area: Networking": - - changed-files: - - any-glob-to-any-file: 'net/**' - - any-glob-to-any-file: 'drivers/net/**' - - any-glob-to-any-file: 'include/nuttx/net/**' - -"Area: OS Components": - - changed-files: - - any-glob-to-any-file: 'sched/**' - - any-glob-to-any-file: 'syscall/**' - - any-glob-to-any-file: 'libs/**' - -"Area: PCI": - - changed-files: - - any-glob-to-any-file: 'drivers/pci/**' - - any-glob-to-any-file: 'include/nuttx/pci/**' - -"Area: Sensors": - - changed-files: - - any-glob-to-any-file: 'drivers/sensors/**' - - any-glob-to-any-file: 'include/nuttx/sensors/**' - - any-glob-to-any-file: 'include/nuttx/uorb.h' - -"Area: Tooling": - - changed-files: - - any-glob-to-any-file: 'tools/**' - -"Area: USB": - - changed-files: - - any-glob-to-any-file: 'drivers/usbdev/**' - - any-glob-to-any-file: 'drivers/usbhost/**' - - any-glob-to-any-file: 'drivers/usbmisc/**' - - any-glob-to-any-file: 'drivers/usbmonitor/**' - - any-glob-to-any-file: 'include/nuttx/usb/**' - -"Area: Video": - - changed-files: - - any-glob-to-any-file: 'video/**' - - any-glob-to-any-file: 'drivers/video/**' - - any-glob-to-any-file: 'include/nuttx/video/**' diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 38dc88c01d46e..475c529275ecf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,25 +13,13 @@ name: Build on: - pull_request: - paths-ignore: - - 'Documentation/**' - - 'tools/ci/docker/linux/**' push: - paths-ignore: - - 'Documentation/**' - branches: - - master - - 'releases/*' - tags: + branches: [master] + pull_request: permissions: contents: read -concurrency: - group: build-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - jobs: Fetch-Source: runs-on: ubuntu-latest @@ -73,7 +61,7 @@ jobs: APPS_REF=$REF_NAME ;; - "tiiuae/incubator-nuttx-apps" ) + "tiiuae/nuttx-apps" ) # APPS OS_REF=$REF_NAME echo "Triggered by change in APPS" @@ -101,7 +89,7 @@ jobs: - name: Checkout apps repo uses: actions/checkout@v4 with: - repository: tiiuae/incubator-nuttx-apps + repository: tiiuae/nuttx-apps ref: ${{ steps.gittargets.outputs.apps_ref }} path: sources/apps fetch-depth: 1 @@ -115,157 +103,14 @@ jobs: name: source-bundle path: sources.tar.gz - Linux: - needs: Fetch-Source + Build: runs-on: ubuntu-latest - env: - DOCKER_BUILDKIT: 1 - - strategy: - max-parallel: 12 - matrix: - boards: [arm-12, risc-v] - - steps: - - name: Download Source Artifact - uses: actions/download-artifact@v4 - with: - name: source-bundle - path: . - - - name: Extract sources - run: tar zxf sources.tar.gz - - - name: Docker Login - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Docker Pull - run: docker pull ghcr.io/apache/nuttx/apache-nuttx-ci-linux - - - name: Export NuttX Repo SHA - run: echo "nuttx_sha=`git -C sources/nuttx rev-parse HEAD`" >> $GITHUB_ENV - - - name: Run builds - uses: ./sources/nuttx/.github/actions/ci-container - env: - BLOBDIR: /tools/blobs - with: - run: | - echo "::add-matcher::sources/nuttx/.github/gcc.json" - export ARTIFACTDIR=`pwd`/buildartifacts - git config --global --add safe.directory /github/workspace/sources/nuttx - git config --global --add safe.directory /github/workspace/sources/apps - cd sources/nuttx/tools/ci - if [ "X${{matrix.boards}}" = "Xcodechecker" ]; then - ./cibuild.sh -c -A -N -R --codechecker testlist/${{matrix.boards}}.dat - else - ./cibuild.sh -c -A -N -R -S testlist/${{matrix.boards}}.dat - fi - - - uses: actions/upload-artifact@v4 - if: ${{ always() }} - with: - name: linux-${{matrix.boards}}-builds - path: buildartifacts/ - continue-on-error: true - - macOS: - if: ${{ false }} # disable for now - permissions: - contents: none - runs-on: macos-13 needs: Fetch-Source - strategy: - max-parallel: 2 - matrix: - boards: [macos, sim-01, sim-02] - steps: - - name: Download Source Artifact - uses: actions/download-artifact@v4 - with: - name: source-bundle - path: . - - - name: Extract sources - run: tar zxf sources.tar.gz - - - name: Restore Tools Cache - id: cache-tools - uses: actions/cache@v4 - env: - cache-name: ${{ runner.os }}-cache-tools - with: - path: ./sources/tools - key: ${{ runner.os }}-tools-${{ hashFiles('./sources/nuttx/tools/ci/platforms/darwin.sh') }} - - - name: Export NuttX Repo SHA - run: echo "nuttx_sha=`git -C sources/nuttx rev-parse HEAD`" >> $GITHUB_ENV - - # Released version of Cython has issues with Python 11. Set runner to use Python 3.10 - # https://github.com/cython/cython/issues/4500 - - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - name: Run Builds - run: | - echo "::add-matcher::sources/nuttx/.github/gcc.json" - export ARTIFACTDIR=`pwd`/buildartifacts - cd sources/nuttx/tools/ci - ./cibuild.sh -i -c -A -R testlist/${{matrix.boards}}.dat - - - uses: actions/upload-artifact@v4 - with: - name: macos-${{matrix.boards}}-builds - path: buildartifacts/ - continue-on-error: true - - msys2: - needs: Fetch-Source - runs-on: windows-latest strategy: fail-fast: false - max-parallel: 1 matrix: - boards: [msys2] - - defaults: - run: - shell: msys2 {0} + boards: [ssrc-arm, ssrc-riscv] steps: - - uses: actions/checkout@v4 - - uses: msys2/setup-msys2@v2 - with: - msystem: MSYS - update: false - install: >- - base-devel - gcc - gperf - automake - autoconf - git - python3 - ncurses-devel - unzip - zip - tio - zlib-devel - cmake - ninja - python-pip - vim - - - name: pip3 install - run: | - python3 -m venv --system-site-packages /usr/local - pip3 install --root-user-action=ignore --no-cache-dir pyelftools cxxfilt kconfiglib - - - run: git config --global core.autocrlf false - - name: Download Source Artifact uses: actions/download-artifact@v4 with: @@ -275,20 +120,11 @@ jobs: - name: Extract sources run: tar zxf sources.tar.gz - - name: Export NuttX Repo SHA - run: echo "nuttx_sha=`git -C sources/nuttx rev-parse HEAD`" >> $GITHUB_ENV - - - name: Run Builds + # cibuild.sh -i installs the tools for us + - name: Run builds run: | echo "::add-matcher::sources/nuttx/.github/gcc.json" export ARTIFACTDIR=`pwd`/buildartifacts - git config --global --add safe.directory /github/workspace/sources/nuttx - git config --global --add safe.directory /github/workspace/sources/apps cd sources/nuttx/tools/ci - ./cibuild.sh -g -i -A -C -N -R testlist/${{matrix.boards}}.dat + ./cibuild.sh -i -c -A -R testlist/${{matrix.boards}}.dat - - uses: actions/upload-artifact@v4 - with: - name: msys2-${{matrix.boards}}-builds - path: buildartifacts/ - continue-on-error: true diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index abcd35cf08c12..ce1084293ba48 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -38,7 +38,7 @@ jobs: - name: Checkout apps uses: actions/checkout@v4 with: - repository: 'tiiuae/incubator-nuttx-apps.git' + repository: 'tiiuae/nuttx-apps.git' path: 'apps' ref: 'master' - name: Install tools diff --git a/.github/workflows/docker_linux.yml b/.github/workflows/docker_linux.yml index c10c3c70e75fb..7fc5b8ae8c595 100644 --- a/.github/workflows/docker_linux.yml +++ b/.github/workflows/docker_linux.yml @@ -13,7 +13,6 @@ name: Docker-Linux on: - workflow_dispatch: push: # Publish `master` as Docker `latest` image. branches: diff --git a/.github/workflows/issue_labeler.yml b/.github/workflows/issue_labeler.yml deleted file mode 100644 index 7241b30c9f851..0000000000000 --- a/.github/workflows/issue_labeler.yml +++ /dev/null @@ -1,54 +0,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 -# -# 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: Issue Labeler - -on: - issues: - types: [opened] - -jobs: - label: - runs-on: ubuntu-latest - permissions: - issues: write - steps: - - name: Add labels issues automatically based on their body. - uses: actions/github-script@v7 - with: - script: | - const body = context.payload.issue.body; - const bodySplit = body.split(/\[|\]/).map(e => e.toLowerCase()); - const oskeywords = ['os: other', 'os: bsd', 'os: Linux', 'os: mac', 'os: windows']; - const archkeywords1 = ['arch: all', 'arch: arm', 'arch: arm64', 'arch: avr', 'arch: ceva']; - const archkeywords2 = ['arch: hc', 'arch: mips', 'arch: misoc', 'arch: openrisc', 'arch:renesas']; - const archkeywords3 = ['arch: risc-v', 'arch: simulator', 'arch: sparc', 'arch: tricore']; - const archkeywords4 = ['arch: x86', 'arch: x86_64', 'arch: xtensa', 'arch: z16', 'arch: z80', 'arch:renesas']; - const areakeywords1 = ['area: applications', 'area: api', 'area: board support', 'area: build system']; - const areakeywords2 = ['area: configuring', 'area: debugging', 'area: drivers', 'area: file system', 'area: installing', 'area: kconfig']; - const areakeywords3 = ['area: kernel', 'area: memory management', 'area: native port', 'area: networking']; - const areakeywords4 = ['area: os components', 'area: posix', 'area: sensors', 'area: specific peripheral']; - const keywords = [...oskeywords, ...archkeywords1, ...archkeywords2, ...archkeywords3, ...archkeywords4, ...areakeywords1, ...areakeywords2, ...areakeywords3, ...areakeywords4]; - var keywordsfound = new Set(); - for (const keyword of keywords) { - if (bodySplit.includes(keyword)) { - keywordsfound.add(keyword) - } - } - if (keywordsfound.size !== 0) { - github.rest.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - labels: Array.from(keywordsfound) - }) - } diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml deleted file mode 100644 index 22250d40a53e1..0000000000000 --- a/.github/workflows/labeler.yml +++ /dev/null @@ -1,45 +0,0 @@ -# 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 -# -# 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: "Pull Request Labeler" -on: - - pull_request_target - -jobs: - labeler: - permissions: - contents: read - pull-requests: write - issues: write - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Assign labels based on paths - uses: actions/labeler@main - with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" - sync-labels: true - - - name: Assign labels based on the PR's size - uses: codelytv/pr-size-labeler@v1.10.1 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ignore_file_deletions: true - xs_label: 'Size: XS' - s_label: 'Size: S' - m_label: 'Size: M' - l_label: 'Size: L' - xl_label: 'Size: XL' diff --git a/nxstyle b/nxstyle new file mode 100755 index 0000000000000..5c65cced4776f Binary files /dev/null and b/nxstyle differ diff --git a/tools/ci/cibuild.sh b/tools/ci/cibuild.sh index 4c8ca44797bcd..980628c1ca7f5 100755 --- a/tools/ci/cibuild.sh +++ b/tools/ci/cibuild.sh @@ -1,94 +1,509 @@ #!/usr/bin/env bash -############################################################################ -# tools/ci/cibuild.sh -# -# SPDX-License-Identifier: Apache-2.0 -# -# 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 + +# 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 +# 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 +# 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. -# -############################################################################ + +# Prerequisites for macOS +# - Xcode (cc, etc) +# - homebrew +# - autoconf +# - wget + set -e set -o xtrace +WD=$(cd "$(dirname "$0")" && pwd) +WORKSPACE=$(cd "${WD}"/../../../ && pwd -P) +nuttx=${WORKSPACE}/nuttx +apps=${WORKSPACE}/apps +tools=${WORKSPACE}/tools +os=$(uname -s) +EXTRA_PATH= -CID=$(cd "$(dirname "$0")" && pwd) -CIWORKSPACE=$(cd "${CID}"/../../../ && pwd -P) -CIPLAT=${CIWORKSPACE}/nuttx/tools/ci/platforms -nuttx=${CIWORKSPACE}/nuttx -apps=${CIWORKSPACE}/apps +function add_path { + PATH=$1:${PATH} + EXTRA_PATH=$1:${EXTRA_PATH} +} -os=$(uname -s) -if [ -f /etc/os-release ]; then - osname=$(grep "^ID=" /etc/os-release | cut -d'=' -f2 | tr -d '"') -else - osname=${os} -fi +function arm-clang-toolchain { + add_path "${tools}"/clang-arm-none-eabi/bin -function to_do { - echo "" - echo "NuttX TODO: $1" - echo "The $1 platform does not appear to have been added to this project." - echo "" - exit 1 + if [ ! -f "${tools}/clang-arm-none-eabi/bin/clang" ]; then + local flavor + case ${os} in + Linux) + flavor=Linux + ;; + esac + cd "${tools}" + curl -O -L -s https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-17.0.1/LLVMEmbeddedToolchainForArm-17.0.1-${flavor}-x86_64.tar.xz + xz -d LLVMEmbeddedToolchainForArm-17.0.1-${flavor}.tar.xz + mv LLVMEmbeddedToolchainForArm-17.0.1 clang-arm-none-eabi + cp /usr/bin/clang-extdef-mapping-10 clang-arm-none-eabi/bin/clang-extdef-mapping + rm LLVMEmbeddedToolchainForArm-17.0.1-${flavor}.tar.xz + fi + + command clang --version } -function install_tools { - export NUTTXTOOLS=${CIWORKSPACE}/tools - mkdir -p "${NUTTXTOOLS}" +function arm-gcc-toolchain { + add_path "${tools}"/gcc-arm-none-eabi/bin - case ${osname} in - alpine) - to_do "alpine" - ;; - arch) - to_do "arch" - ;; - CYGWIN*) - to_do "CYGWIN" - ;; - debian) - to_do "debian" - ;; - fedora) - to_do "fedora" - ;; - freebsd) - to_do "freebsd" - ;; + if [ ! -f "${tools}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc" ]; then + local flavor + case ${os} in + Darwin) + flavor=-darwin + ;; + Linux) + flavor= + ;; + esac + cd "${tools}" + wget --quiet https://developer.arm.com/-/media/Files/downloads/gnu/13.2.Rel1/binrel/arm-gnu-toolchain-13.2.Rel1${flavor}-x86_64-arm-none-eabi.tar.xz + xz -d arm-gnu-toolchain-13.2.Rel1${flavor}-x86_64-arm-none-eabi.tar.xz + tar xf arm-gnu-toolchain-13.2.Rel1${flavor}-x86_64-arm-none-eabi.tar + mv arm-gnu-toolchain-13.2.Rel1${flavor}-x86_64-arm-none-eabi gcc-arm-none-eabi + rm arm-gnu-toolchain-13.2.Rel1${flavor}-x86_64-arm-none-eabi.tar + fi + + command arm-none-eabi-gcc --version +} + +function arm64-gcc-toolchain { + add_path "${tools}"/gcc-aarch64-none-elf/bin + + if [ ! -f "${tools}/gcc-aarch64-none-elf/bin/aarch64-none-elf-gcc" ]; then + local flavor + case ${os} in + Darwin) + flavor=-darwin + ;; + Linux) + flavor= + ;; + esac + cd "${tools}" + wget --quiet https://developer.arm.com/-/media/Files/downloads/gnu/13.2.Rel1/binrel/arm-gnu-toolchain-13.2.Rel1${flavor}-x86_64-aarch64-none-elf.tar.xz + xz -d arm-gnu-toolchain-13.2.Rel1${flavor}-x86_64-aarch64-none-elf.tar.xz + tar xf arm-gnu-toolchain-13.2.Rel1${flavor}-x86_64-aarch64-none-elf.tar + mv arm-gnu-toolchain-13.2.Rel1${flavor}-x86_64-aarch64-none-elf gcc-aarch64-none-elf + rm arm-gnu-toolchain-13.2.Rel1${flavor}-x86_64-aarch64-none-elf.tar + fi + + command aarch64-none-elf-gcc --version +} + +function avr-gcc-toolchain { + if ! type avr-gcc &> /dev/null; then + case ${os} in + Darwin) + brew tap osx-cross/avr + brew install avr-gcc + ;; + Linux) + sudo apt-get install -y avr-libc gcc-avr + ;; + esac + fi + + command avr-gcc --version +} + +function binutils { + mkdir -p "${tools}"/bintools/bin + add_path "${tools}"/bintools/bin + + if ! type objcopy &> /dev/null; then + case ${os} in + Darwin) + brew install binutils + # It is possible we cached prebuilt but did brew install so recreate + # symlink if it exists + rm -f "${tools}"/bintools/bin/objcopy + ln -s /usr/local/opt/binutils/bin/objcopy "${tools}"/bintools/bin/objcopy + ;; + esac + fi + + command objcopy --version +} + +function bloaty { + add_path "${tools}"/bloaty/bin + + if [ ! -f "${tools}/bloaty/bin/bloaty" ]; then + git clone --branch main https://github.com/google/bloaty "${tools}"/bloaty-src + cd "${tools}"/bloaty-src + # Due to issues with latest MacOS versions use pinned commit. + # https://github.com/google/bloaty/pull/326 + git checkout 52948c107c8f81045e7f9223ec02706b19cfa882 + mkdir -p "${tools}"/bloaty + cmake -D BLOATY_PREFER_SYSTEM_CAPSTONE=NO -DCMAKE_SYSTEM_PREFIX_PATH="${tools}"/bloaty + make install -j 6 + cd "${tools}" + rm -rf bloaty-src + fi + + command bloaty --version +} + +function c-cache { + add_path "${tools}"/ccache/bin + + if ! type ccache &> /dev/null; then + case ${os} in + Darwin) + brew install ccache + ;; + Linux) + cd "${tools}"; + wget https://github.com/ccache/ccache/releases/download/v3.7.7/ccache-3.7.7.tar.gz + tar zxf ccache-3.7.7.tar.gz + cd ccache-3.7.7; ./configure --prefix="${tools}"/ccache; make; make install + cd "${tools}"; rm -rf ccache-3.7.7; rm ccache-3.7.7.tar.gz + ;; + esac + fi + + command ccache --version +} + +function clang-tidy { + if ! type clang-tidy &> /dev/null; then + case ${os} in + Linux) + sudo apt-get install -y clang clang-tidy + ;; + esac + fi + + command clang-tidy --version +} + +function elf-toolchain { + if ! type x86_64-elf-gcc &> /dev/null; then + case ${os} in + Darwin) + brew install x86_64-elf-gcc + ;; + esac + fi + + command x86_64-elf-gcc --version +} + +function util-linux { + if ! type flock &> /dev/null; then + case ${os} in + Darwin) + brew tap discoteq/discoteq + brew install flock + ;; + Linux) + sudo apt-get install -y util-linux + ;; + esac + fi + + command flock --version +} + +function gen-romfs { + if ! type genromfs &> /dev/null; then + case ${os} in + Darwin) + brew tap PX4/px4 + brew install genromfs + ;; + Linux) + sudo apt-get install -y genromfs + ;; + esac + fi +} + +function gperf { + add_path "${tools}"/gperf/bin + + if [ ! -f "${tools}/gperf/bin/gperf" ]; then + cd "${tools}" + wget --quiet http://ftp.gnu.org/pub/gnu/gperf/gperf-3.1.tar.gz + tar zxf gperf-3.1.tar.gz + cd "${tools}"/gperf-3.1 + ./configure --prefix="${tools}"/gperf; make; make install + cd "${tools}" + rm -rf gperf-3.1; rm gperf-3.1.tar.gz + fi + + command gperf --version +} + +function kconfig-frontends { + add_path "${tools}"/kconfig-frontends/bin + + if [ ! -f "${tools}/kconfig-frontends/bin/kconfig-conf" ]; then + git clone https://bitbucket.org/nuttx/tools.git "${tools}"/nuttx-tools + cd "${tools}"/nuttx-tools/kconfig-frontends + ./configure --prefix="${tools}"/kconfig-frontends \ + --disable-kconfig --disable-nconf --disable-qconf \ + --disable-gconf --disable-mconf --disable-static \ + --disable-shared --disable-L10n + # Avoid "aclocal/automake missing" errors + touch aclocal.m4 Makefile.in + make install + cd "${tools}" + rm -rf nuttx-tools + fi +} + +function mips-gcc-toolchain { + if [ ! -d "${tools}/pinguino-compilers" ]; then + cd "${tools}" + git clone https://github.com/PinguinoIDE/pinguino-compilers + fi + + case ${os} in Darwin) - "${CIPLAT}"/darwin.sh + add_path "${tools}"/pinguino-compilers/macosx/p32/bin + command mips-elf-gcc --version ;; Linux) - "${CIPLAT}"/linux.sh - ;; - manjaro) - to_do "manjaro" - ;; - msys2) - "${CIPLAT}"/msys2.sh - ;; - ubuntu) - "${CIPLAT}"/ubuntu.sh - ;; - *) - to_do "unknown" + add_path "${tools}"/pinguino-compilers/linux64/p32/bin + command p32-gcc --version ;; esac +} + +function python-tools { + # Python User Env + export PIP_USER=yes + export PYTHONUSERBASE=${tools}/pylocal + add_path "${PYTHONUSERBASE}"/bin + + # workaround for Cython issue + # https://github.com/yaml/pyyaml/pull/702#issuecomment-1638930830 + pip3 install "Cython<3.0" + git clone https://github.com/yaml/pyyaml.git && \ + cd pyyaml && \ + git checkout release/5.4.1 && \ + sed -i.bak 's/Cython/Cython<3.0/g' pyproject.toml && \ + python setup.py sdist && \ + pip3 install --pre dist/PyYAML-5.4.1.tar.gz + cd .. + + pip3 install \ + cmake-format \ + CodeChecker \ + cvt2utf \ + cxxfilt \ + esptool==4.5.1 \ + imgtool==1.9.0 \ + kconfiglib \ + pexpect==4.8.0 \ + pyelftools \ + pyserial==3.5 \ + pytest==6.2.5 \ + pytest-json==0.4.0 \ + pytest-ordering==0.6 \ + pytest-repeat==0.9.1 +} + +function riscv-gcc-toolchain { + add_path "${tools}"/riscv-none-elf-gcc/bin + + if [ ! -f "${tools}/riscv-none-elf-gcc/bin/riscv-none-elf-gcc" ]; then + local flavor + case ${os} in + Darwin) + flavor=darwin-x64 + ;; + Linux) + flavor=linux-x64 + ;; + esac + cd "${tools}" + wget --quiet https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v13.2.0-2/xpack-riscv-none-elf-gcc-13.2.0-2-${flavor}.tar.gz + tar zxf xpack-riscv-none-elf-gcc-13.2.0-2-${flavor}.tar.gz + mv xpack-riscv-none-elf-gcc-13.2.0-2 riscv-none-elf-gcc + rm xpack-riscv-none-elf-gcc-13.2.0-2-${flavor}.tar.gz + fi + + command riscv-none-elf-gcc --version +} + +function rust { + mkdir -p "${tools}"/rust/bin + add_path "${tools}"/rust/bin + + if ! type rustc &> /dev/null; then + case ${os} in + Darwin) + brew install rust + ;; + Linux) + # Currently Debian installed rustc doesn't support 2021 edition. + export CARGO_HOME=${tools}/rust + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + ;; + esac + fi + + command rustc --version +} + +function rx-gcc-toolchain { + add_path "${tools}"/renesas-toolchain/rx-elf-gcc/bin + + if [ ! -f "${tools}/renesas-toolchain/rx-elf-gcc/bin/rx-elf-gcc" ]; then + case ${os} in + Linux) + # Download toolchain source code + # RX toolchain is built from source code. Once prebuilt RX toolchain is made available, the below code snippet can be removed. + mkdir -p "${tools}"/renesas-tools/rx/source; cd "${tools}"/renesas-tools/rx/source + wget --quiet https://gcc-renesas.com/downloads/d.php?f=rx/binutils/4.8.4.201803-gnurx/rx_binutils2.24_2018Q3.tar.gz \ + -O rx_binutils2.24_2018Q3.tar.gz + tar zxf rx_binutils2.24_2018Q3.tar.gz + wget --quiet https://gcc-renesas.com/downloads/d.php?f=rx/gcc/4.8.4.201803-gnurx/rx_gcc_4.8.4_2018Q3.tar.gz \ + -O rx_gcc_4.8.4_2018Q3.tar.gz + tar zxf rx_gcc_4.8.4_2018Q3.tar.gz + wget --quiet https://gcc-renesas.com/downloads/d.php?f=rx/newlib/4.8.4.201803-gnurx/rx_newlib2.2.0_2018Q3.tar.gz \ + -O rx_newlib2.2.0_2018Q3.tar.gz + tar zxf rx_newlib2.2.0_2018Q3.tar.gz + + # Install binutils + cd "${tools}"/renesas-tools/rx/source/binutils; chmod +x ./configure ./mkinstalldirs + mkdir -p "${tools}"/renesas-tools/rx/build/binutils; cd "${tools}"/renesas-tools/rx/build/binutils + "${tools}"/renesas-tools/rx/source/binutils/configure --target=rx-elf --prefix="${tools}"/renesas-toolchain/rx-elf-gcc \ + --disable-werror + make; make install - source "${CIWORKSPACE}"/tools/env.sh + # Install gcc + cd "${tools}"/renesas-tools/rx/source/gcc + chmod +x ./contrib/download_prerequisites ./configure ./move-if-change ./libgcc/mkheader.sh + ./contrib/download_prerequisites + sed -i '1s/^/@documentencoding ISO-8859-1\n/' ./gcc/doc/gcc.texi + sed -i 's/@tex/\n&/g' ./gcc/doc/gcc.texi && sed -i 's/@end tex/\n&/g' ./gcc/doc/gcc.texi + mkdir -p "${tools}"/renesas-tools/rx/build/gcc; cd "${tools}"/renesas-tools/rx/build/gcc + "${tools}"/renesas-tools/rx/source/gcc/configure --target=rx-elf --prefix="${tools}"/renesas-toolchain/rx-elf-gcc \ + --disable-shared --disable-multilib --disable-libssp --disable-libstdcxx-pch --disable-werror --enable-lto \ + --enable-gold --with-pkgversion=GCC_Build_1.02 --with-newlib --enable-languages=c + make; make install + + # Install newlib + cd "${tools}"/renesas-tools/rx/source/newlib; chmod +x ./configure + mkdir -p "${tools}"/renesas-tools/rx/build/newlib; cd "${tools}"/renesas-tools/rx/build/newlib + "${tools}"/renesas-tools/rx/source/newlib/configure --target=rx-elf --prefix="${tools}"/renesas-toolchain/rx-elf-gcc + make; make install + rm -rf "${tools}"/renesas-tools/ + ;; + esac + fi + + command rx-elf-gcc --version +} + +function sparc-gcc-toolchain { + add_path "${tools}"/sparc-gaisler-elf-gcc/bin + + if [ ! -f "${tools}/sparc-gaisler-elf-gcc/bin/sparc-gaisler-elf-gcc" ]; then + case ${os} in + Linux) + cd "${tools}" + wget --quiet https://www.gaisler.com/anonftp/bcc2/bin/bcc-2.1.0-gcc-linux64.tar.xz + xz -d bcc-2.1.0-gcc-linux64.tar.xz + tar xf bcc-2.1.0-gcc-linux64.tar + mv bcc-2.1.0-gcc sparc-gaisler-elf-gcc + rm bcc-2.1.0-gcc-linux64.tar + ;; + esac + fi + + command sparc-gaisler-elf-gcc --version +} + +function xtensa-esp32-gcc-toolchain { + add_path "${tools}"/xtensa-esp32-elf/bin + + if [ ! -f "${tools}/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc" ]; then + cd "${tools}" + case ${os} in + Darwin) + wget --quiet https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32-elf-12.2.0_20230208-x86_64-apple-darwin.tar.xz + xz -d xtensa-esp32-elf-12.2.0_20230208-x86_64-apple-darwin.tar.xz + tar xf xtensa-esp32-elf-12.2.0_20230208-x86_64-apple-darwin.tar + rm xtensa-esp32-elf-12.2.0_20230208-x86_64-apple-darwin.tar + ;; + Linux) + wget --quiet https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32-elf-12.2.0_20230208-x86_64-linux-gnu.tar.xz + xz -d xtensa-esp32-elf-12.2.0_20230208-x86_64-linux-gnu.tar.xz + tar xf xtensa-esp32-elf-12.2.0_20230208-x86_64-linux-gnu.tar + rm xtensa-esp32-elf-12.2.0_20230208-x86_64-linux-gnu.tar + ;; + esac + fi + + command xtensa-esp32-elf-gcc --version +} + +function u-boot-tools { + if ! type mkimage &> /dev/null; then + case ${os} in + Darwin) + brew install u-boot-tools + ;; + Linux) + sudo apt-get install -y u-boot-tools + ;; + esac + fi +} + +function wasi-sdk { + add_path "${tools}"/wamrc + + if [ ! -f "${tools}/wasi-sdk/bin/clang" ]; then + cd "${tools}" + mkdir wamrc + + case ${os} in + Darwin) + wget --quiet https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-macos.tar.gz + tar xzf wasi-sdk-19.0-macos.tar.gz + mv wasi-sdk-19.0 wasi-sdk + cd wamrc + wget --quiet https://github.com/bytecodealliance/wasm-micro-runtime/releases/download/WAMR-1.1.2/wamrc-1.1.2-x86_64-macos-latest.tar.gz + tar xzf wamrc-1.1.2-x86_64-macos-latest.tar.gz + ;; + Linux) + wget --quiet https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-linux.tar.gz + tar xzf wasi-sdk-19.0-linux.tar.gz + mv wasi-sdk-19.0 wasi-sdk + cd wamrc + wget --quiet https://github.com/bytecodealliance/wasm-micro-runtime/releases/download/WAMR-1.1.2/wamrc-1.1.2-x86_64-ubuntu-20.04.tar.gz + tar xzf wamrc-1.1.2-x86_64-ubuntu-20.04.tar.gz + ;; + esac + fi + + export WASI_SDK_PATH="${tools}/wasi-sdk" + + command ${WASI_SDK_PATH}/bin/clang --version + command wamrc --version } function usage { @@ -101,14 +516,38 @@ function usage { echo " -s setup repos" echo " -c enable ccache" echo " -* support all options in testbuild.sh" - echo " -h will show this help text and terminate" + echo " -h will show this help test and terminate" echo " <testlist> select testlist file" echo "" exit 1 } function enable_ccache { - export CCACHE_DIR="${CIWORKSPACE}"/tools/ccache + export CCACHE_DIR="${tools}"/ccache +} + +function setup_links { + mkdir -p "${tools}"/ccache/bin/ + ln -sf "$(which ccache)" "${tools}"/ccache/bin/aarch64-none-elf-gcc + ln -sf "$(which ccache)" "${tools}"/ccache/bin/aarch64-none-elf-g++ + ln -sf "$(which ccache)" "${tools}"/ccache/bin/arm-none-eabi-gcc + ln -sf "$(which ccache)" "${tools}"/ccache/bin/arm-none-eabi-g++ + ln -sf "$(which ccache)" "${tools}"/ccache/bin/avr-gcc + ln -sf "$(which ccache)" "${tools}"/ccache/bin/avr-g++ + ln -sf "$(which ccache)" "${tools}"/ccache/bin/cc + ln -sf "$(which ccache)" "${tools}"/ccache/bin/c++ + ln -sf "$(which ccache)" "${tools}"/ccache/bin/clang + ln -sf "$(which ccache)" "${tools}"/ccache/bin/clang++ + ln -sf "$(which ccache)" "${tools}"/ccache/bin/gcc + ln -sf "$(which ccache)" "${tools}"/ccache/bin/g++ + ln -sf "$(which ccache)" "${tools}"/ccache/bin/p32-gcc + ln -sf "$(which ccache)" "${tools}"/ccache/bin/riscv64-unknown-elf-gcc + ln -sf "$(which ccache)" "${tools}"/ccache/bin/riscv64-unknown-elf-g++ + ln -sf "$(which ccache)" "${tools}"/ccache/bin/sparc-gaisler-elf-gcc + ln -sf "$(which ccache)" "${tools}"/ccache/bin/sparc-gaisler-elf-g++ + ln -sf "$(which ccache)" "${tools}"/ccache/bin/x86_64-elf-gcc + ln -sf "$(which ccache)" "${tools}"/ccache/bin/x86_64-elf-g++ + ln -sf "$(which ccache)" "${tools}"/ccache/bin/xtensa-esp32-elf-gcc } function setup_repos { @@ -131,13 +570,49 @@ function setup_repos { popd } +function install_tools { + mkdir -p "${tools}" + +case ${os} in + Darwin) + install="arm-gcc-toolchain arm64-gcc-toolchain avr-gcc-toolchain binutils bloaty elf-toolchain gen-romfs gperf kconfig-frontends mips-gcc-toolchain python-tools riscv-gcc-toolchain rust xtensa-esp32-gcc-toolchain u-boot-tools util-linux wasi-sdk c-cache" + mkdir -p "${tools}"/homebrew + export HOMEBREW_CACHE=${tools}/homebrew + # https://github.com/apache/arrow/issues/15025 + rm -f /usr/local/bin/2to3* || : + rm -f /usr/local/bin/idle3* || : + rm -f /usr/local/bin/pydoc3* || : + rm -f /usr/local/bin/python3* || : + rm -f /usr/local/bin/python3-config || : + # same for openssl + rm -f /usr/local/bin/openssl || : + ;; + Linux) + install="arm-gcc-toolchain binutils gen-romfs gperf kconfig-frontends python-tools riscv-gcc-toolchain c-cache" + ;; +esac + + pushd . + for func in ${install}; do + ${func} + done + popd + + setup_links + echo PATH="${EXTRA_PATH}"/"${PATH}" > "${tools}"/env.sh +} + function run_builds { local ncpus - if [ "X$osname" == "XDarwin" ]; then - ncpus=$(sysctl -n hw.ncpu) - else - ncpus=$(grep -c ^processor /proc/cpuinfo) - fi + + case ${os} in + Darwin) + ncpus=$(sysctl -n hw.ncpu) + ;; + Linux) + ncpus=$(grep -c ^processor /proc/cpuinfo) + ;; + esac options+="-j ${ncpus}" @@ -146,7 +621,6 @@ function run_builds { done if [ -d "${CCACHE_DIR}" ]; then - # Print a summary of configuration and statistics counters ccache -s fi }