Skip to content

Fix Prometheus exposition format for metrics endpoint (#3107) #48

Fix Prometheus exposition format for metrics endpoint (#3107)

Fix Prometheus exposition format for metrics endpoint (#3107) #48

Workflow file for this run

name: Release
on:
workflow_dispatch:
push:
tags:
- '*'
env:
# from https://downloads.myriadrf.org/builds/PothosSDR/
pothos-ver: 2021.07.25-vc16
pothos-exe: PothosSDR-2021.07.25-vc16-x64.exe
jobs:
downloads_job:
name: Downloads
#runs-on: ubuntu-latest
runs-on: windows-latest
steps:
- uses: actions/cache@v4
id: downloads
with:
path: ${{ runner.workspace }}/${{ env.pothos-exe }}
key: download-${{ env.pothos-ver }}
- name: Run Downloads
if: steps.downloads.outputs.cache-hit != 'true'
shell: bash
working-directory: ${{ runner.workspace }}
run: curl -L -O https://downloads.myriadrf.org/builds/PothosSDR/${{ env.pothos-exe }}
release_job:
name: Create release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
release_version: ${{ env.RELEASE_VERSION }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create Release info
# e.g. refs/tags/23.01
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/2')
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "RELEASE_NAME=Release ${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "PRERELEASE=false" >> $GITHUB_ENV
./.deploy/gen_release_info.py
- name: Create Pre-Release info
# e.g. refs/tags/nightly or refs/heads/master
if: github.event_name != 'push' || !startsWith(github.ref, 'refs/tags/2')
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "RELEASE_NAME=Pre-Release ${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "PRERELEASE=true" >> $GITHUB_ENV
./.deploy/gen_nightly_info.sh
- uses: softprops/action-gh-release@v2
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE_VERSION }}
name: ${{ env.RELEASE_NAME }}
body_path: RELEASEINFO.md
#draft: true
prerelease: ${{ env.PRERELEASE }}
macos_build_job:
needs: release_job
strategy:
fail-fast: false
matrix:
os: [macos-13, macos-14]
feat: [rtlsdr, soapysdr]
include:
- os: macos-13
arch: x86_64
- os: macos-14
arch: arm64
runs-on: ${{ matrix.os }}
name: Build ${{ matrix.feat }} on ${{ matrix.os }} for ${{ matrix.arch }}
steps:
- uses: actions/checkout@v4
- name: Setup tools
run: brew install librtlsdr openssl@3
- name: Setup SoapySDR deps
if: matrix.feat == 'soapysdr'
run: brew install soapysdr
- name: Configure
run: cmake -B build
- name: Build
run: cmake --build build
- name: Adjust binary to run with MacPorts or Homebrew
# Homebrew has x86 in /usr/local and arm64 in /opt/homebrew
run: >
install_name_tool
-change /opt/homebrew/opt/openssl@3/lib/libssl.3.dylib @rpath/libssl.3.dylib
-change /opt/homebrew/opt/openssl@3/lib/libcrypto.3.dylib @rpath/libcrypto.3.dylib
-change /opt/homebrew/opt/libusb/lib/libusb-1.0.0.dylib @rpath/libusb-1.0.0.dylib
-change /opt/homebrew/opt/librtlsdr/lib/librtlsdr.2.dylib @rpath/librtlsdr.2.dylib
-change /opt/homebrew/opt/soapysdr/lib/libSoapySDR.0.8.dylib @rpath/libSoapySDR.0.8.dylib
-change /usr/local/opt/openssl@3/lib/libssl.3.dylib @rpath/libssl.3.dylib
-change /usr/local/opt/openssl@3/lib/libcrypto.3.dylib @rpath/libcrypto.3.dylib
-change /usr/local/opt/libusb/lib/libusb-1.0.0.dylib @rpath/libusb-1.0.0.dylib
-change /usr/local/opt/librtlsdr/lib/librtlsdr.2.dylib @rpath/librtlsdr.2.dylib
-change /usr/local/opt/soapysdr/lib/libSoapySDR.0.8.dylib @rpath/libSoapySDR.0.8.dylib
-add_rpath /opt/homebrew/opt/openssl@3/lib
-add_rpath /opt/homebrew/opt/libusb/lib
-add_rpath /opt/homebrew/opt/librtlsdr/lib
-add_rpath /opt/homebrew/opt/soapysdr/lib
-add_rpath /usr/local/opt/openssl@3/lib
-add_rpath /usr/local/opt/libusb/lib
-add_rpath /usr/local/opt/librtlsdr/lib
-add_rpath /usr/local/opt/soapysdr/lib
-add_rpath /opt/local/libexec/openssl3/lib
-add_rpath /opt/local/lib
build/src/rtl_433
- name: Check final binary
run: otool -L build/src/rtl_433
- name: "Upload Release Asset"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ZIP_FILE: rtl_433-${{ matrix.feat }}-MacOS-${{ matrix.arch }}-${{ needs.release_job.outputs.release_version }}.zip
run: |
zip --junk-paths $ZIP_FILE build/src/rtl_433
gh release upload ${{ needs.release_job.outputs.release_version }} $ZIP_FILE
# 22.04 jammy / bookworm uses OpenSSL 3
# 20.04 focal / bullseye uses OpenSSL 1.1
native_build_job:
needs: release_job
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
feat: [rtlsdr, soapysdr]
include:
- os: ubuntu-20.04
libs: openssl11
- os: ubuntu-22.04
libs: openssl3
runs-on: ${{ matrix.os }}
name: Build ${{ matrix.feat }} on ${{ matrix.os }} for amd64
steps:
- uses: actions/checkout@v4
- name: Setup tools
run: |
sudo apt-get update -q -y
sudo apt-get install -y --no-install-recommends cmake ninja-build
- name: Setup deps
run: |
sudo apt-get install -q -y librtlsdr-dev libssl-dev
- name: Setup SoapySDR deps
if: matrix.feat == 'soapysdr'
run: |
sudo apt-get install -q -y libsoapysdr-dev
- name: Configure
run: cmake -GNinja -B build
- name: Build
run: cmake --build build
- name: Check final binary
run: ldd build/src/rtl_433
- name: "Upload Release Asset"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ZIP_FILE: rtl_433-${{ matrix.feat }}-${{ matrix.libs }}-Linux-amd64-${{ needs.release_job.outputs.release_version }}.zip
run: |
zip --junk-paths $ZIP_FILE build/src/rtl_433
gh release upload ${{ needs.release_job.outputs.release_version }} $ZIP_FILE
cross_build_job:
needs: release_job
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
arch: [armhf, arm64]
feat: [rtlsdr, soapysdr]
include:
- arch: armhf
compiler: arm-linux-gnueabihf
- arch: arm64
compiler: aarch64-linux-gnu
- os: ubuntu-20.04
libs: openssl11
- os: ubuntu-22.04
libs: openssl3
runs-on: ${{ matrix.os }}
name: Build ${{ matrix.feat }} on ${{ matrix.os }} for ${{ matrix.arch }}
steps:
- uses: actions/checkout@v4
- name: Setup tools
run: |
sudo apt-get update -q -y
sudo apt-get install -y --no-install-recommends cmake ninja-build
- name: Purge conflicting dev that confuse cross linking
run: |
sudo apt-get purge -y libssl-dev libusb-1.0-0-dev
- name: Setup compiler
run: |
sudo apt-get install -q -y gcc-${{ matrix.compiler }} g++-${{ matrix.compiler }}
- name: Restrict sources.list
run: |
sudo sed -i'' -E 's/^(deb|deb-src) mirror\+file/\1 [arch=amd64,i386] mirror\+file/' /etc/apt/sources.list
- uses: ryankurte/action-apt@v0.4.0
if: matrix.feat != 'soapysdr'
with:
arch: ${{ matrix.arch }}
packages: "librtlsdr-dev:${{ matrix.arch }} libssl-dev:${{ matrix.arch }}"
- uses: ryankurte/action-apt@v0.4.0
if: matrix.feat == 'soapysdr'
with:
arch: ${{ matrix.arch }}
packages: "librtlsdr-dev:${{ matrix.arch }} libssl-dev:${{ matrix.arch }} libsoapysdr-dev:${{ matrix.arch }}"
- name: Configure
run: cmake -DCMAKE_TOOLCHAIN_FILE="$(pwd)/cmake/Toolchain-${{ matrix.compiler }}.cmake" -GNinja -B build
- name: Build
run: cmake --build build
- name: Check final binary
run: ${{ matrix.compiler }}-readelf -a build/src/rtl_433 | grep "Shared library:"
- name: "Upload Release Asset"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ZIP_FILE: rtl_433-${{ matrix.feat }}-${{ matrix.libs }}-Linux-${{ matrix.arch }}-${{ needs.release_job.outputs.release_version }}.zip
run: |
zip --junk-paths $ZIP_FILE build/src/rtl_433
gh release upload ${{ needs.release_job.outputs.release_version }} $ZIP_FILE
build_mingw_job:
needs: release_job
if: ${{ needs.release_job.result != 'failure' }}
strategy:
fail-fast: false
matrix:
arch: [i686, x86-64]
runs-on: ubuntu-latest
name: Build with Mingw-w64 on ${{ matrix.arch }}
steps:
- uses: actions/checkout@v4
- name: "Install Mingw-w64"
run: |
sudo apt-get update -q -y
sudo apt-get install -q -y gcc-mingw-w64-base binutils-mingw-w64-${{ matrix.arch }} gcc-mingw-w64-${{ matrix.arch }} mingw-w64-${{ matrix.arch }}-dev gcc-mingw-w64 gcc-multilib p7zip-full
- name: "Configure with Mingw-w64"
run: cmake -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-gcc-mingw-w64-${{ matrix.arch }}.cmake -DENABLE_RTLSDR=OFF -B build
- name: "Build with Mingw-w64"
run: cmake --build build
- name: "Sysroot Build with Mingw-w64"
run: ./.ci/scripts/do_sysroot.sh
- name: "Upload Release Asset"
if: matrix.arch == 'x86-64'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ZIP_FILE: rtl_433-win-x64-${{ needs.release_job.outputs.release_version }}.zip
run: |
mv rtl_433-win-x64.zip $ZIP_FILE
gh release upload ${{ needs.release_job.outputs.release_version }} $ZIP_FILE
- name: "Upload Release Asset"
if: matrix.arch == 'x86-64'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ZIP_FILE: rtl_433-win-x32-${{ needs.release_job.outputs.release_version }}.zip
run: |
mv rtl_433-win-x32.zip $ZIP_FILE
gh release upload ${{ needs.release_job.outputs.release_version }} $ZIP_FILE
build_msvc_job:
needs: [downloads_job, release_job]
if: ${{ needs.downloads_job.result != 'failure' && needs.release_job.result != 'failure' }}
strategy:
fail-fast: false
matrix:
os: [windows-2019, windows-2022]
platform: [x64, Win32]
# from https://downloads.myriadrf.org/builds/PothosSDR/
#pothos-ver: [2021.07.25-vc16]
include:
- os: windows-2019
generator: Visual Studio 16 2019
- os: windows-2022
generator: Visual Studio 17 2022
runs-on: ${{ matrix.os }}
name: ${{ matrix.generator }} ${{ matrix.platform }} CMake (MSBuild) on ${{ matrix.os }}
steps:
- run: choco install openssl --yes --no-progress
if: matrix.platform == 'x64'
- uses: actions/checkout@v4
- uses: actions/cache@v4
id: downloads
if: matrix.platform == 'x64'
with:
path: ${{ runner.workspace }}/${{ env.pothos-exe }}
key: download-${{ env.pothos-ver }}
- name: Run Downloads
if: matrix.platform == 'x64' && steps.downloads.outputs.cache-hit != 'true'
shell: bash
working-directory: ${{ runner.workspace }}
run: curl -L -O https://downloads.myriadrf.org/builds/PothosSDR/${{ env.pothos-exe }}
- name: Install Deps
if: matrix.platform == 'x64'
shell: bash
working-directory: ${{ runner.workspace }}
run: |
mkdir -p pothos
7z x -opothos -y ${{ env.pothos-exe }}
echo "POTHOS_PATH=$(pwd)/pothos" >> $GITHUB_ENV
- name: Get latest CMake and Ninja
uses: lukka/get-cmake@latest
# Note: this assumes ${{ runner.workspace }} == ${{ github.workspace }}/..
- name: CMake+None
uses: lukka/run-cmake@v10
with:
configurePreset: dummy
configurePresetCmdString: "[`-B`, `../b/rtl_433`, `-G${{ matrix.generator }}`, `-A${{ matrix.platform }}`, `-DENABLE_RTLSDR=OFF`, `-DENABLE_SOAPYSDR=OFF`, `-DENABLE_OPENSSL=OFF`]"
buildPreset: dummy
buildPresetCmdString: "[`--build`, `../b/rtl_433`, `--config`, `Release`]"
- name: CMake+RTLSDR+SOAPYSDR+TLS
uses: lukka/run-cmake@v10
env:
CMAKE_PREFIX_PATH: ${{ runner.workspace }}\pothos
if: matrix.platform == 'x64'
with:
configurePreset: dummy
configurePresetCmdString: "[`-B`, `../b/rtl_433-rtlsdr-soapysdr-tls`, `-G${{ matrix.generator }}`, `-A${{ matrix.platform }}`, `-DCMAKE_PREFIX_PATH=${{ env.POTHOS_PATH }}`, `-DENABLE_RTLSDR=ON`, `-DENABLE_SOAPYSDR=ON`, `-DENABLE_OPENSSL=ON`]"
buildPreset: dummy
buildPresetCmdString: "[`--build`, `../b/rtl_433-rtlsdr-soapysdr-tls`, `--config`, `Release`]"
- name: CMake+RTLSDR+SOAPYSDR
uses: lukka/run-cmake@v10
env:
CMAKE_PREFIX_PATH: ${{ runner.workspace }}\pothos
if: matrix.platform == 'x64'
with:
configurePreset: dummy
configurePresetCmdString: "[`-B`, `../b/rtl_433-rtlsdr-soapysdr`, `-G${{ matrix.generator }}`, `-A${{ matrix.platform }}`, `-DCMAKE_PREFIX_PATH=${{ env.POTHOS_PATH }}`, `-DENABLE_RTLSDR=ON`, `-DENABLE_SOAPYSDR=ON`, `-DENABLE_OPENSSL=OFF`]"
buildPreset: dummy
buildPresetCmdString: "[`--build`, `../b/rtl_433-rtlsdr-soapysdr`, `--config`, `Release`]"
- name: CMake+RTLSDR+TLS
uses: lukka/run-cmake@v10
env:
CMAKE_PREFIX_PATH: ${{ runner.workspace }}\pothos
if: matrix.platform == 'x64'
with:
configurePreset: dummy
configurePresetCmdString: "[`-B`, `../b/rtl_433-rtlsdr-tls`, `-G${{ matrix.generator }}`, `-A${{ matrix.platform }}`, `-DCMAKE_PREFIX_PATH=${{ env.POTHOS_PATH }}`, `-DENABLE_RTLSDR=ON`, `-DENABLE_SOAPYSDR=OFF`, `-DENABLE_OPENSSL=ON`]"
buildPreset: dummy
buildPresetCmdString: "[`--build`, `../b/rtl_433-rtlsdr-tls`, `--config`, `Release`]"
- name: CMake+RTLSDR
uses: lukka/run-cmake@v10
env:
CMAKE_PREFIX_PATH: ${{ runner.workspace }}\pothos
if: matrix.platform == 'x64'
with:
configurePreset: dummy
configurePresetCmdString: "[`-B`, `../b/rtl_433-rtlsdr`, `-G${{ matrix.generator }}`, `-A${{ matrix.platform }}`, `-DCMAKE_PREFIX_PATH=${{ env.POTHOS_PATH }}`, `-DENABLE_RTLSDR=ON`, `-DENABLE_SOAPYSDR=OFF`, `-DENABLE_OPENSSL=OFF`]"
buildPreset: dummy
buildPresetCmdString: "[`--build`, `../b/rtl_433-rtlsdr`, `--config`, `Release`]"
- name: Package dist
if: matrix.platform == 'x64'
shell: bash
working-directory: ${{ runner.workspace }}
run: |
mkdir -p dist
cp pothos/bin/{SoapySDR.dll,libusb-1.0.dll,rtlsdr.dll,vcruntime140.dll,vcruntime140_1.dll,pthreadVC2.dll} dist
cp b/rtl_433-rtlsdr-soapysdr-tls/src/Release/rtl_433.exe dist/rtl_433-rtlsdr-soapysdr-tls.exe
cp b/rtl_433-rtlsdr-soapysdr/src/Release/rtl_433.exe dist/rtl_433-rtlsdr-soapysdr.exe
cp b/rtl_433-rtlsdr-tls/src/Release/rtl_433.exe dist/rtl_433-rtlsdr-tls.exe
cp b/rtl_433-rtlsdr/src/Release/rtl_433.exe dist/rtl_433-rtlsdr.exe
cp b/rtl_433/src/Release/rtl_433.exe dist/rtl_433.exe
cp rtl_433/.deploy/WINDOWS-MSVC.txt dist/README.txt
ls -al dist
7z a rtl_433-win-msvc-x64.zip ./dist/*
- name: "Upload Release Asset"
if: matrix.os == 'windows-2019' && matrix.platform == 'x64'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
ZIP_FILE: rtl_433-win-msvc-x64-${{ needs.release_job.outputs.release_version }}.zip
shell: bash
working-directory: ${{ runner.workspace }}
run: |
mv rtl_433-win-msvc-x64.zip $ZIP_FILE
gh release upload ${{ needs.release_job.outputs.release_version }} $ZIP_FILE
build_arch_job:
if: ${{ false }} # disable for now
needs: release_job
# The host should always be Linux
runs-on: ubuntu-latest
strategy:
fail-fast: false
# jessie, ubuntu16.04 has no SoapySDR
# jessie has trouble linking libusb-1.0
# stretch has SoapySDR 0.5 which we don't support
# buster has broken librtlsdr pkg-config
# fedora_latest packages need to be verified
# alpine_latest packages need to be verified
matrix:
# arch: [armv6, armv7, aarch64, s390x, ppc64le]
arch: [armv7, aarch64, ppc64le]
# distro: [jessie, stretch, buster, ubuntu16.04, ubuntu18.04, ubuntu20.04, fedora_latest, alpine_latest]
distro: [stretch, buster, ubuntu16.04, ubuntu18.04, ubuntu20.04, fedora_latest]
include:
- arch: armv6
distro: stretch
- arch: armv6
distro: buster
name: Build on ${{ matrix.distro }} ${{ matrix.arch }}
steps:
- uses: actions/checkout@v4
- uses: uraimo/run-on-arch-action@v2.0.8
id: runcmd
with:
arch: ${{ matrix.arch }}
distro: ${{ matrix.distro }}
# Not required, speed up builds by storing container images in
# GitHub package registry.
#githubToken: ${{ github.token }}
# Install dependencies in the cached container.
install: |
case "${{ matrix.distro }}" in
jessie|stretch|ubuntu16.04)
apt-get update -q -y
apt-get install -q -y lsb-release build-essential libtool pkg-config cmake librtlsdr-dev libssl-dev
;;
buster|ubuntu*)
apt-get update -q -y
apt-get install -q -y lsb-release build-essential libtool pkg-config cmake librtlsdr-dev libsoapysdr-dev libssl-dev
;;
fedora*)
dnf -y update
dnf -y install redhat-lsb make gcc libtool pkg-config cmake rtl-sdr-devel SoapySDR-devel openssl-devel
;;
alpine*)
apk update
apk add lsb-release build-essential libtool pkg-config cmake librtlsdr-dev libsoapysdr-dev libssl-dev
;;
esac
run: |
uname -a
lsb_release -sc || echo NO lsb_release
echo Release ${{ needs.release_job.outputs.release_version }}
cmake -DCMAKE_INSTALL_PREFIX:PATH=../dist -B build
cmake --build build
cmake --build build --target install
- name: Install FPM
run: |
sudo apt-get update -q -y
sudo apt-get install -q -y ruby ruby-dev rubygems
sudo gem install --no-document fpm
- name: Package with FPM
run: |
ls -al "${PWD}/dist"
case "${{ matrix.distro }}" in
stretch)
libsoapy=libsoapysdr0.5-2 ;;
buster)
libsoapy=libsoapysdr0.6 ;;
fedora*)
libsoapy=SoapySDR ;;
*)
libsoapy=libsoapysdr0.7 ;;
esac
fpm -s dir -t deb -n rtl433 -v ${{ needs.release_job.outputs.release_version }}-1${{ matrix.distro }} -C "${PWD}/dist" \
-d libusb-1.0-0 -d libssl1.1 -d librtlsdr0 -d $libsoapy \
--deb-suggests soapysdr-module-all \
--deb-suggests soapysdr-tools \
--architecture ${{ matrix.arch }} \
--maintainer zany@triq.net \
--description "Program to decode radio transmissions" \
--url https://triq.org/
ls -al
ls -al "${PWD}/dist"
- name: "Upload Release Asset"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ needs.release_job.outputs.release_version }} rtl433_${{ needs.release_job.outputs.release_version }}-1${{ matrix.distro }}_${{ matrix.arch }}.deb