π€ A CI tool for monitoring a specific API end points and keeping fake API server always up-to-date.
Overview | Python versions support | Quickly Start | Documentation
Do you ever have experience about Back-End side does something change on the sly, but they don't sync the change with Font-End side and cause it be broken? Even you may have tool which could fake an API server, but you still need to update it manually (if you know the change). This tool Fake-API-Server-Surveillance targets to resolve this issue by everyone could automate the process about monitoring and updating the fake server which be built by Fake-API-Server.
The code base of PyFake-API-Server-Surveillance depends on another library Fake-API-Server. So it also only supports Python 3.8 version up.
Here section would lead you quickly start to set up your first automation with PyFake-API-Server-Surveillance for keep monitoring Back-End side and keep the fake server always be the latest version under surveillance easily.
In basically, it has 3 steps: prepare your fake server, configure PyFake-API-Server-Surveillance and set action for GitHub Action.
First of all, this tool only for Fake-API-Server. So you must have a GitHub project which records the details configuration of Fake-API-Server.
The detail settings of Fake-API-Server-Surveillance would be configured by YAML file. Here provide a sample configuration:
api-doc-url: 'http://127.0.0.1:1111/swagger-api'
fake-api-server:
server-type: rest-server
subcmd:
pull:
args:
- --config-path=./api.yaml
- --include-template-config
- --base-file-path=./
- --base-url=/test/v1
- --divide-api
git-info:
repo: 'TestUser/Back-End-Project'
commit:
author:
name: 'TestUser'
email: 'test@gmail.com'
message: ' π§ͺ test commit message.'
github-info:
pull-request:
title: 'π€ Update API configuration'
body: 'π§ test content ...'
draft: true
labels:
- 'π€ update by bot'Add a single CI workflow which only for monitoring Back-End side change as a scheduler:
name: Monitor Back-End API interface
on:
# In generally, it's reasonable that using schedule feature of GitHub Action to monitor the Back-End side API change..
schedule:
- cron: "15 4,5 * * *" # <=== Change this value
permissions:
contents: write # Need this to push commits
pull-requests: write # Need this to open pull request
jobs:
monitor-and-update:
runs-on: ubuntu-latest
steps:
# Clone the fake-api-server config
- name: Clone project
uses: actions/checkout@v4
# Monitor and update the config if it needs by opening pull request
- name: Run Fake-API-Server-Surveillance
uses: actions/PyFake-API-Server-Surveillance@v0.2.0
with:
config-path: <your fake-api-server-surveillance config>
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}Congratulation! Now, you could just have a coffee and do anything you want to do without being worry about the fake server be expired. The CI workflow would be the trustworthy partner to help you keep monitoring and updating the fake server if it needs without missing any change.
The documentation contains more details, demonstrations and anything you need about PyFake-API-Server-Surveillance.
- Getting start helps you start to prepare environment, install dependencies and configure the detail settings with explanation in detail.
- How to configure the details of surveillance?
- I have configuration right now. How can I set up a monitoring automation by CI?
- Want to learn more how to use it?
- Want to know more detail settings to customize surveillance?
- About the release notes.
PyFake-API-Server-Surveillance follows coding styles black and PyLint to control code quality.
PyFake-API-Server-Surveillance still a young open source which keep growing. Here's its download state: