-
Notifications
You must be signed in to change notification settings - Fork 3
63 lines (54 loc) · 2.69 KB
/
staging.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
name: deploy staging
on:
push:
branches: [release/*]
jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.x"
- uses: actions/setup-node@v1
with:
node-version: "12"
- name: yarn ci
run: yarn install --frozen-lockfile
- name: unit tests
run: |
CREDS=`aws sts assume-role --role-arn arn:aws:iam::${{ secrets.STAGING_ACCOUNT_ID }}:role/appsync-crud-sls-ci-role --role-session-name=ci_user`
export AWS_ACCESS_KEY_ID=`echo $CREDS | jq -r '.Credentials.AccessKeyId'`
export AWS_SECRET_ACCESS_KEY=`echo $CREDS | jq -r '.Credentials.SecretAccessKey'`
export AWS_SESSION_TOKEN=`echo $CREDS | jq -r '.Credentials.SessionToken'`
yarn run export-env-staging
yarn run unit-test
- name: integration tests
run: |
CREDS=`aws sts assume-role --role-arn arn:aws:iam::${{ secrets.STAGING_ACCOUNT_ID }}:role/appsync-crud-sls-ci-role --role-session-name=ci_user`
export AWS_ACCESS_KEY_ID=`echo $CREDS | jq -r '.Credentials.AccessKeyId'`
export AWS_SECRET_ACCESS_KEY=`echo $CREDS | jq -r '.Credentials.SecretAccessKey'`
export AWS_SESSION_TOKEN=`echo $CREDS | jq -r '.Credentials.SessionToken'`
yarn run export-env
yarn run integration-test
- name: deploy to staging
run: |
CREDS=`aws sts assume-role --role-arn arn:aws:iam::${{ secrets.STAGING_ACCOUNT_ID }}:role/appsync-crud-sls-ci-role --role-session-name=ci_user`
export AWS_ACCESS_KEY_ID=`echo $CREDS | jq -r '.Credentials.AccessKeyId'`
export AWS_SECRET_ACCESS_KEY=`echo $CREDS | jq -r '.Credentials.SecretAccessKey'`
export AWS_SESSION_TOKEN=`echo $CREDS | jq -r '.Credentials.SessionToken'`
yarn run deploy -s staging
- name: e2e tests
run: |
CREDS=`aws sts assume-role --role-arn arn:aws:iam::${{ secrets.STAGING_ACCOUNT_ID }}:role/appsync-crud-sls-ci-role --role-session-name=ci_user`
export AWS_ACCESS_KEY_ID=`echo $CREDS | jq -r '.Credentials.AccessKeyId'`
export AWS_SECRET_ACCESS_KEY=`echo $CREDS | jq -r '.Credentials.SecretAccessKey'`
export AWS_SESSION_TOKEN=`echo $CREDS | jq -r '.Credentials.SessionToken'`
yarn run export-env-staging
yarn run e2e-test