https://github.com/shaikrasheed99/golang-github-actions-example
GitHub Actions example using Golang application
https://github.com/shaikrasheed99/golang-github-actions-example
docker dockerhub github-actions go-app go-application go-github-actions golang golang-app golang-application
Last synced: 3 months ago
JSON representation
GitHub Actions example using Golang application
- Host: GitHub
- URL: https://github.com/shaikrasheed99/golang-github-actions-example
- Owner: shaikrasheed99
- License: mit
- Created: 2023-10-03T16:29:31.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-11-13T04:09:15.000Z (over 2 years ago)
- Last Synced: 2025-01-13T19:38:53.199Z (over 1 year ago)
- Topics: docker, dockerhub, github-actions, go-app, go-application, go-github-actions, golang, golang-app, golang-application
- Language: Go
- Homepage: https://hub.docker.com/r/shaikrasheed99/golang-github-actions-example
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GitHub Actions example using Golang applicaiton
## Jobs created in GitHub actions pipeline
- `build` - used to build the whole application
- `test` - used to execute the test cases along with checking the test coverage
- `deploy` - used to deploy the image of this application to [docker hub](https://hub.docker.com/r/shaikrasheed99/golang-github-actions-example)
CI pipeline defined in this file - [pipeline.yaml](.github/workflows/pipeline.yaml)
DockerHub link of this application - [shaikrasheed99/golang-github-actions-example](https://hub.docker.com/r/shaikrasheed99/golang-github-actions-example)
## How to run the application
We can run this application by two ways
1. Make sure your machine has golang installed in it.
- Run the below command to download the code from Github repository to your local machine.
```bash
git clone https://github.com/shaikrasheed99/golang-github-actions-example.git
```
- Run the below command to move to the application directory.
```bash
cd golang-github-actions-example/
```
- Run the below command to install all the dependencies of the application.
```bash
go mod tidy
```
- Run the below command to run the application for testing the APIs.
```bash
go run .
```
2. Make sure your machine has docker installed in it.
- Run the below command to pull the Image from Dockerhub to your local machine.
```bash
docker pull shaikrasheed99/golang-github-actions-example
```
- The Golang application which inside this image is using port 8080.
- Run the following command in the terminal to start the container.
```bash
docker run -d -p 8080:8080 shaikrasheed99/golang-github-actions-example
```
## How to test the APIs of application
Totally, we have three simple test APIs
### Test API - 1
Request `curl --location --request GET 'http://localhost:8080/test1'`
Response `"This is first test api"`
### Test API - 2
Request `curl --location --request GET 'http://localhost:8080/test2'`
Response `"This is second test api"`
### Test API - 3
Request `curl --location --request GET 'http://localhost:8080/test3'`
Response `"This is third test api"`