Skip to content

Commit

Permalink
github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
fredclausen committed Dec 9, 2023
1 parent f6c3f86 commit 60a8994
Show file tree
Hide file tree
Showing 8 changed files with 216 additions and 26 deletions.
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ["https://paypal.me/fredclausen"]
16 changes: 16 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2

updates:
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: weekly
assignees:
- "fredclausen"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: weekly
assignees:
- "fredclausen"
19 changes: 19 additions & 0 deletions .github/workflows/cancel_dupes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Cancelling Duplicates
on:
workflow_run:
workflows:
- "Deploy to Docker Hub"
- "Linting"
types: ["requested"]

jobs:
cancel-duplicate-workflow-runs:
name: "Cancel duplicate workflow runs"
runs-on: ubuntu-latest
steps:
- uses: potiuk/cancel-workflow-runs@master
name: "Cancel duplicate workflow runs"
with:
cancelMode: allDuplicates
token: ${{ secrets.GITHUB_TOKEN }}
sourceRunId: ${{ github.event.workflow_run.id }}
68 changes: 68 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Deploy

on:
# Enable manual running of action if necessary
workflow_dispatch:
inputs:
reason:
required: true
description: "Reason for running this workflow"
use_test_image:
required: false
type: boolean
description: "Use base image testpr"
default: false

# Build and deploy the image on pushes to main branch
push:
branches:
- main
paths:
- "Dockerfile"
- "rootfs/**"

# Build and deploy the image nightly (to ensure we pick up any security updates)
# schedule:
# - cron: "0 14 * * *"
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
workflow-dispatch:
name: Triggered via Workflow Dispatch?
# only run this step if workflow dispatch triggered
# log the reason the workflow dispatch was triggered
if: |
github.event_name == 'workflow_dispatch' &&
github.event.inputs.reason != ''
runs-on: ubuntu-latest
steps:
- name: Log dispatch reason
env:
INPUTS_REASON: ${{ github.event.inputs.reason }}
INPUTS_USE_TEST_IMAGE: ${{ github.event.inputs.use_test_image }}
run: |
echo "Workflow dispatch reason: $INPUTS_REASON"
echo "Use test image: $INPUTS_USE_TEST_IMAGE"
build_and_push:
name: Image Build & Push
uses: sdr-enthusiasts/common-github-workflows/.github/workflows/build_and_push_image.yml@main
with:
push_enabled: true
push_destinations: ghcr.io
ghcr_repo_owner: ${{ github.repository_owner }}
ghcr_repo: ${{ github.repository }}
platform_linux_arm32v6_enabled: false
platform_linux_i386_enabled: false
get_version_method: git_commit_hash_short
# set build_latest to true if github.event.inputs.use_test_image is false
build_latest: ${{ github.event.inputs.use_test_image == 'false' || github.event.inputs.use_test_image == '' }}
build_baseimage_test: ${{ github.event.inputs.use_test_image == 'true' }}
# only build the entire stack if we are not using the test image
build_version_specific: false
build_platform_specific: ${{ github.event.inputs.use_test_image == 'false' || github.event.inputs.use_test_image == ''}}
build_nohealthcheck: false
build_baseimage_url: :acars-decoder/:acars-decoder-test-pr
secrets:
ghcr_token: ${{ secrets.GITHUB_TOKEN }}
51 changes: 51 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Linting

on:
pull_request:
branches:
- main

jobs:
# eslint:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v1
# - uses: actions/setup-node@v1
# with:
# node-version: '13.x'
# - name: Run yarn
# run: yarn
# - name: Run eslint
# run: yarn run eslint . --ext .js

