From 33f5ab983d691171c32ccccbcf955a46345eae5a Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Fri, 22 Oct 2021 02:46:52 +1100 Subject: [PATCH] -Cleaned up CI targets: * Restricted Linux CI build to only run on changes to code, translations, software lists, and build scripts. * Restricted Windows/macOS CO to only run on changes to code and build scripts. They provide nothing over Linux for the other stuff. * Added plugin properties and controller file validation to the "hash" workflow. * Added a workflow for building documentation, so pull requests that affect documentation will at least get a basic check in advance. -plugins/autofire: Bumped version as configuration format has changed. --- .github/workflows/ci-linux.yml | 22 +++++++++++++++++++- .github/workflows/ci-macos.yml | 18 +++++++++++++++- .github/workflows/ci-windows.yml | 18 +++++++++++++++- .github/workflows/docs.yml | 30 +++++++++++++++++++++++++++ .github/workflows/hash.yml | 16 ++++++++++++--- plugins/autofire/init.lua | 2 +- plugins/autofire/plugin.json | 2 +- plugins/plugin.schema | 35 ++++++++++++++++++++++++++++++++ 8 files changed, 135 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/docs.yml create mode 100644 plugins/plugin.schema diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index 6922871bcd3..5de11d83e32 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -1,6 +1,26 @@ name: CI (Linux) -on: [push, pull_request] +on: + push: + paths: + - '.github/**' + - '3rdparty/**' + - 'hash/**' + - 'language/**' + - 'scripts/**' + - 'src/**' + - 'COPYING' + - 'makefile' + pull_request: + paths: + - '.github/**' + - '3rdparty/**' + - 'hash/**' + - 'language/**' + - 'scripts/**' + - 'src/**' + - 'COPYING' + - 'makefile' jobs: build-linux: diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index 2e6e9c328f6..bab39b826da 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -1,6 +1,22 @@ name: CI (macOS) -on: [push, pull_request] +on: + push: + paths: + - '.github/**' + - '3rdparty/**' + - 'scripts/**' + - 'src/**' + - 'COPYING' + - 'makefile' + pull_request: + paths: + - '.github/**' + - '3rdparty/**' + - 'scripts/**' + - 'src/**' + - 'COPYING' + - 'makefile' jobs: build-macos: diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index eeb422adf14..a08f15b03ef 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -1,6 +1,22 @@ name: CI (Windows) -on: [push, pull_request] +on: + push: + paths: + - '.github/**' + - '3rdparty/**' + - 'scripts/**' + - 'src/**' + - 'COPYING' + - 'makefile' + pull_request: + paths: + - '.github/**' + - '3rdparty/**' + - 'scripts/**' + - 'src/**' + - 'COPYING' + - 'makefile' jobs: diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000000..1b39b1be2f5 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,30 @@ +name: Build documentation + +on: + push: + paths: + - 'docs/**' + pull_request: + paths: + - 'docs/**' + +jobs: + build-docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y librsvg2-bin latexmk python3-pip python3-sphinx texlive texlive-formats-extra texlive-science + pip3 install sphinxcontrib-svg2pdfconverter + - name: Build HTML + run: make -C docs html + - name: Build PDF + run: make -C docs latexpdf + - uses: actions/upload-artifact@master + with: + name: mame-docs-${{ github.sha }} + path: | + docs/build/html + docs/build/latex/MAME.pdf diff --git a/.github/workflows/hash.yml b/.github/workflows/hash.yml index cec7fca734b..94a6b24a298 100644 --- a/.github/workflows/hash.yml +++ b/.github/workflows/hash.yml @@ -1,12 +1,18 @@ -name: XML validation +name: XML/JSON validation on: push: paths: + - '.github/**' + - 'ctrlr/*' - 'hash/*' + - 'plugins/**' pull_request: paths: + - '.github/**' + - 'ctrlr/*' - 'hash/*' + - 'plugins/**' jobs: validate: @@ -16,8 +22,12 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y libxml2-utils + sudo apt-get install -y libxml2-utils python3-jsonschema + - name: Validate (controller configuration) + run: for x in ctrlr/*.cfg ; do xmllint --noout "$x" ; done - name: Validate (HSI) run: for x in hash/*.hsi ; do xmllint --noout "$x" ; done - - name: Validate (XML) + - name: Validate (software list) run: for x in hash/*.xml ; do xmllint --noout --valid "$x" ; done + - name: Validate (plugin properties) + run: for x in plugins/*/plugin.json ; do jsonschema -i "$x" plugins/plugin.schema ; done diff --git a/plugins/autofire/init.lua b/plugins/autofire/init.lua index cfb055b7465..d14533dc53b 100644 --- a/plugins/autofire/init.lua +++ b/plugins/autofire/init.lua @@ -2,7 +2,7 @@ -- copyright-holders:Jack Li local exports = { name = 'autofire', - version = '0.0.3', + version = '0.0.4', description = 'Autofire plugin', license = 'The BSD 3-Clause License', author = { name = 'Jack Li' } } diff --git a/plugins/autofire/plugin.json b/plugins/autofire/plugin.json index 56c36ba751f..20ef5e29a15 100644 --- a/plugins/autofire/plugin.json +++ b/plugins/autofire/plugin.json @@ -2,7 +2,7 @@ "plugin": { "name": "autofire", "description": "Autofire plugin", - "version": "0.0.3", + "version": "0.0.4", "author": "Jack Li", "type": "plugin", "start": "false" diff --git a/plugins/plugin.schema b/plugins/plugin.schema new file mode 100644 index 00000000000..e6dee563c78 --- /dev/null +++ b/plugins/plugin.schema @@ -0,0 +1,35 @@ +{ + "type": "object", + "properties": { + "plugin": { + "type": "object", + "properties": { + "name": { + "type": "string", + "pattern": "^[A-Za-z][0-9A-Za-z_]*$" + }, + "description": { + "type": "string" + }, + "version": { + "type": "string" + }, + "author": { + "type": "string" + }, + "type": { + "type": "string", + "pattern": "^(plugin|library)$" + }, + "start": { + "type": "string", + "pattern": "^(true|false)$" + } + }, + "additionalProperties": false, + "required": [ "name", "description", "version", "author", "type" ] + } + }, + "additionalProperties": false, + "required": [ "plugin" ] +}