From 2dd90f83299650c1b0ebd2ed7ee14dca003cd95b Mon Sep 17 00:00:00 2001 From: Frank Kilcommins Date: Tue, 24 Oct 2023 22:30:58 +0100 Subject: [PATCH] add schemathesis --- .github/workflows/API-Provider-CI.yaml | 31 +++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/.github/workflows/API-Provider-CI.yaml b/.github/workflows/API-Provider-CI.yaml index 070f330..f14663b 100644 --- a/.github/workflows/API-Provider-CI.yaml +++ b/.github/workflows/API-Provider-CI.yaml @@ -15,7 +15,7 @@ env: jobs: lint-api: - name: Run Spectral + name: linting-api runs-on: ubuntu-latest steps: # Check out the repository @@ -30,9 +30,34 @@ jobs: file_glob: 'apis/*.yaml' spectral_ruleset: '.spectral.yaml' - functional-test-api: + + validation-implementation: needs: lint-api runs-on: ubuntu-latest + steps: + - name: 'Checkout code' + uses: actions/checkout@main + - name: Setup the stack + run: docker-compose up -d + - name: Get Container Name + id: get-container + run: | + docker ps -a + CONTAINER_ID=$(docker ps -aqf "name=webinar-security-by-design_web_1") + echo "::set-output name=container_id::$CONTAINER_ID" + - name: Migrate DB and Seed within ${{ steps.get-container.outputs.container_id }} + run: | + docker exec -t ${{ steps.get-container.outputs.container_id }} alembic upgrade heads + docker exec ${{ steps.get-container.outputs.container_id }} python src/fixtures.py + - uses: schemathesis/action@v1 + with: + schema: './apis/crapi.yaml' + base-url: 'http://0.0.0.0:8000' + args: '--dry-run --validate-schema true' + + functional-test-api: + needs: [lint-api, validation-implementation] + runs-on: ubuntu-latest steps: - name: 'Checkout code' uses: actions/checkout@main @@ -57,7 +82,7 @@ jobs: ENDPOINT: http://0.0.0.0:8000 security-test-api: - needs: [lint-api, functional-test-api] + needs: [lint-api, validation-implementation, functional-test-api] runs-on: ubuntu-latest steps: - name: 'Checkout code'