shellcheck:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Pull koalaman/shellcheck:stable Image
run: docker pull koalaman/shellcheck:stable
- name: Run Shellcheck against shell scripts
run: |
find . -type f -exec grep -m1 -l -E '^#!.*sh.*' {} \; | grep -v -E '\/(.git\/|\S+.MD|\S+.md|retired_scripts\/|acarshub-typescript\/node_modules\/)'
docker run --rm -i -v "$PWD:/mnt" koalaman/shellcheck:stable $(find . -type f -exec grep -m1 -l -E '^#!.*sh.*' {} \; | grep -v -E '\/(.git\/|\S+.MD|\S+.md|retired_scripts\/|acarshub-typescript\/node_modules\/)')
# docker run --rm -i -v "$PWD:/mnt" koalaman/shellcheck:stable $(find . -type f -exec grep -m1 -l -E '^#!.*execline.*' {} \; | grep -v '/.git/')
hadolint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Pull hadolint/hadolint:latest Image
run: docker pull hadolint/hadolint:latest
- name: Run hadolint against Dockerfiles
run: docker run --rm -i -v "$PWD":/workdir --workdir /workdir --entrypoint hadolint hadolint/hadolint --ignore DL3003 --ignore DL3006 --ignore DL3010 --ignore DL4001 --ignore DL3007 --ignore DL3008 --ignore SC2068 --ignore DL3007 --ignore SC1091 --ignore DL3013 --ignore DL3010 $(find . -type f -iname "Dockerfile*")

markdownlint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Pull markdownlint/markdownlint:latest Image
run: docker pull markdownlint/markdownlint:latest
- name: Run markdownlint against *.md files
run: docker run --rm -i -v "$(pwd)":/workdir --workdir /workdir markdownlint/markdownlint:latest --rules ~MD013,~MD033,~MD026,~MD002,~MD022 $(find . -type f -iname '*.md' | grep -v '/.git/')
23 changes: 23 additions & 0 deletions .github/workflows/pre-commit-updates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Update pre-commit hooks

on:
workflow_dispatch:
schedule:
- cron: 0 0 * * 0

jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- uses: vrslev/[email protected]
- 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
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ ENV DEVICE_INDEX="" \
GAIN="40" \
SERIAL="" \
SOAPYSDR="" \
SERVER="acarshub" \
SERVER_PORT="5556" \
VDLM_FILTER_ENABLE="TRUE"

Expand Down
52 changes: 27 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
# Docker dumphfdl

# NOTE -- THIS REPO IS NOT READY FOR DEPLOYMENT
It's a placeholder repo based on `docker-dumnpvdl2` that has not been completed yet
Do not use or publish until it's ready to go.



