Np 45284 person nvi data (#329) #1708
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Karate API tests | |
on: [ push ] | |
env: | |
STACK_NAME: cristin-$GITHUB_REF_NAME | |
BASE_PATH: cristin-$GITHUB_REF_NAME | |
DOMAIN_NAME: "api.dev.nva.aws.unit.no" | |
CRISTIN_API_URL: "https://api.cristin-test.uio.no/v2" | |
COGNITO_USER_POOL_ID: "eu-west-1_nLV9i5X5D" | |
COGNITO_CLIENT_APP_ID: "5qo1p8hv58o6f4ke2p72h69pjm" | |
ADMIN_TESTUSER_ID: "karate-admin-user" | |
ADMIN_TESTUSER_NIN: ${{ secrets.COGNITO_ADMIN_TESTUSER_NIN }} | |
ADMIN_TESTUSER_PASSWORD: ${{ secrets.COGNITO_ADMIN_TESTUSER_PASSWORD }} | |
SIMPLE_TESTUSER_ID: "karate-simple-user" | |
SIMPLE_TESTUSER_PASSWORD: ${{ secrets.COGNITO_SIMPLE_TESTUSER_PASSWORD }} | |
SIMPLE_TESTUSER_NIN: ${{ secrets.COGNITO_SIMPLE_TESTUSER_NIN }} | |
BACKEND_CLIENT_ID: "7vt27od1nkei5mepcv3df98c5k" | |
BACKEND_CLIENT_ID_SECRET: ${{ secrets.COGNITO_BACKEND_CLIENT_ID_SECRET }} | |
CRISTIN_EMPLOYMENT_TEST_PERSON_IDENTIFIER: "538786" | |
COGNITO_AUTHENTICATION_DOMAIN: "nva-dev.auth.eu-west-1.amazoncognito.com" | |
CRISTIN_BOT_FILTER_BYPASS_HEADER_NAME: "Hello" | |
CRISTIN_BOT_FILTER_BYPASS_HEADER_VALUE: "World" | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: "3.8" | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: corretto | |
- name: Setup AWS SAM CLI | |
uses: aws-actions/setup-sam@v1 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@master | |
with: | |
role-to-assume: arn:aws:iam::884807050265:role/nva-dev-github-actions-role | |
aws-region: eu-west-1 | |
- name: Build | |
run: sam build | |
# Prevent prompts and failure when the stack is unchanged | |
- name: Deploy | |
run: sam deploy --resolve-s3 --no-confirm-changeset --no-fail-on-empty-changeset --stack-name ${{env.STACK_NAME}} --parameter-overrides ParameterKey=CustomDomain,ParameterValue=${DOMAIN_NAME} ParameterKey=CustomDomainBasePath,ParameterValue=${{env.BASE_PATH}} ParameterKey=CristinApiUrl,ParameterValue=${CRISTIN_API_URL} | |
# Delete existing tests users | |
- name: Delete karate test users | |
run: BASE_PATH=${{env.BASE_PATH}} ./gradlew deleteTestUsers --info | |
# Create test users in cognito | |
- name: Create karate test users | |
run: BASE_PATH=${{env.BASE_PATH}} ./gradlew createTestUsers --info | |
- name: Sleep to let user settle | |
run: sleep 10 | |
# Run karate tests on deployed api | |
- name: Run karate tests with Gradle | |
run: BASE_PATH=${{env.BASE_PATH}} ./gradlew karateTest --info | |
# Delete tests users after tests have run | |
- name: Delete karate test users | |
run: BASE_PATH=${{env.BASE_PATH}} ./gradlew deleteTestUsers --info | |
# Delete stack after running tests | |
- name: Delete stack after running tests | |
run: sam delete --no-prompts --region eu-west-1 --stack-name ${{env.STACK_NAME}} |