.config | ||
.github/workflows | ||
.vscode | ||
docs | ||
src | ||
test | ||
.env | ||
.gitignore | ||
docker-compose.yml | ||
Dockerfile | ||
GitHubActionsDemo.sln | ||
LICENSE | ||
README.md |
CI/CD Pipeline Using GitHub Actions: Automate Software Delivery (for free)
This project includes the code from my YouTube video on "CI/CD Pipeline Using GitHub Actions: Automate Software Delivery (for free)"
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 | Controllers and validation for the API |
GitHubActionsDemo.Api.Sdk | Contracts and Refit SDK |
GitHubActionsDemo.Service | Business Logic Layer |
GitHubActionsDemo.Persistance | Code for setup and writing to the database |
GitHubActionsDemo.Api.Unit.Tests | API unit tests with xunit |
GitHubActionsDemo.Service.Unit.Tests | Service unit tests with xunit |
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
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 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
dotnet test --filter Category=Unit
Integration Tests
dotnet test --filter Category=Integration
GitHub Actions Workflow
The GitHub Actions workflow file build-and-test.yml demonstrates the following:
- Setting up gitversion
- Building dotnet core project
- Running unit tests
- Spinning up docker containers
- Running integration tests against docker API
- Displaying Test Results
- Pushing tagged docker image to ECR