![Banner](https://github.com/sdr-enthusiasts/docker-acarshub/blob/16ab3757986deb7c93c08f5c7e3752f54a19629c/Logo-Sources/ACARS%20Hub.png "banner")
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/fredclausen/docker-acarshub/Deploy%20to%20Docker%20Hub)](https://github.com/sdr-enthusiasts/docker-acarshub/actions?query=workflow%3A%22Deploy+to+Docker+Hub%22)
[![Docker Pulls](https://img.shields.io/docker/pulls/fredclausen/acarshub.svg)](https://hub.docker.com/r/fredclausen/acarshub)
Expand All @@ -16,6 +10,8 @@ Docker container for running [dumphfdl](https://github.com/szpajder/dumphfdl) an

Builds and runs on `amd64`, `arm64`, `arm/v7`, `arm/v6` and `386` architectures.

***WORK IN PROGRESS. `acars_router` and `ACARS Hub` support is a WIP***

## Note for Users running 32-bit Debian Buster-based OSes on ARM

Please see: [Buster-Docker-Fixes](https://github.com/fredclausen/Buster-Docker-Fixes)!
Expand All @@ -26,7 +22,7 @@ A computer host on a suitable architecture and one USB RTL-SDR dongle connected

## ACARS Hub integration

The default `SERVER` and `SERVER_PORT` values are suitable for automatically working with ACARS Hub, provided ACARS Hub is **on the same pi as the decoder**. If ACARS Hub is not on the same Pi, please provide the correct host name in the `SERVER` variable. Very likely you will not have to change the `SERVER_PORT`, but if you did change the port mapping on your ACARS Hub (and you will know if you did) please set the server port correctly as well.
The configuration below will enable integration with `acars_router`, which should be configured to forward messages to `acarshub`.

## Up and running

Expand All @@ -39,32 +35,38 @@ services:
tty: true
container_name: dumphfdl
restart: always
devices:
- /dev/bus/usb:/dev/bus/usb
ports:
device_cgroup_rules:
- "c 189:* rwm"
environment:
- TZ="America/Denver"
- SERIAL=13305
- FEED_ID=VDLM
- FREQUENCIES=136725000;136975000;136875000
- TZ=${FEEDER_TZ}
- SOAPYSDRDRIVER=driver=airspyhf,serial=0x3b52aa80389e25ad
- GAIN_TYPE=--gain
- SOAPYSAMPLERATE=912000
- GAIN=40
- FEED_ID=CS-KABQ-HFDL
- ZMQ_MODE=server
- ZMQ_ENDPOINT=tcp://0.0.0.0:45555
- SERVER=
tmpfs:
- /run:exec,size=64M
- /var/log
- /tmp
volumes:
- /dev:/dev:ro

```

## Configuration options

| Variable | Description | Required | Default |
|----------|-------------|---------|--------|
| `TZ` | Your timezone | No | UTC |
| `SERIAL` | The serial number of your RTL-SDR dongle | Yes | Blank |
| `FEED_ID` | Used by the decoder to insert a unique ID in to the output message | Yes | Blank |
| `FREQUENCIES` | Colon-separated list of frequencies, but to a maximum of 8, for the decoder to list to. No decimal, and all frequencies should be nine digits long. | Yes | Blank |
| `PPM` | Parts per million correction of the decoder | No | 0 |
| `GAIN`| The gain applied to the RTL-SDR dongle. | No | `40` |
| `SERVER` | The server where messages will be forwarded to. | No | Blank |
| `SERVER_PORT` | The port where the server will receive messages on. | No | `5555` |
| `VDLM_FILTER_ENABLE` | Filter out non-informational messages. Turning this off (set to a blank value) will cause increased message rate but the messages will be of little value. Will cause extra SD card read/writes. | No | `TRUE` |
| `QUIET_LOGS` | Mute log output to the bare minimum. Set to `false` to disable. | No | `TRUE` |
| `ZMQ_MODE` | Output to [zmq](https://zeromq.org) publisher socket. This sets the mode to `client` or `server`. | No | |
| `ZMQ_ENDPOINT` | Output to [zmq](https://zeromq.org) publisher socket. This sets the `endpoint`. Syntax is `tcp://address:port` | No | |
| `SOAPYSDRDRIVER` | SoapySDR driver. Required! Should be in the format that you would use to pass in to soapysdr. See the compose example above. | Yes | `unset` |
| `GAIN_TYPE` | The type of gain to use. Can be `--gain` or `--gain-elements`. | Yes | `unset` |
| `GAIN` | The gain to use. If used with `GAIN_TYPE=--gain-elements` then this should be in the format your SDR expects. For Airspy style devices something like `IFGR=53,RFGR=2`. Otherwise, if used with `GAIN_TYPE=--gain` then it should be a single value representing a gain value your SDR supports. Example above in the compose section. | Yes | `unset` |
| `SOAPYSAMPLERATE` | The sample rate to use. The sample rate that your SDR would expect. | Yes | `unset` |
| `FEED_ID` | The feed ID to use. This is the ID that will be used to identify your feed on the ACARS Hub and any site, such as [airframes](airframes.io) that you feed. | Yes | `unset` |
| `ZMQ_MODE` | The ZMQ mode to use. Can be `server` or `client`. | Yes | `unset` |
| `ZMQ_ENDPOINT` | The ZMQ endpoint to use. If `ZMQ_MODE=server` then this should be the endpoint that `acars_router` and other consumers will connect to. If `ZMQ_MODE=client` then this should be the endpoint that a ZMQ server is listening on and expects data from. | Yes | `unset` |
| `SERVER` | If you want this container to forward JSON data, via TCP, to a consumer then set this to the IP address of a consumer| No | `unset` |
| `SERVER_PORT` | If you want this container to forward JSON data, via TCP, to a consumer then set this to the port of a consumer | No | `unset` |

0 comments on commit 60a8994

Please sign in to comment.