Skip to content

Commit

Permalink
feat(ci): add local state test
Browse files Browse the repository at this point in the history
  • Loading branch information
lakkeger committed May 15, 2024
1 parent 13e0c9a commit 31d526e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
33 changes: 32 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,37 @@ jobs:
with:
state-name: cloud-pods-test
state-action: save
no-startup: 'true'
skip-startup: 'true'
env:
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}

local-state-test:
name: 'Test Local State Action'
runs-on: ubuntu-latest
steps:
- name: ⚡️ Checkout the repository
uses: actions/checkout@v3

- name: Start LocalStack
uses: ./
with:
image-tag: 'latest'
install-awslocal: 'true'
use-pro: 'true'
env:
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}

- name: Run AWS commands
run: |
awslocal s3 mb s3://test
awslocal sqs create-queue --queue-name test-queue
- name: Save the State into Artifact
uses: ./
with:
state-name: state-test
state-action: save
state-backend: local
skip-startup: 'true'
env:
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ inputs:
Defaults to `` (empty) -> don't manage state
required: false
default: ''
state-local:
state-backend:
description: |
Either store the state of LocalStack locally or as a cloud pod.
Valid values are `cloud-pods` or `local`.
Expand Down Expand Up @@ -105,7 +105,7 @@ runs:
env:
action-version: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }}
with:
uses: LocalStack/setup-localstack/${{ inputs.state-local }}@${{ env.action-version }}
uses: LocalStack/setup-localstack/${{ inputs.state-backend }}@${{ env.action-version }}
with: |-
{
"name": "${{ inputs.state-name }}",
Expand Down
4 changes: 2 additions & 2 deletions local/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ runs:
- run: |
if [ "$ACTION" = "save" ]; then
echo "Saving State $NAME"
localstack state export $NAME
localstack state export ${NAME}.zip
elif [ "$ACTION" = "load" ]; then
echo "Loading State $NAME"
localstack state import $NAME
localstack state import ${NAME}.zip
else
echo "Invalid action: $ACTION"
exit 1
Expand Down

0 comments on commit 31d526e

Please sign in to comment.