Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/pr-checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Sandbox Check
on: pull_request
jobs:
test-sandbox-and-postman:
name: "Test Sandbox and Postman"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v6
with:
python-version: "3.13"
cache: "poetry"
- name: Install dependencies
run: make install
- name: Install Sandobx dependencies
run: make install
working-directory: sandbox
- name: Check Sandbox Formatting
run: make format
- name: Run Sandbox Linting
run: make lint
- name: Run Sandbox Unit Tests
run: make test
working-directory: sandbox
- name: Test Postman Collection agaist Sandbox
working-directory: sandbox
run: |
# 1. Run Flask in the background (using 'poetry run python -m flask')
# We use FLASK_DEBUG=1 to see the 500 errors in the console
cp -r $GITHUB_WORKSPACE/specification/examples/responses/. $GITHUB_WORKSPACE/sandbox/api/examples/
FLASK_DEBUG=1 poetry run python -m flask --app api.app:app run -p 9000 &
FLASK_PID=$!

# 2. Use npx to wait for the server to actually be ready
npx wait-on http://127.0.0.1:9000/health --timeout 30000

# 3. Run your tests
echo "Running Newman tests..."
npx newman run ../postman/validated_relationship_service.sandbox.postman_collection.json --env-var baseUrl=http://127.0.0.1:9000/FHIR/R4

# 4. Cleanup: Kill the Flask process using the PID we saved
echo "Shutting down Flask..."
kill $FLASK_PID
30 changes: 0 additions & 30 deletions .github/workflows/push-collection-to-postman.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ name: Push Postman collection changes to public collection
on:
workflow_dispatch:
inputs:
should_push_sandbox:
type: boolean
description: Push Sandbox collection
default: false
should_push_integration:
type: boolean
description: Push Integration collection
Expand All @@ -27,7 +23,6 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}
outputs:
sandbox: ${{ steps.filter.outputs.sandbox }}
integration: ${{ steps.filter.outputs.integration }}
steps:
- name: Checkout
Expand All @@ -38,34 +33,9 @@ jobs:
id: filter
with:
filters: |
sandbox:
- './postman/validated_relationship_service.sandbox.postman_collection.json'
integration:
- './postman/validated_relationship_service.integration.postman_collection.json'

push-sandbox-postman:
name: Push Sandbox collection to Postman
runs-on: ubuntu-latest
needs: [detect-changes]
if: |
always () && (
(github.event_name == 'push' && needs.detect-changes.outputs.sandbox == 'true') ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.should_push_sandbox == 'true')
)
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Push Sandbox Postman collection
id: push_sandbox_postman_collection
uses: gcatanese/push-to-postman-action@main
with:
goal: update
postman-key: ${{ secrets.POSTMAN_API_KEY }}
postman-file: './postman/validated_relationship_service.sandbox.postman_collection.json'
collection-id: ${{ secrets.POSTMAN_SANDBOX_COLLECTION_ID }}

push-integration-postman:
name: Push Integration collection to Postman
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-postman-collection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
- name: Install Newman
run: npm install -g newman
- name: Run Postman Collection
run: newman run "./postman/Validated Relationship Service Sandbox.postman_collection.json"
run: newman run "./postman/validated_relationship_service.sandbox.postman_collection.json"
26 changes: 0 additions & 26 deletions .github/workflows/sandbox-checks.yaml

This file was deleted.

10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ clean:
rm -rf build
rm -rf dist

# Generate Postman Collection
generate-postman-collection:
npx portman --cliOptionsFile scripts/portman/portman-cli.json

# Test Postman Collection
test-postman-collection:
# Optional arguments:
# SANDBOX_BASE_URL: The base URL for the sandbox environment (default is https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4)
npx newman run postman/validated_relationship_service.sandbox.postman_collection.json --env-var baseUrl=$(SANDBOX_BASE_URL)

#Creates the fully expanded OAS spec in json
publish: clean
mkdir -p build
Expand Down
Loading
Loading