Skip to content

Smoke tests for AWS SAM CLI #369

Smoke tests for AWS SAM CLI

Smoke tests for AWS SAM CLI #369

Workflow file for this run

name: Smoke tests for AWS SAM CLI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
schedule:
- cron: '0 5 * * *' # 05:00 server time every day
# Only one pull-request triggered run should be executed at a time
# (head_ref is only set for PR events, otherwise fallback to run_id which differs for every run).
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
env:
SAM_CLI_TELEMETRY: "0"
AWS_ACCESS_KEY_ID: "test"
AWS_SECRET_ACCESS_KEY: "test"
AWS_DEFAULT_REGION: us-east-1
AWS_REGION: us-east-1
AWS_ENDPOINT_URL: http://localhost:4566
VENV_DIR: ".venv"
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Start LocalStack
uses: LocalStack/[email protected]
with:
image-tag: 'latest'
install-awslocal: 'true'
- name: Install the package
run: |
make setup-venv
$VENV_DIR/bin/python -m pip install -e .
- name: Build the sam project
run: |
cd sample && \
../$VENV_DIR/bin/samlocal build --use-container
- name: Set up the stack
run: |
cd sample && \
../$VENV_DIR/bin/samlocal deploy --no-confirm-changeset
- name: Make a request into the endpoint
run: |
TEST_URL="$(aws cloudformation describe-stacks --stack-name sample | jq -r '.Stacks[0].Outputs[] | select(.OutputKey == "HelloWorldApi") | .OutputValue')" && \
echo "Making request against $TEST_URL" && \
RESULT="$(curl -v $TEST_URL)"
if [[ "$(echo "$RESULT" | jq .message -r)" != "hello world" ]]; then
echo "Invalid output $RESULT" >&2
exit 1
fi