GitFx can be used to run some functions and serve the output as a service in a Git hosting.
GitFx is a Python lib extracted from an action ActionServerless. And now the action uses this lib as a dependency to do the real job, you can run the lib locally in a same way as in the action.
- Python 3.5+
- Docker
pip3 install gitfx
# or
python3 -m pip install gitfx
Note: Python 2 is not supported
Let's start with a Python code that'll be used to create a serverless service:
# function.py
import json
# GET /api/py_hello.json
print(json.dumps({"hello": "world"}))
put the program to a path under current directory, for example, test
folder and run:
python3 -m gitfx test/
then the program's output is written to a file located in api/py_hello.json
that you defined as a route in the comment.
You can use the ActionServerless to run functions in GitHub, and also you can run locally as above example then push the generated files to the remote.
more languages' examples you can find here.
Language | Dependency Installation | Example code |
---|---|---|
Python | ✅ requirements.txt |
See |
Ruby | ✅ Gemfile |
See |
Node.js | ✅ package.json |
See |
Perl | ✅ cpanfile |
See |
Golang | ⬜️ not supported yet | See |
Haskell | ⬜️ not supported yet | See |
Elixir | ⬜️ not supported yet | See |
PHP | ⬜️ not supported yet | See |
Bash | - | See |
Rust | ⬜️ not supported yet | See |
Contributions are welcome! You may check the following features in case you'd like to contribute but no idea what to do:
- Support to add your favorite languages
- Support dependency installation to the existing languages
- Use this action to create an application and share it