diff --git a/.dictionary.txt b/.dictionary.txt new file mode 100644 index 0000000..9ac17d5 --- /dev/null +++ b/.dictionary.txt @@ -0,0 +1 @@ +crate diff --git a/.dockerignore b/.dockerignore index df5e310..cdb1a82 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,4 +3,4 @@ .github .gitattributes READMETEMPLATE.md -README.md \ No newline at end of file +README.md diff --git a/.github/workflows/cancel_dupes.yml b/.github/workflows/cancel_dupes.yml index d5e6462..23cd838 100644 --- a/.github/workflows/cancel_dupes.yml +++ b/.github/workflows/cancel_dupes.yml @@ -1,15 +1,14 @@ --- - # Cancels duplicate github actions when superseded name: Cancelling Duplicates on: workflow_run: workflows: - - 'Pull Request' - - 'Deploy' - - 'Linting (Non-Image)' - types: ['requested'] + - "Pull Request" + - "Deploy" + - "Linting (Non-Image)" + types: ["requested"] jobs: cancel-duplicate-workflow-runs: diff --git a/.github/workflows/markdownlint.yml b/.github/workflows/markdownlint.yml index 8a616ba..9e70283 100644 --- a/.github/workflows/markdownlint.yml +++ b/.github/workflows/markdownlint.yml @@ -7,8 +7,8 @@ on: - main # only run these if markdown files are updated paths: - - '**.md' - - '**.MD' + - "**.md" + - "**.MD" jobs: markdownlint: diff --git a/.github/workflows/on_pr.yml b/.github/workflows/on_pr.yml index 996a494..399d57b 100644 --- a/.github/workflows/on_pr.yml +++ b/.github/workflows/on_pr.yml @@ -11,16 +11,15 @@ on: - main # Don't trigger if it's just a documentation update paths-ignore: - - '**.md' - - '**.MD' - - '**.yml' - - 'LICENSE' - - '.gitattributes' - - '.gitignore' - - '.dockerignore' + - "**.md" + - "**.MD" + - "**.yml" + - "LICENSE" + - ".gitattributes" + - ".gitignore" + - ".dockerignore" jobs: - shellcheck: name: Run shellcheck against shell scripts runs-on: ubuntu-latest @@ -56,7 +55,6 @@ jobs: - linux/arm/v7 - linux/i386 steps: - # Check out our code - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/pre-commit-updates.yaml b/.github/workflows/pre-commit-updates.yaml new file mode 100644 index 0000000..f075972 --- /dev/null +++ b/.github/workflows/pre-commit-updates.yaml @@ -0,0 +1,23 @@ +name: Update pre-commit hooks + +on: + workflow_dispatch: + schedule: + - cron: 0 0 * * * + +jobs: + update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.0 + with: + fetch-depth: 0 + - uses: vrslev/pre-commit-autoupdate@v1.0.0 + - uses: peter-evans/create-pull-request@v5 + with: + branch: pre-commit-autoupdate + title: "chore(deps): Update pre-commit hooks" + commit-message: "chore(deps): Update pre-commit hooks" + body: Update pre-commit hooks + labels: dependencies + delete-branch: True diff --git a/.github/workflows/yamllint.yml b/.github/workflows/yamllint.yml index 2fff033..d3b07f9 100644 --- a/.github/workflows/yamllint.yml +++ b/.github/workflows/yamllint.yml @@ -7,7 +7,7 @@ on: - main # only run when yaml files are updated paths: - - '**.yml' + - "**.yml" jobs: yamllint: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..34ef282 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,65 @@ +repos: + # lint yaml, line and whitespace + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + - id: requirements-txt-fixer + - id: mixed-line-ending + - id: check-executables-have-shebangs + - id: check-shebang-scripts-are-executable + + # lint the dockerfiles + - repo: https://github.com/hadolint/hadolint + rev: v2.12.1-beta + hooks: + - id: hadolint + + # prettier + - repo: https://github.com/pre-commit/mirrors-prettier + rev: "v3.0.3" # Use the sha / tag you want to point at + hooks: + - id: prettier + types_or: [file, bash, sh, javascript, jsx, ts, tsx] + additional_dependencies: + - prettier@2.5.1 + exclude: ^(Dockerfile*) + + - repo: https://github.com/codespell-project/codespell.git + rev: "v2.2.5" # Use the sha / tag you want to point at + hooks: + - id: codespell + types: [text] + args: [--ignore-words=.dictionary.txt] + exclude: ^(Dockerfile*) + + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.9.0.6 + hooks: + - id: shellcheck + + - repo: https://github.com/sirosen/check-jsonschema + rev: 0.27.0 + hooks: + - id: check-github-actions + - id: check-github-workflows + + - repo: https://github.com/doublify/pre-commit-rust + rev: v1.0 + hooks: + - id: fmt + - id: cargo-check + + # lint python formatting + - repo: https://github.com/psf/black + rev: 23.9.1 + hooks: + - id: black + + - repo: https://github.com/pycqa/flake8 + rev: "6.1.0" # pick a git hash / tag to point to + hooks: + - id: flake8 + args: ["--extend-ignore=W503,W504,E501"] diff --git a/Dockerfile b/Dockerfile index c803ce3..f393aa1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,7 @@ FROM ghcr.io/sdr-enthusiasts/docker-baseimage:base SHELL ["/bin/bash", "-o", "pipefail", "-c"] +# hadolint ignore=DL3008,SC2086,SC2039,SC2068 RUN set -x && \ TEMP_PACKAGES=() && \ KEPT_PACKAGES=() && \ diff --git a/README.md b/README.md index 4086407..6aff2c3 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,14 @@ More information on [beast-splitter][1] is available at the [official repository ## Environment Variables -| Variable | Controls which `beast-splitter` option | Description | Default | -| -------- | -------------------------------------- | ----------- | ------- | -| `BEAST_SPLITTER_SERIAL` | `--serial` | Read from given serial device, set to `OFF` to disable serial | `/dev/beast` | -| `BEAST_SPLITTER_NET` | `--net` | Read from given network host:port | Unset | -| `BEAST_SPLITTER_BAUD` | `--fixed-baud` | Set a fixed baud rate, or 0 for autobauding | `0` | -| `BEAST_SPLITTER_LISTEN` | `--listen` | Specify a `[host:]port[:settings]` to listen on | `0.0.0.0:30005:R` | -| `BEAST_SPLITTER_CONNECT` | `--connect` | Specify a `host:port[:settings]` to connect to | Unset | -| `BEAST_SPLITTER_FORCE` | `--force` | Specify settings to force on or off when configuring the Beast | Unset | +| Variable | Controls which `beast-splitter` option | Description | Default | +| ------------------------ | -------------------------------------- | -------------------------------------------------------------- | ----------------- | +| `BEAST_SPLITTER_SERIAL` | `--serial` | Read from given serial device, set to `OFF` to disable serial | `/dev/beast` | +| `BEAST_SPLITTER_NET` | `--net` | Read from given network host:port | Unset | +| `BEAST_SPLITTER_BAUD` | `--fixed-baud` | Set a fixed baud rate, or 0 for autobauding | `0` | +| `BEAST_SPLITTER_LISTEN` | `--listen` | Specify a `[host:]port[:settings]` to listen on | `0.0.0.0:30005:R` | +| `BEAST_SPLITTER_CONNECT` | `--connect` | Specify a `host:port[:settings]` to connect to | Unset | +| `BEAST_SPLITTER_FORCE` | `--force` | Specify settings to force on or off when configuring the Beast | Unset | ## Example `docker run` @@ -31,15 +31,15 @@ docker run \ ## Example `docker-compose.yml` service ```yaml - beast-splitter: - image: ghcr.io/sdr-enthusiasts/docker-beast-splitter:latest - tty: true - container_name: beast-splitter - restart: always - devices: - - /dev/beast:/dev/beast - ports: - - 30005:30005 +beast-splitter: + image: ghcr.io/sdr-enthusiasts/docker-beast-splitter:latest + tty: true + container_name: beast-splitter + restart: always + devices: + - /dev/beast:/dev/beast + ports: + - 30005:30005 ``` ## Testing the container