Skip to content

Commit c32e540

Browse files
authored
Setup CircleCI (#23)
1 parent 76b9864 commit c32e540

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed

.circleci/config.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
version: 2.1
2+
3+
4+
orbs:
5+
localstack: localstack/platform@2.1
6+
7+
8+
jobs:
9+
save-state:
10+
executor: localstack/default
11+
steps:
12+
- restore_cache:
13+
keys:
14+
- python-deps-{{ checksum "requirements-dev.txt" }}
15+
- python-deps
16+
- run:
17+
name: Install Python 3.9
18+
command: |
19+
test -d /opt/circleci/.pyenv/versions/3.9.16 || pyenv install 3.9.16
20+
pyenv global 3.9.16
21+
- localstack/start
22+
- checkout
23+
- run:
24+
name: Install dependencies
25+
command:
26+
pip3 install -r requirements-dev.txt --upgrade
27+
- localstack/wait
28+
- run:
29+
name: Deploy infrastructure
30+
command:
31+
bin/deploy.sh
32+
- run:
33+
name: Export state
34+
command: localstack state export ls-state.zip
35+
- persist_to_workspace:
36+
root: .
37+
paths:
38+
- ls-state.zip
39+
- save_cache:
40+
paths:
41+
- /opt/circleci/.pyenv/versions/3.9.16
42+
key: python-deps-{{ checksum "requirements-dev.txt" }}
43+
- store_artifacts:
44+
path: ls-state.zip
45+
46+
47+
load-state:
48+
executor: localstack/default
49+
environment:
50+
AWS_DEFAULT_REGION: us-east-1
51+
AWS_REGION: us-east-1
52+
AWS_ACCESS_KEY_ID: test
53+
AWS_SECRET_ACCESS_KEY: test
54+
DEBUG: 1
55+
LS_LOG: trace
56+
steps:
57+
- restore_cache:
58+
key: python-deps-
59+
- run:
60+
name: Choose python version
61+
command:
62+
pyenv global 3.9.16
63+
- localstack/start
64+
- checkout
65+
- run:
66+
name: Install dependencies
67+
command:
68+
pip3 install -r requirements-dev.txt
69+
- localstack/wait
70+
- attach_workspace:
71+
at: .
72+
- run:
73+
name: Import state
74+
command: test -f ls-state.zip && localstack state import ls-state.zip
75+
- run:
76+
name: Run Tests
77+
command:
78+
pytest tests
79+
- run:
80+
when: on_fail
81+
name: Dump Localstack logs
82+
command: localstack logs | tee localstack.log
83+
- store_artifacts:
84+
path: localstack.log
85+
86+
87+
workflows:
88+
do-tests:
89+
jobs:
90+
- save-state
91+
- load-state:
92+
requires: [save-state]

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Serverless image resizer
22

33
[![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)
4+
[![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)
45

56
| Key | Value |
67
|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|

0 commit comments

Comments
 (0)