Skip to content

Postman Collection #110

Postman Collection

Postman Collection #110

# @author Jeff Carpenter
name: Postman Collection
# runs on
# * schedule (weekly)
# * manual trigger
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 0 * * SUN'
workflow_dispatch:
jobs:
# Runs Postman Collection against local Stargate instance using docker compose scripts
automated-api-tests:
runs-on: ubuntu-latest
env:
COLLECTION_ID: 25879866-1903b097-af32-4600-989d-2f68b01f0588
ENVIRONMENT_ID: 12949543-2e78cf27-bd8c-43f2-909f-70a2b87d65fe
steps:
# force checkout of main branch so we get a SHA that will have a corresponding docker image tag in ECR
- uses: actions/checkout@v4
with:
ref: main
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: maven
# login to ECR to we can pull coord image from there
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.ECR_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.ECR_SECRET_KEY }}
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
with:
mask-password: 'true'
# Run Stargate coordinator in developer mode to save time / resources
# Pull Data API image from ECR corresponding to latest commit on main branch
# Pull Stargate coordinator image from ECR corresponding to version dependency in project pom
# Retag images to remove repository name since start script does not expect it
- name: Start Backend
run: |
DATAAPITAG=$(git show -s --format="%H")
docker pull ${{ secrets.ECR_REPOSITORY }}/stargateio/jsonapi:$DATAAPITAG
docker image tag ${{ secrets.ECR_REPOSITORY }}/stargateio/jsonapi:$DATAAPITAG stargateio/data-api:$DATAAPITAG
cd docker-compose
./start_dse69.sh -j $DATAAPITAG
- name: Install Postman CLI
run: |
curl -o- "https://dl-cli.pstmn.io/install/linux64.sh" | sh
- name: Login to Postman CLI
run: postman login --with-api-key ${{ secrets.POSTMAN_API_KEY }}
- name: Run API test
run: |
postman collection run $COLLECTION_ID -e $ENVIRONMENT_ID --verbose
- name: Stop Backend
if: always()
run: |
cd docker-compose
docker compose logs data-api
docker compose down