-
Notifications
You must be signed in to change notification settings - Fork 5
issue_58 added sonarcloud workflow #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AndrasZiegler
wants to merge
1
commit into
master
Choose a base branch
from
58-feature-add-sonarcloud-implementation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,75 +1,79 @@ | ||
| name: 02-Build-Firmware | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| pull_request: | ||
| pull_request: | ||
| branches: | ||
| - master | ||
| workflow_dispatch: | ||
| - master | ||
| workflow_dispatch: | ||
| env: | ||
| ARCH: x86_64 | ||
| POST_BUILD_EXE: "/opt/commander-cli/commander-cli" | ||
| ARM_GCC_DIR: "/opt/gcc-arm-none-eabi/" | ||
| ARM_GCC_URL: "https://developer.arm.com/-/media/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz" | ||
| ARCH: x86_64 | ||
| POST_BUILD_EXE: "/opt/commander-cli/commander-cli" | ||
| ARM_GCC_DIR: "/opt/gcc-arm-none-eabi/" | ||
| ARM_GCC_URL: "https://developer.arm.com/-/media/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz" | ||
| jobs: | ||
| FW_build: | ||
| runs-on: ubuntu-22.04 | ||
| steps: | ||
| - name: Trigger | ||
| run: echo "Triggered by ${{ github.event_name }} event" | ||
| - name: Checkout | ||
| uses: actions/checkout@v4.2.2 | ||
| - name: Install Dependencies | ||
| run: | | ||
| sudo apt-get update && \ | ||
| sudo apt-get install --no-install-recommends -y \ | ||
| clang \ | ||
| clang-tidy \ | ||
| cppcheck \ | ||
| git \ | ||
| build-essential \ | ||
| curl \ | ||
| jq \ | ||
| python3-dev \ | ||
| python3-pip \ | ||
| ninja-build \ | ||
| make \ | ||
| wget \ | ||
| zip \ | ||
| unzip \ | ||
| libgl1 \ | ||
| libglib2.0-0 \ | ||
| libpcre2-dev | ||
| - name: CMake 3.25.4 | ||
| run: | | ||
| wget https://github.com/Kitware/CMake/releases/download/v3.25.3/cmake-3.25.3-linux-${{ env.ARCH }}.sh \ | ||
| -q -O /tmp/cmake-install.sh \ | ||
| && chmod u+x /tmp/cmake-install.sh \ | ||
| && mkdir /opt/cmake-3.25.3 \ | ||
| && /tmp/cmake-install.sh --skip-license --prefix=/opt/cmake-3.25.3 \ | ||
| && rm /tmp/cmake-install.sh \ | ||
| && ln -sf /opt/cmake-3.25.3/bin/* /usr/local/bin | ||
| - name: Install GNU Arm Embedded Toolchain | ||
| run: | | ||
| cd /tmp/ \ | ||
| && wget ${{ env.ARM_GCC_URL }} \ | ||
| && tar -xf arm-gnu-toolchain-12.2.rel1-${{ env.ARCH }}-arm-none-eabi.tar.xz \ | ||
| && mv arm-gnu-toolchain-12.2.rel1-${{ env.ARCH }}-arm-none-eabi /opt/gcc-arm-none-eabi \ | ||
| && rm arm-gnu-toolchain-12.2.rel-${{ env.ARCH }}-arm-none-eabi -rf | ||
| - name: Simplicity Commander | ||
| run: | | ||
| wget https://www.silabs.com/documents/login/software/SimplicityCommander-Linux.zip \ | ||
| && unzip SimplicityCommander-Linux.zip \ | ||
| && tar -xf SimplicityCommander-Linux/Commander-cli_linux_${{ env.ARCH }}_*.tar.bz \ | ||
| && mv commander-cli /opt/commander-cli \ | ||
| && rm -rf SimplicityCommander-Linux.zip SimplicityCommander-Linux | ||
| - name: Build the project | ||
| run: | | ||
| cd ${{ github.workspace}} \ | ||
| && make all | ||
| - name: Upload Build Artifacts | ||
| uses: actions/upload-artifact@v4.4.3 | ||
| with: | ||
| name: build-artifacts-${{ github.run_number }} | ||
| path: | | ||
| locator_ncp/build/locator_ncp.s37 | ||
| locator_host/build/locator_host.s37 | ||
| retention-days: 90 | ||
| FW_build: | ||
| runs-on: ubuntu-22.04 | ||
| steps: | ||
| - name: Trigger | ||
| run: echo "Triggered by ${{ github.event_name }} event" | ||
| - name: Checkout | ||
| uses: actions/checkout@v4.2.2 | ||
| - name: Install Dependencies | ||
| run: | | ||
| sudo apt-get update && \ | ||
| sudo apt-get install --no-install-recommends -y \ | ||
| clang \ | ||
| clang-tidy \ | ||
| cppcheck \ | ||
| git \ | ||
| build-essential \ | ||
| curl \ | ||
| jq \ | ||
| python3-dev \ | ||
| python3-pip \ | ||
| ninja-build \ | ||
| make \ | ||
| wget \ | ||
| zip \ | ||
| unzip \ | ||
| libgl1 \ | ||
| libglib2.0-0 \ | ||
| libpcre2-dev | ||
| - name: CMake 3.25.4 | ||
| run: | | ||
| wget https://github.com/Kitware/CMake/releases/download/v3.25.3/cmake-3.25.3-linux-${{ env.ARCH }}.sh \ | ||
| -q -O /tmp/cmake-install.sh \ | ||
| && chmod u+x /tmp/cmake-install.sh \ | ||
| && mkdir /opt/cmake-3.25.3 \ | ||
| && /tmp/cmake-install.sh --skip-license --prefix=/opt/cmake-3.25.3 \ | ||
| && rm /tmp/cmake-install.sh \ | ||
| && ln -sf /opt/cmake-3.25.3/bin/* /usr/local/bin | ||
| - name: Install GNU Arm Embedded Toolchain | ||
| run: | | ||
| cd /tmp/ \ | ||
| && wget ${{ env.ARM_GCC_URL }} \ | ||
| && tar -xf arm-gnu-toolchain-12.2.rel1-${{ env.ARCH }}-arm-none-eabi.tar.xz \ | ||
| && mv arm-gnu-toolchain-12.2.rel1-${{ env.ARCH }}-arm-none-eabi /opt/gcc-arm-none-eabi \ | ||
| && rm arm-gnu-toolchain-12.2.rel-${{ env.ARCH }}-arm-none-eabi -rf | ||
| - name: Simplicity Commander | ||
| run: | | ||
| wget https://www.silabs.com/documents/login/software/SimplicityCommander-Linux.zip \ | ||
| && unzip SimplicityCommander-Linux.zip \ | ||
| && tar -xf SimplicityCommander-Linux/Commander-cli_linux_${{ env.ARCH }}_*.tar.bz \ | ||
| && mv commander-cli /opt/commander-cli \ | ||
| && rm -rf SimplicityCommander-Linux.zip SimplicityCommander-Linux | ||
| - name: Build the project | ||
| run: | | ||
| cd ${{ github.workspace}} \ | ||
| && make all | ||
| - name: Upload Build Artifacts | ||
| uses: actions/upload-artifact@v4.4.3 | ||
| with: | ||
| name: build-artifacts-${{ github.run_number }} | ||
| path: | | ||
| locator_ncp/build/locator_ncp.s37 | ||
| locator_host/build/locator_host.s37 | ||
| retention-days: 1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,22 @@ | ||
| name: 04-TruffleHog-Security-Scan | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - master | ||
| workflow_dispatch: | ||
| pull_request: | ||
| branches: | ||
| - master | ||
| workflow_dispatch: | ||
| jobs: | ||
| trufflehog_scan: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Secret Scanning | ||
| uses: trufflesecurity/trufflehog@v3.84.0 | ||
| with: | ||
| extra_args: --only-verified | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Secret Scanning | ||
| uses: trufflesecurity/trufflehog@v3.84.0 | ||
| with: | ||
| extra_args: --only-verified |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI about 1 month ago
To fix the problem, explicitly declare restricted
GITHUB_TOKENpermissions in the workflow. The minimal safe default for a build-and-artifact-upload job that only checks out code iscontents: read. This can be set either at the workflow root (affecting all jobs) or at the job level. Since there is only one job (FW_build), either is acceptable; using a top-levelpermissions:block is simple and clear.Concretely, in
.github/workflows/02-Build-Firmware.yml, add apermissions:section near the top of the file (e.g., afteron:or beforeenv:) specifyingcontents: read. No steps rely on write access to issues, PRs, or contents, and artifact upload does not need repository write scopes, so we do not grant any additional permissions. No imports or extra methods are required; it is purely a YAML configuration change.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed it.