From 95dc61843648ecfdf808eafe96ea52f25db0aa7a Mon Sep 17 00:00:00 2001 From: Joakim Roubert Date: Fri, 1 Dec 2023 17:04:53 +0100 Subject: [PATCH] Improve build pipeline and documentation text - Use super-linter environment file to have better consistency between GitHub CI pipeline and the instructions in LINT.md - Use correct wording for ACAP applications - Add comments to linter configuration files Change-Id: I70890072c92123a3cd0a17fbb75bc8894921570e Signed-off-by: Joakim Roubert --- .github/super-linter.env | 8 ++++++++ .github/workflows/super-linter.yml | 14 ++++--------- .markdownlint.yaml | 2 ++ CODE_OF_CONDUCT.md | 2 +- CONTRIBUTING.md | 2 +- LINT.md | 14 +++++-------- README.md | 32 ++++++++++++++++-------------- renovate.json | 22 ++++---------------- 8 files changed, 42 insertions(+), 54 deletions(-) create mode 100644 .github/super-linter.env diff --git a/.github/super-linter.env b/.github/super-linter.env new file mode 100644 index 0000000..e92b53a --- /dev/null +++ b/.github/super-linter.env @@ -0,0 +1,8 @@ +LINTER_RULES_PATH=/ +VALIDATE_ALL_CODEBASE=true +IGNORE_GITIGNORED_FILES=true +VALIDATE_CLANG_FORMAT=true +VALIDATE_DOCKERFILE_HADOLINT=true +VALIDATE_JSON=true +VALIDATE_MARKDOWN=true +VALIDATE_YAML=true diff --git a/.github/workflows/super-linter.yml b/.github/workflows/super-linter.yml index 48ff7ba..2c0c4ea 100644 --- a/.github/workflows/super-linter.yml +++ b/.github/workflows/super-linter.yml @@ -13,17 +13,11 @@ jobs: with: fetch-depth: 0 + - name: Setup Environment + run: cat .github/super-linter.env >> "$GITHUB_ENV" + - name: Lint Code Base - uses: github/super-linter/slim@v5 + uses: super-linter/super-linter/slim@v5 env: - LINTER_RULES_PATH: / - VALIDATE_ALL_CODEBASE: false DEFAULT_BRANCH: main GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }} - IGNORE_GITIGNORED_FILES: true - VALIDATE_CLANG_FORMAT: true - VALIDATE_DOCKERFILE_HADOLINT: true - VALIDATE_JSON: true - VALIDATE_MARKDOWN: true - VALIDATE_YAML: true diff --git a/.markdownlint.yaml b/.markdownlint.yaml index 9c37cb9..22b68f9 100644 --- a/.markdownlint.yaml +++ b/.markdownlint.yaml @@ -1,4 +1,6 @@ --- +# Line length MD013: line_length: 100 +# First line in a file should be a top-level heading MD041: false diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 2a920a8..d70eba5 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -55,7 +55,7 @@ further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at oss-conduct@axis.com. All +reported by contacting the project team at . All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 50178c7..094f8d7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,7 +23,7 @@ git clone https://github.com//modbus-acap.git ### Create your feature branch ```sh -git checkout -b +git switch -c ``` ### Lint code after adding changes diff --git a/LINT.md b/LINT.md index 36ece70..e2bc76c 100644 --- a/LINT.md +++ b/LINT.md @@ -1,7 +1,7 @@ # Lint of code base This repo uses the -[super-linter](https://github.com/github/super-linter) +[super-linter](https://github.com/super-linter/super-linter) to check the code base syntax and format on different file types. ## Linters in GitHub Action @@ -21,13 +21,8 @@ which is possible since it is available as a container. Using docker run --rm \ -v "$PWD":/tmp/lint \ -e RUN_LOCAL=true \ - -e LINTER_RULES_PATH=/ \ - -e VALIDATE_CLANG_FORMAT=true \ - -e VALIDATE_DOCKERFILE_HADOLINT=true \ - -e VALIDATE_JSON=true \ - -e VALIDATE_MARKDOWN=true \ - -e VALIDATE_YAML=true \ - github/super-linter:slim-v4 + --env-file .github/super-linter.env \ + ghcr.io/super-linter/super-linter:slim-v5 ``` ## Run super-linter interactively @@ -39,8 +34,9 @@ with Docker: docker run -it --rm \ -v "$PWD":/tmp/lint \ -w /tmp/lint \ + --env-file .github/super-linter.env \ --entrypoint /bin/bash \ - github/super-linter:slim-v4 + ghcr.io/super-linter/super-linter:slim-v5 ``` Then from the container terminal, the following commands can lint the the code diff --git a/README.md b/README.md index 6cf7943..ae1e874 100644 --- a/README.md +++ b/README.md @@ -11,13 +11,14 @@ application that exports events from [AXIS Object Analytics](https://www.axis.com/products/axis-object-analytics) (AOA) over [Modbus](https://en.wikipedia.org/wiki/Modbus) using -[libmodbus](https://libmodbus.org/). The ACAP can be run in either server or -client mode, meaning two Axis devices can be used to showcase it. +[libmodbus](https://libmodbus.org/). The application can be run in either server +or client mode, meaning two Axis devices can be used to showcase it. ![Architectural overview](images/acap_architecture.svg) -*The purpose of this repo is to serve as boilerplate code and keep things -simple, hence it uses basic Modbus/TCP without TLS and such.* +> [!NOTE] +> The purpose of this repo is to serve as boilerplate code and keep +> things simple, hence it uses basic Modbus/TCP without TLS and such. ## Build @@ -63,8 +64,8 @@ DOCKER_BUILDKIT=1 docker build --build-arg ARCH=aarch64 -o type=local,dest=. . ### Manual installation and configuration -Upload the ACAP file (the file with the `.eap` extension for the camera's -architecture) through the camera's web UI: *Apps->Add app* +Upload the ACAP application file (the file with the `.eap` extension for the +camera's architecture) through the camera's web UI: *Apps->Add app* The parameter settings are found in the three vertical dots menu: @@ -72,7 +73,7 @@ The parameter settings are found in the three vertical dots menu: ![Web UI Screenshot](images/web_ui_param_settings.png) -Select if the ACAP should run in Server or Client mode and what AOA scenario's +Select if the application should run in Server or Client mode and what AOA scenario's events it should subscribe to (default: Scenario 1). If you run in Client mode, also make sure you have set the right hostname/IP address for the Modbus server you want to send the events to. @@ -81,8 +82,8 @@ server you want to send the events to. Use the camera's [applications/upload.cgi](https://www.axis.com/vapix-library/subjects/t10102231/section/t10036126/display?section=t10036126-t10010609) -to upload the ACAP file (the file with the `.eap` extension for the camera's -architecture): +to upload the ACAP application file (the file with the `.eap` extension for the +camera's architecture): ```sh curl -k --anyauth -u root: \ @@ -101,7 +102,7 @@ curl -k --anyauth -u root: \ Use the camera's [param.cgi](https://www.axis.com/vapix-library/subjects/t10175981/section/t10036014/display) -to list and set the ACAP's parameters: +to list and set the application's parameters: The call @@ -127,8 +128,8 @@ curl -k --anyauth -u root: \ ## Usage -The ACAP can be run in either client mode or server mode (default), configured -with the application parameter `Mode`: +The application can be run in either client mode or server mode (default), +configured with the application parameter `Mode`: In client mode, it will subscribe to [AXIS Object Analytics](https://www.axis.com/products/axis-object-analytics) @@ -140,9 +141,10 @@ parameter `Server`. In server mode, it will listen for incoming TCP requests and print incoming AOA status updates to the application log. -***NB!** The default Modbus/TCP port 502 requires running as a privileged user. -In order to run as a non-privileged user, this ACAP only allows ports in the -non-privileged range 1024–65535.* +> [!IMPORTANT] +> The default Modbus/TCP port 502 requires running as a privileged user. +> In order to run as a non-privileged user, this ACAP only allows ports in +> the non-privileged range 1024–65535. ## License diff --git a/renovate.json b/renovate.json index 996cf27..5db72dd 100644 --- a/renovate.json +++ b/renovate.json @@ -1,20 +1,6 @@ { - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": [ - "config:base" - ], - "labels": ["dependencies"], - "packageRules": [ - { - "updateTypes": ["minor", "patch", "pin", "digest"], - "automerge": true - } - ], - "rebaseWhen": "behind-base-branch", - "vulnerabilityAlerts": { - "labels": ["security"] - }, - "stabilityDays": 3, - "prCreation": "not-pending", - "dependencyDashboard": false + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:recommended" + ] }