Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/json_api.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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()

Expand Down
21 changes: 12 additions & 9 deletions flucoma/MakeRef.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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:])
30 changes: 30 additions & 0 deletions flucoma/doc/raw/driver.py
Original file line number Diff line number Diff line change
@@ -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,
}