From b6638d94d182857f0e2aec8201e27616ef8dd1f2 Mon Sep 17 00:00:00 2001 From: Michael Keller Date: Tue, 31 Dec 2024 14:33:07 +1300 Subject: [PATCH] CICD: Add Check for Changes in the Supported Dive Computer Lists. Add a check that will fail whenever there is a change in the list of supported dive computers in libdivecomputer that is not reflected in the `SupportedDivecomputers.*` lists. Also add a script for a simplified update of these lists. From a discussion with @dirkhh in https://github.com/subsurface/libdc/pull/71#issuecomment-2565384338. Signed-off-by: Michael Keller --- .../workflows/check-divecomputer-lists.yml | 40 +++++++++++++++++++ .../update-supported-divecomputer-lists.sh | 16 ++++++++ 2 files changed, 56 insertions(+) create mode 100644 .github/workflows/check-divecomputer-lists.yml create mode 100755 scripts/update-supported-divecomputer-lists.sh diff --git a/.github/workflows/check-divecomputer-lists.yml b/.github/workflows/check-divecomputer-lists.yml new file mode 100644 index 0000000000..61daee3fc1 --- /dev/null +++ b/.github/workflows/check-divecomputer-lists.yml @@ -0,0 +1,40 @@ +name: Check the Supported Dive Computer Lists + +on: + push: + branches: + - master + paths: + - libdivdcomputer/src/descriptor.c + - SupportedDivecomputers.txt + - SupportedDivecomputers.html + - scripts + pull_request: + branches: + - master + paths: + - libdivdcomputer/src/descriptor.c + - SupportedDivecomputers.txt + - SupportedDivecomputers.html + - scripts + +jobs: + check: + runs-on: ubuntu-24.04 + + steps: + - uses: actions/checkout@v4 + + - name: Check the Supported Dive Computer Lists + run: | + perl scripts/parse-descriptor.pl SupportedDivecomputers_new.txt + diff -u SupportedDivecomputers.txt SupportedDivecomputers_new.txt + TXT_EXIT_CODE=$? + + perl scripts/parse-descriptor.pl SupportedDivecomputers_new.html + diff -u SupportedDivecomputers.html SupportedDivecomputers_new.html + + if [ $? -ne 0 -o $TXT_EXIT_CODE -ne 0 ] ; then + echo "The list of supported dive computers in libdivecomputer has changed. Please run `scripts/update-supported-divecomputer-lists.sh` and commit the resulting changes." + exit 1 + fi diff --git a/scripts/update-supported-divecomputer-lists.sh b/scripts/update-supported-divecomputer-lists.sh new file mode 100755 index 0000000000..47743c6c69 --- /dev/null +++ b/scripts/update-supported-divecomputer-lists.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# +# Update the Lists of Supported Dive Computers Based +# on the Information in the libdivecomputer Source Code +# + +CONTAINER_NAME=subsurface-android-builder + +pushd . &> /dev/null +cd "$(dirname "$0")/.." + +perl scripts/parse-descriptor.pl SupportedDivecomputers.html +perl scripts/parse-descriptor.pl SupportedDivecomputers.txt + +popd &> /dev/null