Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 131 additions & 0 deletions .github/workflows/cloud-pods.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: Create and Test Cloud Pods

on:
schedule:
# At 00:00 on Saturday.
- cron: "0 0 * * 6"
push:
branches:
- main
workflow_dispatch:

permissions:
contents: write
actions: read

jobs:
create-cloud-pod:
name: Create Cloud Pods
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Nodejs
uses: actions/setup-node@v3
with:
node-version: 22
cache: 'npm'

- name: Install dependencies
run: |
make install

- name: Start LocalStack
uses: LocalStack/setup-localstack@main
with:
image-tag: 'latest'
use-pro: 'true'
configuration: LS_LOG=trace
install-awslocal: 'true'
env:
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}

- name: Deploy the application
env:
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
AWS_DEFAULT_REGION: us-east-1
run: |
make build
make bootstrap
make deploy

- name: Create Cloud Pod
env:
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
run: |
message="Cloud Pod created: sample-cdk-rds on $(date) with workflow run id: ${{ github.run_id }}"
localstack pod save sample-cdk-rds --message "$message"

- name: Show LocalStack Logs
if: always()
run: |
localstack logs

test-cloud-pod:
name: Test Cloud Pod
needs: create-cloud-pod
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Nodejs
uses: actions/setup-node@v3
with:
node-version: 22
cache: 'npm'

- name: Start LocalStack
uses: LocalStack/setup-localstack@main
with:
use-pro: 'true'
install-awslocal: 'true'
env:
DEBUG: 1
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}

- name: Load Cloud Pod
env:
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
run: |
localstack pod load sample-cdk-rds

- name: Install dependencies
run: |
npm install

- name: Run Integration Tests
run: |
npm test

- name: Show LocalStack Logs
if: always()
run: |
localstack logs

- name: Send a Slack notification
if: failure() || github.event_name != 'pull_request'
uses: ravsamhq/notify-slack-action@v2
with:
status: ${{ job.status }}
token: ${{ secrets.GITHUB_TOKEN }}
notification_title: "{workflow} has {status_message}"
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Workflow run>"
notify_when: "failure"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

- name: Generate a Diagnostic Report
if: failure()
run: |
curl -s localhost:4566/_localstack/diagnose | gzip -cf > diagnose.json.gz

- name: Upload the Diagnostic Report
if: failure()
uses: actions/upload-artifact@v4
with:
name: diagnose.json.gz
path: ./diagnose.json.gz
17 changes: 17 additions & 0 deletions .github/workflows/keepalive.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Keep Alive
on:
schedule:
- cron: "0 0 * * *"
jobs:
main-job:
name: Main Job
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
workflow-keepalive:
if: github.event_name == 'schedule'
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- uses: liskin/gh-workflow-keepalive@v1
35 changes: 13 additions & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy on LocalStack
name: Deploy on LocalStack with CDK

on:
push:
Expand All @@ -15,41 +15,32 @@ on:
workflow_dispatch:

jobs:
smoke-test:
name: Setup infrastructure
integration-tests:
name: Run Integration Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
uses: actions/checkout@v4

- name: Setup Nodejs
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 22
cache: 'npm'

- name: Install dependencies
run: |
make install

- name: Start LocalStack
uses: LocalStack/setup-localstack@v0.2.4
with:
image-tag: 'latest'
use-pro: 'true'
configuration: LS_LOG=trace
install-awslocal: 'true'
env:
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
LOCALSTACK_VOLUME_DIR: ${{ github.workspace }}/ls_test
run: |
mkdir ls_test
ls -la ls_test
docker pull localstack/localstack-pro:latest
# Start LocalStack in the background
LS_LOG=trace localstack start -d
# Wait 30 seconds for the LocalStack container to become ready before timing out
echo "Waiting for LocalStack startup..."
localstack wait -t 15
echo "Startup complete"
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}

- name: Deploy the application
env:
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ node_modules
cdk.out

.npmrc

package-lock.json
Loading