mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-06-28 16:20:34 +08:00
0f607c7a28
- copies that openapi.json file to docs/docs/api/openapi.json as part of start-mock-server.sh. - adds a step to the end of the test-api-contract workflow that just auto-commits changes to the docs/docs/api/openapi.json file. - excludes docs/docs/api/openapi.json from pre-commit since its already been formatted by jq.
54 lines
1.3 KiB
YAML
54 lines
1.3 KiB
YAML
name: Test API Contract
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- add-api-docs-workflow
|
|
paths:
|
|
- "oasst-shared/**"
|
|
- "backend/**"
|
|
- "website/**"
|
|
pull_request:
|
|
paths:
|
|
- "oasst-shared/**"
|
|
- "backend/**"
|
|
- "website/**"
|
|
workflow_call:
|
|
|
|
jobs:
|
|
test-contract:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.10"
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 16
|
|
|
|
- run: cd oasst-shared && pip install -e .
|
|
|
|
- run: cd oasst-shared && pip install -r requirements.dev.txt
|
|
|
|
- run: cd backend && pip install -r requirements.txt
|
|
|
|
- run: cd website && npm ci
|
|
|
|
- run: ./scripts/backend-development/start-mock-server.sh
|
|
|
|
- name: Run Python OasstApiClient contract tests
|
|
run: ./scripts/oasst-shared-development/test.sh
|
|
|
|
- name: Run JavaScript OasstApiClient contract tests
|
|
run: ./scripts/frontend-development/run-contract-test.sh
|
|
|
|
- run: ./scripts/backend-development/stop-mock-server.sh
|
|
|
|
- uses: stefanzweifel/git-auto-commit-action@v4
|
|
with:
|
|
file_pattern: "docs/docs/api/openapi.json"
|
|
commit_message:
|
|
update docs/docs/api/openapi.json by run ${{ github.run_id }}
|