From 882bca30000d19ff9bcc34d990ac602ba3c3e9d7 Mon Sep 17 00:00:00 2001 From: Dhruva Gole <41233856+DhruvaG2000@users.noreply.github.com> Date: Sat, 24 Sep 2022 10:42:01 +0530 Subject: [PATCH 1/2] workflow: setup basic workflow for checking PRs * Sets up a workflow that will take care of code formatting in PRs * Create license_config.yml * Create license_check.yml taken from zephyrproject upstream Signed-off-by: Dhruva Gole --- .github/license_config.yml | 16 +++++++++++++++ .github/workflows/checkpatch.yml | 29 ++++++++++++++++++++++++++ .github/workflows/license_check.yml | 32 +++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 .github/license_config.yml create mode 100644 .github/workflows/checkpatch.yml create mode 100644 .github/workflows/license_check.yml diff --git a/.github/license_config.yml b/.github/license_config.yml new file mode 100644 index 000000000..b5bd58423 --- /dev/null +++ b/.github/license_config.yml @@ -0,0 +1,16 @@ +license: + main: apache-2.0 + report_missing: true + category: Permissive +copyright: + check: true +exclude: + extensions: + - yml + - yaml + - html + - rst + - conf + - cfg + langs: + - HTML diff --git a/.github/workflows/checkpatch.yml b/.github/workflows/checkpatch.yml new file mode 100644 index 000000000..f2a407a14 --- /dev/null +++ b/.github/workflows/checkpatch.yml @@ -0,0 +1,29 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the "main" branch + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + - name: checkpatch.pl PR review + uses: webispy/checkpatch-action@v8 + diff --git a/.github/workflows/license_check.yml b/.github/workflows/license_check.yml new file mode 100644 index 000000000..bce1fb666 --- /dev/null +++ b/.github/workflows/license_check.yml @@ -0,0 +1,32 @@ +name: Scancode + +on: [pull_request] + +jobs: + scancode_job: + runs-on: ubuntu-20.04 + name: Scan code for licenses + steps: + - name: Checkout the code + uses: actions/checkout@v1 + - name: Scan the code + id: scancode + uses: zephyrproject-rtos/action_scancode@v4 + with: + directory-to-scan: 'scan/' + - name: Artifact Upload + uses: actions/upload-artifact@v1 + with: + name: scancode + path: ./artifacts + + - name: Verify + run: | + if [ -s ./artifacts/report.txt ]; then + report=$(cat ./artifacts/report.txt) + report="${report//'%'/'%25'}" + report="${report//$'\n'/'%0A'}" + report="${report//$'\r'/'%0D'}" + echo "::error file=./artifacts/report.txt::$report" + exit 1 + fi From cc6ad9b2957f9b6cf75766767a51735336b6eee1 Mon Sep 17 00:00:00 2001 From: Dhruva Gole Date: Sat, 24 Sep 2022 21:06:30 +0530 Subject: [PATCH 2/2] test commit for checkpatch commit is described in this section where you describe all the code changes you have made but without exceeding line lengths, as you can see this will not be caught as a violation as well Signed-off-by: Dhruva Gole --- cores/arduino/main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cores/arduino/main.cpp b/cores/arduino/main.cpp index 34b77f5c2..062092471 100644 --- a/cores/arduino/main.cpp +++ b/cores/arduino/main.cpp @@ -6,7 +6,13 @@ #include "Arduino.h" +void func() { + printf("DO NOT MERGE!\n"); + return FALSE; +} + int main(void) { + func(); setup(); for (;;) { @@ -14,4 +20,4 @@ int main(void) { } return 0; -} \ No newline at end of file +}