Răsfoiți Sursa

feat: serverlist validate (#4207)

* server list validate

* dir

* dir

* dir

* cr

* add missing pc2

* pc2

* fix branch

* exit code

* repo

* branch

* fix csv

* letter

* tidy

* codacy

* exit code
Daniel Gibbs 3 ani în urmă
părinte
comite
03365ca5a7

+ 5 - 5
.github/workflows/details-check.yml

@@ -35,13 +35,13 @@ jobs:
         run: sudo apt-get install libxml2-utils jq
 
       - name: Download linuxgsm.sh
-        run: wget https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/feature/info_game-refactor/linuxgsm.sh; chmod +x linuxgsm.sh
+        run: wget https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${GITHUB_REF#refs/heads/}/linuxgsm.sh; chmod +x linuxgsm.sh
 
       - name: Grab server
-        run: LGSM_GITHUBBRANCH="feature/info_game-refactor" ./linuxgsm.sh ${{ matrix.shortname }}server
+        run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./linuxgsm.sh ${{ matrix.shortname }}server
 
       - name: Enable developer mode
-        run: LGSM_GITHUBBRANCH="feature/info_game-refactor" ./${{ matrix.shortname }}server developer
+        run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server developer
 
       - id: sets-servercfgname
         name: Generate servercfgname
@@ -68,7 +68,7 @@ jobs:
         run: grep "startparameters" lgsm/config-default/config-lgsm/${{ matrix.shortname }}server/_default.cfg
 
       - name: Detect details
-        run: LGSM_GITHUBBRANCH="feature/info_game-refactor" ./${{ matrix.shortname }}server detect-details
+        run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server detect-details
 
       - name: Query Raw
-        run: LGSM_GITHUBBRANCH="feature/info_game-refactor" ./${{ matrix.shortname }}server query-raw
+        run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server query-raw

+ 22 - 0
.github/workflows/serverlist-validate.sh

@@ -0,0 +1,22 @@
+#!/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" || exit
+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)"
+		exitcode=1
+	else
+		echo "OK: $csv ($csvcount) and serverlist.csv ($serverlistcount) match"
+	fi
+done
+
+exit ${exitcode}

+ 13 - 0
.github/workflows/serverlist-validate.yml

@@ -0,0 +1,13 @@
+name: Server list Validation
+on:
+  workflow_dispatch:
+  push:
+
+jobs:
+  serverlist-validate:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+
+      - name: compare versions
+        run: chmod +x .github/workflows/serverlist-validate.sh; .github/workflows/serverlist-validate.sh

+ 1 - 12
.github/workflows/version-check.yml

@@ -1,26 +1,15 @@
-# This is a basic workflow to help you get started with Actions
-
 name: Version Check
 
-# Controls when the action will run. Triggers the workflow on push or pull request
-# events but only for the master branch
 on: push
 
-# A workflow run is made up of one or more jobs that can run sequentially or in parallel
 permissions:
   contents: read
 
 jobs:
-  # This workflow contains a single job called "build"
-  Version-Check:
-    # The type of runner that the job will run on
+  version-Check:
     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/version-check.sh; .github/workflows/version-check.sh

+ 1 - 0
lgsm/data/almalinux-8.csv

@@ -78,6 +78,7 @@ ns2c,speex.i686,tbb.i686
 onset,mariadb-connector-c
 opfor
 pc
+pc2
 pmc,java-17-openjdk
 pstbs,GConf2
 pvkii

+ 1 - 0
lgsm/data/almalinux-9.csv

@@ -78,6 +78,7 @@ ns2c,speex.i686,tbb.i686
 onset,mariadb-connector-c
 opfor
 pc
+pc2
 pmc,java-17-openjdk
 pstbs,GConf2
 pvkii

+ 1 - 0
lgsm/data/centos-7.csv

@@ -78,6 +78,7 @@ ns2c,speex.i686,tbb.i686
 onset,mariadb-connector-c
 opfor
 pc
+pc2
 pmc,java-11-openjdk
 pstbs,GConf2
 pvkii

+ 1 - 0
lgsm/data/centos-8.csv

@@ -78,6 +78,7 @@ ns2c,speex.i686,tbb.i686
 onset,mariadb-connector-c
 opfor
 pc
+pc2
 pmc,java-17-openjdk
 pstbs,GConf2
 pvkii

+ 1 - 0
lgsm/data/centos-9.csv

@@ -78,6 +78,7 @@ ns2c,speex.i686,tbb.i686
 onset,mariadb-connector-c
 opfor
 pc
+pc2
 pmc,java-17-openjdk
 pstbs,GConf2
 pvkii

+ 1 - 0
lgsm/data/debian-10.csv

@@ -78,6 +78,7 @@ ns2c,speex:i386,libtbb2
 onset,libmariadb-dev
 opfor
 pc
+pc2
 pmc,openjdk-11-jre
 pstbs,libgconf-2-4
 pvkii

+ 1 - 0
lgsm/data/debian-11.csv

@@ -78,6 +78,7 @@ ns2c,speex:i386,libtbb2
 onset,libmariadb-dev
 opfor
 pc
+pc2
 pmc,openjdk-17-jre
 pstbs,libgconf-2-4
 pvkii

+ 1 - 0
lgsm/data/debian-12.csv

@@ -78,6 +78,7 @@ ns2c,speex:i386,libtbb12
 onset,libmariadb-dev
 opfor
 pc
+pc2
 pmc,openjdk-17-jre
 pstbs,libgconf-2-4
 pvkii

+ 1 - 0
lgsm/data/debian-9.csv

@@ -78,6 +78,7 @@ ns2c,speex:i386,libtbb2
 onset,libmariadb-dev
 opfor
 pc
+pc2
 pmc,openjdk-8-jre
 pstbs,libgconf-2-4
 pvkii

+ 1 - 0
lgsm/data/rhel-7.csv

@@ -78,6 +78,7 @@ ns2c,speex.i686,tbb.i686
 onset,mariadb-connector-c
 opfor
 pc
+pc2
 pmc,java-11-openjdk
 pstbs,GConf2
 pvkii

+ 1 - 0
lgsm/data/rhel-8.csv

@@ -78,6 +78,7 @@ ns2c,speex.i686,tbb.i686
 onset,mariadb-connector-c
 opfor
 pc
+pc2
 pmc,java-17-openjdk
 pstbs,GConf2
 pvkii

+ 1 - 0
lgsm/data/rhel-9.csv

@@ -78,6 +78,7 @@ ns2c,speex.i686,tbb.i686
 onset,mariadb-connector-c
 opfor
 pc
+pc2
 pmc,java-17-openjdk
 pstbs,GConf2
 pvkii

+ 1 - 0
lgsm/data/rocky-8.csv

@@ -78,6 +78,7 @@ ns2c,speex.i686,tbb.i686
 onset,mariadb-connector-c
 opfor
 pc
+pc2
 pmc,java-17-openjdk
 pstbs,GConf2
 pvkii

+ 1 - 0
lgsm/data/rocky-9.csv

@@ -78,6 +78,7 @@ ns2c,speex.i686,tbb.i686
 onset,mariadb-connector-c
 opfor
 pc
+pc2
 pmc,java-17-openjdk
 pstbs,GConf2
 pvkii

+ 0 - 1
lgsm/data/serverlist.csv

@@ -128,4 +128,3 @@ wmc,wmcserver,WaterfallMC,ubuntu-22.04
 wurm,wurmserver,Wurm Unlimited,ubuntu-22.04
 zmr,zmrserver,Zombie Master: Reborn,ubuntu-22.04
 zps,zpsserver,Zombie Panic! Source,ubuntu-22.04
-

+ 1 - 0
lgsm/data/ubuntu-16.04.csv

@@ -78,6 +78,7 @@ ns2c,speex:i386,libtbb2
 onset,libmariadb-dev
 opfor
 pc
+pc2
 pmc,openjdk-8-jre
 pstbs,libgconf-2-4
 pvkii

+ 1 - 0
lgsm/data/ubuntu-18.04.csv

@@ -78,6 +78,7 @@ ns2c,speex:i386,libtbb2
 onset,libmariadb-dev
 opfor
 pc
+pc2
 pmc,openjdk-11-jre
 pstbs,libgconf-2-4
 pvkii

+ 1 - 0
lgsm/data/ubuntu-20.04.csv

@@ -78,6 +78,7 @@ ns2c,speex:i386,libtbb2
 onset,libmariadb-dev
 opfor
 pc
+pc2
 pmc,openjdk-17-jre
 pstbs,libgconf-2-4
 pvkii

+ 1 - 0
lgsm/data/ubuntu-21.04.csv

@@ -78,6 +78,7 @@ ns2c,speex:i386,libtbb2
 onset,libmariadb-dev
 opfor
 pc
+pc2
 pmc,openjdk-17-jre
 pstbs,libgconf-2-4
 pvkii

+ 4 - 1
lgsm/data/ubuntu-21.10.csv

@@ -16,10 +16,11 @@ bfv,libncurses5:i386,libstdc++5:i386
 bmdm,libncurses5:i386
 bo
 bs
-bt,libicu-dev
+bt,libicu-dev,dos2unix
 btl
 cc
 ck,xvfb
+cd
 cmw
 cod,libstdc++5:i386
 cod2,libstdc++5:i386
@@ -32,6 +33,7 @@ cscz
 csgo
 css,libtinfo5:i386
 dab
+dayz
 dmc
 dod
 dodr
@@ -76,6 +78,7 @@ ns2c,speex:i386,libtbb2
 onset,libmariadb-dev
 opfor
 pc
+pc2
 pmc,openjdk-17-jre
 pstbs,libgconf-2-4
 pvkii

+ 1 - 0
lgsm/data/ubuntu-22.04.csv

@@ -78,6 +78,7 @@ ns2c,speex:i386,libtbb2
 onset,libmariadb-dev
 opfor
 pc
+pc2
 pmc,openjdk-17-jre
 pstbs,libgconf-2-4
 pvkii