The code from my YouTube video on "CI/CD Pipeline Using GitHub Actions: Automate Software Delivery (for free)"
Find a file
2023-07-19 09:46:52 +01:00
.config Add boilerplate code without DB 2023-06-30 14:00:30 +01:00
.github/workflows Add configurable URL 2023-07-10 14:48:10 +01:00
.vscode Add configurable URL 2023-07-10 14:48:10 +01:00
docs Add postman and update README 2023-07-11 11:34:11 +01:00
src Remvoe port 2023-07-10 14:49:57 +01:00
test Add configurable URL 2023-07-10 14:48:10 +01:00
.env Add configurable URL 2023-07-10 14:48:10 +01:00
.gitignore Add boilerplate code without DB 2023-06-30 14:00:30 +01:00
docker-compose.yml Add configurable URL 2023-07-10 14:48:10 +01:00
Dockerfile Add env and Docker files 2023-07-10 11:21:31 +01:00
GitHubActionsDemo.sln Added Integration test that uses Refit 2023-07-07 14:27:35 +01:00
LICENSE Initial commit 2023-06-30 09:29:25 +01:00
README.md Update README.md 2023-07-19 09:46:52 +01:00

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:

  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