forked from jmug/stoatchat
feat: automate generating OpenAPI specification
This commit is contained in:
41
.github/workflows/rust.yaml
vendored
41
.github/workflows/rust.yaml
vendored
@@ -1,10 +1,10 @@
|
|||||||
name: Rust build and test
|
name: Rust build, test, and generate specification
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
branches: [master]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master ]
|
branches: [master]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
@@ -31,3 +31,38 @@ jobs:
|
|||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
command: test
|
command: test
|
||||||
|
|
||||||
|
- name: Copy .env.example
|
||||||
|
run: |
|
||||||
|
cp .env.example .env
|
||||||
|
|
||||||
|
- name: Run services in background
|
||||||
|
run: |
|
||||||
|
docker-compose up -d -f docker-compose.db.yml
|
||||||
|
|
||||||
|
- name: Start API in background
|
||||||
|
run: |
|
||||||
|
cargo run --bin revolt-delta &
|
||||||
|
|
||||||
|
- name: Wait for API to go up
|
||||||
|
uses: nev7n/wait_for_response@v1
|
||||||
|
with:
|
||||||
|
url: "http://localhost:8000/"
|
||||||
|
|
||||||
|
- name: Checkout API repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
repository: revoltchat/api
|
||||||
|
path: api
|
||||||
|
|
||||||
|
- name: Download OpenAPI specification
|
||||||
|
run: curl http://localhost:8000/openapi.json -o api/OpenAPI.json
|
||||||
|
|
||||||
|
- name: Commit changes
|
||||||
|
uses: EndBug/add-and-commit@v4
|
||||||
|
with:
|
||||||
|
cwd: "api"
|
||||||
|
add: "*.json"
|
||||||
|
message: "chore: generate OpenAPI specification"
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
9
docker-compose.db.yml
Normal file
9
docker-compose.db.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
version: "3.3"
|
||||||
|
services:
|
||||||
|
# MongoDB
|
||||||
|
database:
|
||||||
|
image: mongo
|
||||||
|
ports:
|
||||||
|
- "27017:27017"
|
||||||
|
volumes:
|
||||||
|
- ./.data/db:/data/db
|
||||||
Reference in New Issue
Block a user