diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f71da3c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM librecores/ci:2020.6-rc1 +COPY entrypoint.py /tmp/entrypoint.py +ENTRYPOINT [ "/tmp/entrypoint.py" ] diff --git a/README.md b/README.md new file mode 100644 index 0000000..1b871e8 --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +# LibreCores CI Github Action with FuseSoC + +This executes FuseSoC in the [LibreCores CI docker container](https://github.com/librecores/ci-docker-image). + +It is still in an early development phase, please feel free to open an issue with your suggestion! + +## Inputs + +### `core` + +**Required** The core/system identifier to execute on. + +### `flow` + +**Required** Command to execute, such as `build`, `run` etc. + +### `target` + +*Optional* Override default target, default none. + +### `tool` + +*Optional* Override default tool for target, default none. + +## Example usage + +```yaml +uses: librecores/ci-fusesoc-action@2020.6-rc1 +with: + core: myorg:mylib:mycore + flow: run + target: lint +``` diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..425ec30 --- /dev/null +++ b/action.yml @@ -0,0 +1,27 @@ +name: 'LibreCores CI with FuseSoC' +description: 'FuseSoC action on LibreCores CI' +inputs: + core: + description: 'Core identifier' + required: true + default: '' + flow: + description: 'Flow to execute (build, run, ...)' + required: true + default: 'build' + target: + description: 'Target' + required: false + default: '' + tool: + description: 'Tool to use' + required: false + pre-run-command: + description: 'Execute command before the run' + required: false +runs: + using: 'docker' + image: 'Dockerfile' +branding: + icon: 'cpu' + color: 'green' diff --git a/entrypoint.py b/entrypoint.py new file mode 100755 index 0000000..d12461d --- /dev/null +++ b/entrypoint.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 + +import subprocess +import sys, os + +from fusesoc.main import main + + +if __name__ == "__main__": + args = ["fusesoc", "--cores-root", "."] + args += [os.environ.get("INPUT_FLOW")] + if "INPUT_TARGET" in os.environ: + args += ["--target", os.environ.get("INPUT_TARGET")] + if "INPUT_TOOL" in os.environ: + args += ["--tool", os.environ.get("INPUT_TOOL")] + args += [os.environ.get("INPUT_CORE")] + + if "INPUT_PRE-RUN-COMMAND" in os.environ: + subprocess.call(os.environ.get("INPUT_PRE-RUN-COMMAND"), shell=True) + sys.argv = args + exit(main())