Skip to content

Commit

Permalink
Setup CircleCI (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
lakkeger authored Apr 12, 2024
1 parent 76b9864 commit c32e540
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 0 deletions.
92 changes: 92 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
version: 2.1


orbs:
localstack: localstack/[email protected]


jobs:
save-state:
executor: localstack/default
steps:
- restore_cache:
keys:
- python-deps-{{ checksum "requirements-dev.txt" }}
- python-deps
- run:
name: Install Python 3.9
command: |
test -d /opt/circleci/.pyenv/versions/3.9.16 || pyenv install 3.9.16
pyenv global 3.9.16
- localstack/start
- checkout
- run:
name: Install dependencies
command:
pip3 install -r requirements-dev.txt --upgrade
- localstack/wait
- run:
name: Deploy infrastructure
command:
bin/deploy.sh
- run:
name: Export state
command: localstack state export ls-state.zip
- persist_to_workspace:
root: .
paths:
- ls-state.zip
- save_cache:
paths:
- /opt/circleci/.pyenv/versions/3.9.16
key: python-deps-{{ checksum "requirements-dev.txt" }}
- store_artifacts:
path: ls-state.zip


load-state:
executor: localstack/default
environment:
AWS_DEFAULT_REGION: us-east-1
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
DEBUG: 1
LS_LOG: trace
steps:
- restore_cache:
key: python-deps-
- run:
name: Choose python version
command:
pyenv global 3.9.16
- localstack/start
- checkout
- run:
name: Install dependencies
command:
pip3 install -r requirements-dev.txt
- localstack/wait
- attach_workspace:
at: .
- run:
name: Import state
command: test -f ls-state.zip && localstack state import ls-state.zip
- run:
name: Run Tests
command:
pytest tests
- run:
when: on_fail
name: Dump Localstack logs
command: localstack logs | tee localstack.log
- store_artifacts:
path: localstack.log


workflows:
do-tests:
jobs:
- save-state
- load-state:
requires: [save-state]
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Serverless image resizer

[![LocalStack Pods Launchpad](https://localstack.cloud/gh/launch-pod-badge.svg)](https://app.localstack.cloud/launchpad?url=https://github.com/localstack/sample-serverless-image-resizer-s3-lambda/releases/download/latest/release-pod.zip)
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/localstack-samples/sample-serverless-image-resizer-s3-lambda/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/localstack-samples/sample-serverless-image-resizer-s3-lambda/tree/main)

| Key | Value |
|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
Expand Down

0 comments on commit c32e540

Please sign in to comment.