Skip to content

Commit 82eaa23

Browse files
committed
Adding pipeline
1 parent 28c9665 commit 82eaa23

File tree

4 files changed

+47
-2
lines changed

4 files changed

+47
-2
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
integration_tests:
10+
name: Run integration tests
11+
runs-on: ubuntu-16.04
12+
steps:
13+
- uses: actions/checkout@master
14+
- uses: actions/setup-node@v1
15+
with:
16+
node-version: '12.x'
17+
- name: Install Newman
18+
run: npm install -g newman
19+
- name: Integration Tests
20+
run: cd src && npm run test:integration

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Example REST API using the serverless stack from AWS: **Lambda, DynamoDB, SAM, A
1414
- [Post](#post)
1515
- [Comment](#comment)
1616
- [Integration Tests](#integration-tests)
17+
- [Github Actions pipeline](#github-actions-pipeline)
1718

1819
## Available endpoints:
1920
| Method | Resource |
@@ -161,12 +162,33 @@ Properties:
161162
```
162163

163164
## Integration Tests
164-
Find inside directory `integrationtests` a straightforward postman collection, including test assertions, testing every endpoint and a main application flow:
165+
Find inside directory `src/integrationtests` a straightforward postman collection, including test assertions, testing every endpoint and a main application flow:
165166
1. Create a Post
166167
2. Get all available Posts
167168
3. Get a specific Post checking structure
168169
4. Modify the Post's nickname
169170
5. Get it again to check whether it was modified correctly
170171
6. Add a Comment to the Post
171172
7. Delete the Comment
172-
8. Delete the Post
173+
8. Delete the Post
174+
175+
To run them, you have basically two options:
176+
- Import the collection in Postman and run them manually
177+
- Install Newman `npm install -g newman` and execute `npm run test:integration`
178+
179+
## Github Actions pipeline
180+
A very simple actions pipeline is provided in this project too. The file `.github/workflows/ci.yml` will create a pipeline which will trigger the postman collection automatically using newman against the production url for the api:
181+
```
182+
integration_tests:
183+
name: Run integration tests
184+
runs-on: ubuntu-16.04
185+
steps:
186+
- uses: actions/checkout@master
187+
- uses: actions/setup-node@v1
188+
with:
189+
node-version: '12.x'
190+
- name: Install Newman
191+
run: npm install -g newman
192+
- name: Integration Tests
193+
run: cd src && npm run test:integration
194+
```
File renamed without changes.

src/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"name": "serverless-aws",
33
"version": "1.0.0",
44
"description": "Serverless DynamoDB API in AWS using lambdas",
5+
"scripts": {
6+
"test:integration": "newman run integrationtests/postman.json"
7+
},
58
"author": "Javier Aviles",
69
"license": "Apache-2.0",
710
"dependencies": {

0 commit comments

Comments
 (0)