1+ name : Test Released Cloud Pods
2+
3+ on :
4+ # schedule: TODO activate
5+ # “At 00:00 on Saturday.”
6+ # - cron: "0 0 * * 6"
7+ workflow_dispatch :
8+ push : # TODO remove
9+ paths-ignore :
10+ - ' README.md'
11+ branches :
12+ - cloudpod_workflow
13+
14+ jobs :
15+ get-releases :
16+ name : Retrieve Released Cloud Pods
17+ runs-on : ubuntu-latest
18+ outputs :
19+ matrix : ${{ steps.set-matrix.outputs.matrix }}
20+ steps :
21+ - id : set-matrix
22+ run : echo "::set-output name=matrix::$(gh api repos/$GITHUB_REPOSITORY/releases | jq -r '[.[].tag_name]')"
23+
24+ test-pod-release :
25+ needs : get-releases
26+ runs-on : ubuntu-latest
27+ strategy :
28+ matrix :
29+ tag : ${{ fromJson(needs.get-releases.outputs.matrix) }}
30+ db : ['mariadb', 'mysql']
31+ steps :
32+ - name : Start LocalStack Default
33+ env :
34+ LOCALSTACK_API_KEY : ${{ secrets.LOCALSTACK_API_KEY }}
35+ LOCALSTACK_VOLUME_DIR : ${{ github.workspace }}/ls_test
36+ MYSQL_FEATURE_FLAG : ${{ matrix.mysql-feature-flag }}
37+ run : |
38+ mkdir ls_test
39+ ls -la ls_test
40+ docker pull localstack/localstack-pro:${{ matrix.tag }}
41+ # Start LocalStack in the background
42+ if [ "mysql" == ${MYSQL_FEATURE_FLAG} ]; then
43+ LS_LOG=trace RDS_MYSQL_DOCKER=1 localstack start -d
44+ else
45+ LS_LOG=trace localstack start -d
46+ # Wait 30 seconds for the LocalStack container to become ready before timing out
47+ echo "Waiting for LocalStack startup..."
48+ localstack wait -t 15
49+ echo "Startup complete"
50+ - name : Retrieve Pod mariadb
51+ uses : dsaltares/fetch-gh-release-asset@master
52+ with :
53+ repo : ' dsaltares/godot-wild-jam-18'
54+ version : ' tags/${{ matrix.tag }}'
55+ file : ' release-pod-${{ matrix.db }}.zip'
56+ target : ' ./release-pod.zip'
57+ - name : Inject mariadb pod
58+ run : localstack pod load file://release-pod.zip
59+ - name : Run Smoke Tests
60+ run : |
61+ 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"}' output
62+ echo "show tables:"
63+ cat output
64+ 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"}' output
65+ echo "select Author from Books:"
66+ cat output
67+ return_status=$(cat output | jq -r .status)
68+ if [ "SUCCESS" != ${return_status} ]; then
69+ echo "unexpected response: ${return_status}"
70+ cat output
71+ exit 1
72+ fi
73+
0 commit comments