Add postman and update README
This commit is contained in:
parent
8e5c347873
commit
2952119198
2 changed files with 207 additions and 3 deletions
62
README.md
62
README.md
|
@ -1,6 +1,62 @@
|
|||
# Setup a CI/CD Pipeline Using GitHub Actions
|
||||
The code from my YouTube video on "Setup a CI/CD Pipeline Using GitHub Actions"
|
||||
|
||||
The purpose of this project is to show how you can use GitHub actions for CI/CD pipelines.
|
||||
This project includes the code from my YouTube video on "Setup a CI/CD Pipeline Using GitHub Actions" (to be released)
|
||||
|
||||
This project includes
|
||||
The purpose of this project is to show how you can use GitHub Actions as CI/CD pipeline instead of using tools such as TeamCity and Octopus.
|
||||
|
||||
This application is made up of the following projects:
|
||||
|
||||
| Project Name | Description |
|
||||
| --------------------------------------- | -------------------------------------------- |
|
||||
| [GitHubActionsDemo.Api](src/GitHubActionsDemo.Api/) | Controllers and validation for the API |
|
||||
| [GitHubActionsDemo.Api.Sdk](src/GitHubActionsDemo.Api.Sdk/) | Contracts and Refit SDK |
|
||||
| [GitHubActionsDemo.Service](src/GitHubActionsDemo.Service) | Business Logic Layer |
|
||||
| [GitHubActionsDemo.Persistance](src/GitHubActionsDemo.Persistance) | Code for setup and writing to the database |
|
||||
| [GitHubActionsDemo.Api.Unit.Tests](test/GitHubActionsDemo.Api.Unit.Tests) | API unit tests with xunit |
|
||||
| [GitHubActionsDemo.Service.Unit.Tests](test/GitHubActionsDemo.Service.Unit.Tests) | Service unit tests with xunit |
|
||||
| [GitHubActionsDemo.Api.Integration.Tests](test/GitHubActionsDemo.Api.Integration.Tests) | Integration tests using Refit SDK with xunit |
|
||||
|
||||
## Running the project
|
||||
|
||||
In order to run the API you need to have the database running. You can run the following to spin up the database and the API.
|
||||
|
||||
**Mac & Linux**
|
||||
```bash
|
||||
export VERSION=0.1.0; docker-compose up
|
||||
```
|
||||
|
||||
**Windows**
|
||||
```
|
||||
SET VERSION=0.1.0
|
||||
docker-compose up
|
||||
```
|
||||
|
||||
The API running in Docker uses port 5200. You can also run the API using `dotnet run` from the `GitHubActionsDemo.Api` folder.
|
||||
|
||||
You can find a postman collection for all of the API calls in the [docs](docs) folder.
|
||||
|
||||
## Running the tests
|
||||
The tests can be run from the root folder using `dotnet test`. This will run both the unit tests and the integration tests.
|
||||
|
||||
If you just want to run the Unit or Integration tests by themselves you can use the following commands:
|
||||
|
||||
**Unit Tests**
|
||||
```bash
|
||||
dotnet test --filter Category=Unit
|
||||
```
|
||||
|
||||
**Integration Tests**
|
||||
```bash
|
||||
dotnet test --filter Category=Integration
|
||||
```
|
||||
|
||||
## GitHub Actions Workflow
|
||||
The GitHub Actions workflow file [build-and-test.yml](.github/workflows/build-and-test.yml) demonstrates the following:
|
||||
|
||||
1. Setting up gitversion
|
||||
2. Building dotnet core project
|
||||
3. Running unit tests
|
||||
4. Spinning up docker containers
|
||||
5. Running integration tests against docker API
|
||||
6. Displaying Test Results
|
||||
7. Pushing tagged docker image to ECR
|
148
docs/BookAPI.postman_collection.json
Normal file
148
docs/BookAPI.postman_collection.json
Normal file
|
@ -0,0 +1,148 @@
|
|||
{
|
||||
"info": {
|
||||
"_postman_id": "22113d52-a04e-4256-b66d-941c4ed8ae15",
|
||||
"name": "BookAPI",
|
||||
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
|
||||
"_exporter_id": "2815397"
|
||||
},
|
||||
"item": [
|
||||
{
|
||||
"name": "Get Books",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"url": {
|
||||
"raw": "http://localhost:5275/books/",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "5275",
|
||||
"path": [
|
||||
"books",
|
||||
""
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "Get Book By ID",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"url": {
|
||||
"raw": "http://localhost:5275/books/1",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "5275",
|
||||
"path": [
|
||||
"books",
|
||||
"1"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "Add Author",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\n \"firstName\": \"Eric\",\n \"lastName\": \"Jorgenson\"\n}",
|
||||
"options": {
|
||||
"raw": {
|
||||
"language": "json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"url": {
|
||||
"raw": "http://localhost:5275/authors/",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "5275",
|
||||
"path": [
|
||||
"authors",
|
||||
""
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "Get Authors",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"url": {
|
||||
"raw": "http://localhost:5275/authors/",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "5275",
|
||||
"path": [
|
||||
"authors",
|
||||
""
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "Get Author By ID",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"url": {
|
||||
"raw": "http://localhost:5275/authors/",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "5275",
|
||||
"path": [
|
||||
"authors",
|
||||
""
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "Add Book",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\n \"title\": \"The Almanack of Naval Ravikant\",\n \"authorId\": 1,\n \"isbn\": \"9789354893896\",\n \"datePublished\": \"2020-08-15\"\n}",
|
||||
"options": {
|
||||
"raw": {
|
||||
"language": "json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"url": {
|
||||
"raw": "http://localhost:5275/books/",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "5275",
|
||||
"path": [
|
||||
"books",
|
||||
""
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in a new issue