diff options
Diffstat (limited to '.github/workflows')
-rw-r--r-- | .github/workflows/build-linux.yml | 4 | ||||
-rwxr-xr-x | .github/workflows/xmlvalidate.sh | 42 | ||||
-rw-r--r-- | .github/workflows/xmlvalidate.yml | 36 |
3 files changed, 80 insertions, 2 deletions
diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 87dc0b45..01a589d3 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -101,13 +101,13 @@ jobs: src/Build/build_cmake_deb.sh WXSTATIC INDICATOR - name: Upload GUI .deb packages - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: veracrypt-gui-debs path: /tmp/VeraCrypt_Packaging/GUI/Packaging/veracrypt-*.* - name: Upload Console .deb packages - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: veracrypt-console-debs path: /tmp/VeraCrypt_Packaging/Console/Packaging/veracrypt-console-*.* diff --git a/.github/workflows/xmlvalidate.sh b/.github/workflows/xmlvalidate.sh new file mode 100755 index 00000000..79d52c16 --- /dev/null +++ b/.github/workflows/xmlvalidate.sh @@ -0,0 +1,42 @@ +#!/bin/bash +fail=false + +# Get all string keys +KEYS=$(grep -oP '<entry[\ ]+lang="[^"]+"[\ ]+key="\K[^"]+' "$1"/src/Common/Language.xml) + +for file in {"$1"/Translations/Language.*.xml,"$1"/src/Common/Language.xml}; do + echo "$file" + passes=true + + # Validate xml + output=$(fxparser -V "$file") + returnvalue=$? + + if [ "$returnvalue" -ne "0" ]; then + passes=false + fail=true + echo $output + fi + + # Ensure each key found in common xml is found in translation xmls + for key in $KEYS; do + if ! grep -q "$key" "$file"; then + echo "Key $key not found in $file" + passes=false + fail=true + fi + done + + if [ "$passes" = true ]; then + echo -e "\e[32m$file passes xml validation.\e[0m" + else + echo -e "\e[31m$file fails xml validation.\e[0m" + fi + +done + +if [ "$fail" = true ]; then + exit 1 +else + exit 0 +fi diff --git a/.github/workflows/xmlvalidate.yml b/.github/workflows/xmlvalidate.yml new file mode 100644 index 00000000..7d3cbaa2 --- /dev/null +++ b/.github/workflows/xmlvalidate.yml @@ -0,0 +1,36 @@ +name: Validate XML + +on: + push: + branches: [ "master" ] + paths: + - 'Translations/*' + - 'src/Common/Language.xml' + - '.github/workflows/xmlvalidate.*' + pull_request: + branches: [ "master" ] + paths: + - 'Translations/*' + - 'src/Common/Language.xml' + - '.github/workflows/xmlvalidate.*' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + validate: + + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 'latest' + - name: Install fast-xml-parser + run: npm install fast-xml-parser@4.5.2 -g + - name: Run XML validator script + run: ${{ github.workspace }}/.github/workflows/xmlvalidate.sh "${{ github.workspace }}" |