diff --git a/.github/workflows/json_api.yml b/.github/workflows/json_api.yml new file mode 100644 index 0000000..f7a321a --- /dev/null +++ b/.github/workflows/json_api.yml @@ -0,0 +1,33 @@ +name: Dev API + +on: + workflow_dispatch: + push: + branches: [ dev, ci/** ] + +jobs: + macbuild: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: flucoma/actions/env@v4 + - uses: flucoma/actions/docs@v4 + with: + target: 'MAKE_RAW_REF' + + - uses: dev-drprasad/delete-tag-and-release@v0.2.0 + with: + delete_release: true # default: false + tag_name: api # tag name to delete + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: package and upload + uses: softprops/action-gh-release@v1 + with: + name: FluCoMa Max Nightly Release + body: "This is a nightly build of the FluCoMa Max package. As such, be warned there may be bugs or other unexpected behaviour. The build hash is ${{ github.sha }}" + files: 'build/flucoma.api.json' + prerelease: false + tag_name: api + draft: false diff --git a/CMakeLists.txt b/CMakeLists.txt index 035a75a..4da7db2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,7 @@ set(MAX_DOC_OUT "${CMAKE_BINARY_DIR}/max_ref" CACHE PATH "") set(PD_DOC_OUT "${CMAKE_BINARY_DIR}/pd_ref" CACHE PATH "") set(CLI_DOC_OUT "${CMAKE_BINARY_DIR}/cli_ref" CACHE PATH "") set(SC_DOC_OUT "${CMAKE_BINARY_DIR}/sc_ref" CACHE PATH "") +set(RAW_DOC_OUT "${CMAKE_BINARY_DIR}" CACHE PATH "") # option(TESTS,"Run tests?") include(FetchContent) @@ -138,6 +139,7 @@ add_ref_target(max "Making Max ref") add_ref_target(pd "Making PD ref") add_ref_target(cli "Making CLI ref") add_ref_target(sc "Making SC ref") +add_ref_target(raw "Making raw API JSON") enable_testing() diff --git a/flucoma/MakeRef.py b/flucoma/MakeRef.py index 720b16e..bbe07ba 100644 --- a/flucoma/MakeRef.py +++ b/flucoma/MakeRef.py @@ -42,7 +42,7 @@ def main(passed_args): parser = argparse.ArgumentParser( description='Generate FluCoMa documentation for a given host, using input JSON and YAML data and a jinja template') - parser.add_argument('host', choices=['max','pd','cli','sc']) + parser.add_argument('host', choices=['max','pd','cli','sc','raw']) parser.add_argument('json_path', type=Path, help='Path to generated JSON client data') @@ -84,16 +84,19 @@ def main(passed_args): **host_settings) ) ) for c in clients - } + } - for c in index: - render.client(c, index, args, host_settings) + if host_settings.get('template'): + for c in index: + render.client(c, index, args, host_settings) - if host_settings['post']: host_settings['post'](index,args) - - topics = list(Path('topics/').resolve().glob('*.yaml')) - for t in topics: - render.topic(load_topic_data(t),index, args, host_settings) + if host_settings['post']: + host_settings['post'](index,args) + + if host_settings.get('topic_template'): + topics = list(Path('topics/').resolve().glob('*.yaml')) + for t in topics: + render.topic(load_topic_data(t),index, args, host_settings) if __name__ == '__main__': main(sys.argv[1:]) diff --git a/flucoma/doc/raw/driver.py b/flucoma/doc/raw/driver.py new file mode 100644 index 0000000..9bcbc87 --- /dev/null +++ b/flucoma/doc/raw/driver.py @@ -0,0 +1,30 @@ +# Part of the Fluid Corpus Manipulation Project (http://www.flucoma.org/) +# Copyright 2017-2019 University of Huddersfield. +# Licensed under the BSD-3 License. +# See license.md file in the project root for full license information. +# This project has received funding from the European Research Council (ERC) +# under the European Union’s Horizon 2020 research and innovation programme +# (grant agreement No 725899). + +import json +from .. transformers import default_transform + +def transform_data(client, data): + return default_transform(client, data) + +def write_index(idx,program_args): + + path = program_args.output_path + path.mkdir(exist_ok=True) + apifile = path / 'flucoma.api.json' + with open(apifile,'w') as f: + json.dump(idx,f,sort_keys=True, indent=4) + + maxdb_objs = {'maxdb':{'externals':{}}} + +settings = { + 'glob': '**/*.json', + 'transform': default_transform, + 'post': write_index, + 'defaults': None, +}