-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (66 loc) · 2.97 KB
/
karate.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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}}