From 857eaf26b1327049a9ff1a8157e17fb7a9a6044c Mon Sep 17 00:00:00 2001 From: Jack Michaud Date: Sun, 1 Jan 2023 13:02:52 -0500 Subject: [PATCH 1/2] ci: add Test API Contract workflow --- .github/workflows/test-api-contract.yaml | 33 +++++++++++++++++++ .../backend-development/stop-mock-server.sh | 3 ++ 2 files changed, 36 insertions(+) create mode 100644 .github/workflows/test-api-contract.yaml create mode 100755 scripts/backend-development/stop-mock-server.sh diff --git a/.github/workflows/test-api-contract.yaml b/.github/workflows/test-api-contract.yaml new file mode 100644 index 00000000..e863974c --- /dev/null +++ b/.github/workflows/test-api-contract.yaml @@ -0,0 +1,33 @@ +name: Test API Contract + +on: + push: + branches: + - main + pull_request: + workflow_call: + +jobs: + test-contract: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - run: cd oasst-shared && pip install -e . + + - run: cd discord-bot && pip install -r requirements.txt + + - run: cd discord-bot && pip install -r requirements.dev.txt + + - run: ./scripts/backend-development/start-mock-server.sh + + # runs the contract tests. currently the api client is + # found in the discord bot code, but this should be updated + # once the client moves into oasst-shared. + - name: Run contract tests + run: ./scripts/discord-bot-development/test.sh + + - run: ./scripts/backend-development/stop-mock-server.sh diff --git a/scripts/backend-development/stop-mock-server.sh b/scripts/backend-development/stop-mock-server.sh new file mode 100755 index 00000000..20248aaa --- /dev/null +++ b/scripts/backend-development/stop-mock-server.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +docker stop oasst-mock-backend From 5de4ea9ebc5efc28c4c0274639fe9fb9483027b8 Mon Sep 17 00:00:00 2001 From: Jack Michaud Date: Sun, 1 Jan 2023 13:08:25 -0500 Subject: [PATCH 2/2] ci: install backend dependencies for generating openapi --- .github/workflows/test-api-contract.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-api-contract.yaml b/.github/workflows/test-api-contract.yaml index e863974c..e75e5375 100644 --- a/.github/workflows/test-api-contract.yaml +++ b/.github/workflows/test-api-contract.yaml @@ -18,6 +18,8 @@ jobs: - run: cd oasst-shared && pip install -e . + - run: cd backend && pip install -r requirements.txt + - run: cd discord-bot && pip install -r requirements.txt - run: cd discord-bot && pip install -r requirements.dev.txt