11name : Test Released Cloud Pods
22
33on :
4- # schedule: TODO activate
4+ schedule :
55 # “At 00:00 on Saturday.”
6- # - cron: "0 0 * * 6"
6+ - cron : " 0 0 * * 6"
77 workflow_dispatch :
88 push : # TODO remove
99 paths-ignore :
1010 - ' README.md'
1111 branches :
1212 - cloudpod_workflow
1313
14+ permissions :
15+ contents : write
16+
1417jobs :
1518 get-releases :
1619 name : Retrieve Released Cloud Pods
@@ -46,13 +49,16 @@ jobs:
4649 download_url="https://github.com/$GITHUB_REPOSITORY/releases/download/${{ matrix.tag }}/release-pod-${{ matrix.db }}.zip"
4750 curl -L $download_url --output release-pod.zip
4851 ls -la
52+
4953 - name : Setup Python
5054 uses : actions/setup-python@v4
5155 with :
5256 python-version : ' 3.9'
57+
5358 - name : Install Dependencies
5459 run : |
5560 pip install localstack awscli-local
61+
5662 - name : Start LocalStack
5763 env :
5864 LOCALSTACK_API_KEY : ${{ secrets.LOCALSTACK_API_KEY }}
7480 echo "Waiting for LocalStack startup..."
7581 localstack wait -t 15
7682 echo "Startup complete"
83+
7784 - name : Inject Pod
7885 run : |
7986 localstack pod load file://release-pod.zip
@@ -82,29 +89,33 @@ jobs:
8289 sleep 1
8390 state=$(awslocal rds describe-db-instances | jq -r ".DBInstances[0].DBInstanceStatus")
8491 done
92+
8593 - name : Run Smoke Tests
8694 run : |
87- awslocal lambda invoke --cli-binary-format raw-in-base64-out --function-name my-lambda-rds-query-helper --payload '{"sqlQuery": "show tables", "secretName":"/rdsinitexample/rds/creds/mysql-01"}' output1
88- echo "show tables:"
89- cat output1
90- awslocal lambda invoke --cli-binary-format raw-in-base64-out --function-name my-lambda-rds-query-helper --payload '{"sqlQuery": "select Author from Books", "secretName":"/rdsinitexample/rds/creds/mysql-01"}' output2
91- echo "select Author from Books:"
92- cat output2
93- return_status1=$(cat output1 | jq -r .status)
94- if [ "SUCCESS" != ${return_status1} ]; then
95- echo "unexpected response for query1: ${return_status1}"
96- cat output1
97- exit 1
98- fi
99- return_status2=$(cat output2 | jq -r .status)
100- if [ "SUCCESS" != ${return_status2} ]; then
101- echo "unexpected response for query2: ${return_status2}"
102- cat output2
103- exit 1
104- fi
95+ ./test-helper/smoke-test.sh
96+
10597 - name : Show Logs
10698 if : failure()
10799 run : |
108100 localstack logs
109- # TODO add slack notification
110- # add https://github.com/marketplace/actions/keepalive-workflow + adapt commit message https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs
101+
102+ - name : Send a Slack notification
103+ if : failure() || github.event_name != 'pull_request'
104+ uses : ravsamhq/notify-slack-action@v2
105+ with :
106+ status : ${{ job.status }}
107+ token : ${{ secrets.GITHUB_TOKEN }}
108+ notification_title : " {workflow} has {status_message}"
109+ message_format : " {emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
110+ footer : " Linked Repo <{repo_url}|{repo}> | <{run_url}|View Workflow run>"
111+ notify_when : " failure"
112+ env :
113+ SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
114+
115+ - name : Prevent Workflows from getting Stale
116+ if : always()
117+ uses : gautamkrishnar/keepalive-workflow@v1
118+ with :
119+ # this message should prevent automatic triggering of workflows
120+ # see https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs
121+ commit_message : " [skip ci] Automated commit by Keepalive Workflow to keep the repository active"
0 commit comments