From 20cf26b66c536cffc25118d3d7793ce3b03bb6df Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Fri, 19 May 2023 12:53:51 +0100 Subject: [PATCH] server list validate --- .github/workflows/serverlist-validate.sh | 19 +++++++++++++++++++ .github/workflows/serverlist-validate.yml | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100755 .github/workflows/serverlist-validate.sh create mode 100644 .github/workflows/serverlist-validate.yml diff --git a/.github/workflows/serverlist-validate.sh b/.github/workflows/serverlist-validate.sh new file mode 100755 index 000000000..112cf942a --- /dev/null +++ b/.github/workflows/serverlist-validate.sh @@ -0,0 +1,19 @@ +#!/bin/bash +echo "Checking that all the game servers are listed in all csv files" +echo "this check will ensure serverlist.csv has the same number of lines (-2 lines) as the other csv files" +# count the number of lines in the serverlist.csv +cd ../../lgsm/data/ +serverlistcount="$(wc -l < serverlist.csv)" +echo "serverlistcount: $serverlistcount" +# get list of all csv files starting with ubunutu debian centos +csvlist="$(ls -1 | grep -E '^(ubuntu|debian|centos|rhel|almalinux|rocky).*\.csv$')" +# loop though each csv file and make sure the number of lines is the same as the serverlistcount +for csv in $csvlist; do + csvcount="$(wc -l < $csv)" + csvcount=$((csvcount-2)) + if [ "$csvcount" -ne "$serverlistcount" ]; then + echo "ERROR: $csv ($csvcount) does not match serverlist.csv ($serverlistcount)" + else + echo "OK: $csv ($csvcount) and serverlist.csv ($serverlistcount) match" + fi +done diff --git a/.github/workflows/serverlist-validate.yml b/.github/workflows/serverlist-validate.yml new file mode 100644 index 000000000..1333b1bfb --- /dev/null +++ b/.github/workflows/serverlist-validate.yml @@ -0,0 +1,19 @@ +name: Server list Validation +on: + workflow_dispatch: + push: + +jobs: + # This workflow contains a single job called "build" + Version-Check: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + + # Runs a single command using the runners shell + - name: compare versions + run: chmod +x .github/workflows/serverlist-validate.sh; .github/workflows/serverlist-validate.sh