From 1f1b53087073756a1c56ff0965977a0e327d1382 Mon Sep 17 00:00:00 2001 From: ike709 Date: Tue, 9 Mar 2021 13:51:37 -0600 Subject: [PATCH] Adds a GitHub Action to validate RSIs (#3587) * Validate RSIs * Fix the JSON * Example invalid RSI * Revert "Example invalid RSI" This reverts commit 1905bc9d2c275818db88cd8b643e2646f70b68a1. * Fixes an invalid identifier to show that it works on valid RSIs * Update .github/workflows/validate-rsis.yml --- .github/rsi-schema.json | 183 ++++++++++++++++++ .github/workflows/validate-rsis.yml | 15 ++ .../Textures/Objects/Tools/rcl.rsi/meta.json | 2 +- 3 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 .github/rsi-schema.json create mode 100644 .github/workflows/validate-rsis.yml diff --git a/.github/rsi-schema.json b/.github/rsi-schema.json new file mode 100644 index 0000000000..19ae391c66 --- /dev/null +++ b/.github/rsi-schema.json @@ -0,0 +1,183 @@ +{ + "$schema":"http://json-schema.org/draft-07/schema", + "default":{ + + }, + "description":"JSON Schema for SS14 RSI validation.", + "examples":[ + { + "version":1, + "license":"CC-BY-SA-3.0", + "copyright":"Taken from CODEBASE at COMMIT LINK", + "size":{ + "x":32, + "y":32 + }, + "states":[ + { + "name":"basic" + }, + { + "name":"basic-directions", + "directions":4 + }, + { + "name":"basic-delays", + "delays":[ + [ + 0.1, + 0.1 + ] + ] + }, + { + "name":"basic-delays-directions", + "directions":4, + "delays":[ + [ + 0.1, + 0.1 + ], + [ + 0.1, + 0.1 + ], + [ + 0.1, + 0.1 + ], + [ + 0.1, + 0.1 + ] + ] + } + ] + } + ], + "required":[ + "version", + "license", + "copyright", + "size", + "states" + ], + "title":"RSI Schema", + "type":"object", + "properties":{ + "version":{ + "$id":"#/properties/version", + "default":"", + "description":"RSI version integer.", + "title":"The version schema", + "type":"integer" + }, + "license":{ + "$id":"#/properties/license", + "default":"", + "description":"The license for the associated icon states. Restricted to SS14-compatible asset licenses.", + "enum":[ + "CC-BY-SA-3.0", + "CC-BY-SA-4.0", + "CC-BY-NC-SA-3.0", + "CC-BY-NC-SA-4.0", + "CC0-1.0" + ], + "examples":[ + "CC-BY-SA-3.0" + ], + "title":"License", + "type":"string" + }, + "copyright":{ + "$id":"#/properties/copyright", + "type":"string", + "title":"Copyright Info", + "description":"The copyright holder. This is typically a link to the commit of the codebase that the icon is pulled from.", + "default":"", + "examples":[ + "Taken from CODEBASE at COMMIT LINK" + ] + }, + "size":{ + "$id":"#/properties/size", + "default":{ + + }, + "description":"The dimensions of the sprites inside the RSI. This is not the size of the PNG files that store the sprite sheet.", + "examples":[ + { + "x":32, + "y":32 + } + ], + "title":"Sprite Dimensions", + "required":[ + "x", + "y" + ], + "type":"object", + "properties":{ + "x":{ + "$id":"#/properties/size/properties/x", + "type":"integer", + "default":32, + "examples":[ + 32 + ] + }, + "y":{ + "$id":"#/properties/size/properties/y", + "type":"integer", + "default":32, + "examples":[ + 32 + ] + } + }, + "additionalProperties":true + }, + "states":{ + "$id":"#/properties/states", + "type":"array", + "title":"Icon States", + "description":"Metadata for icon states. Includes name, directions, delays, etc.", + "default":[ + + ], + "examples":[ + [ + { + "name":"basic" + }, + { + "name":"basic-directions", + "directions":4 + } + ] + ], + "additionalItems":true, + "items":{ + "$id":"#/properties/states/items", + "type":"object", + "required":[ + "name" + ], + "properties":{ + "name":{ + "type":"string" + }, + "directions":{ + "type":"integer", + "enum":[ + 1, + 4, + 8 + ] + } + } + } + } + }, + "additionalProperties":true +} \ No newline at end of file diff --git a/.github/workflows/validate-rsis.yml b/.github/workflows/validate-rsis.yml new file mode 100644 index 0000000000..980d45ddff --- /dev/null +++ b/.github/workflows/validate-rsis.yml @@ -0,0 +1,15 @@ +name: RSI Validator + +on: [push, pull_request] +jobs: + validate_rsis: + name: Validate RSIs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Parse files + uses: snapcart/json-schema-validator@v1.0.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + json_schema: .github/rsi-schema.json + json_path_pattern: .*meta.json$ diff --git a/Resources/Textures/Objects/Tools/rcl.rsi/meta.json b/Resources/Textures/Objects/Tools/rcl.rsi/meta.json index 3363942030..f79f3bce67 100644 --- a/Resources/Textures/Objects/Tools/rcl.rsi/meta.json +++ b/Resources/Textures/Objects/Tools/rcl.rsi/meta.json @@ -1,6 +1,6 @@ { "version": 1, - "license": "CC BY-SA 3.0", + "license": "CC-BY-SA-3.0", "copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/commit/77608a9f46b06a46f0f6b1be061755f68cc255a3", "size": { "x": 32,