Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mpolinowski/go-cicd
Go hello continuous deployment
https://github.com/mpolinowski/go-cicd
cicd gitlab-ci golang hello-world
Last synced: 8 days ago
JSON representation
Go hello continuous deployment
- Host: GitHub
- URL: https://github.com/mpolinowski/go-cicd
- Owner: mpolinowski
- Created: 2022-11-10T13:06:13.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2022-11-10T13:06:17.000Z (about 2 years ago)
- Last Synced: 2024-11-30T11:12:08.414Z (2 months ago)
- Topics: cicd, gitlab-ci, golang, hello-world
- Language: Go
- Homepage: https://mpolinowski.github.io/docs/Development/Go/2022-11-10-go-gitlab-ci-pipeline/2022-11-10
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Golang Git lab/hub CI/CD Demo
A simple project to demonstrate how to use Gitlab CI/CD with Go.
## Developing
Install dependencies with:
```bash
go get -v -d ./...
```Run the scripts with:
```bash
go run main.go
```Run the tests with:
```bash
go test -v ./...
```## Build
Use the CI file `.gitlab-ci.yml` to build the binary:
```yml
image: golang:latestvariables:
REPO: my.gitlab.com
GROUP: server_management
PROJECT: go-hellostages:
- test
- buildbefore_script:
- mkdir -p $GOPATH/src/$REPO/$GROUP $GOPATH/src/_/builds
- cp -r $CI_PROJECT_DIR $GOPATH/src/$REPO/$GROUP/$PROJECT
- ln -s $GOPATH/src/$REPO/$GROUP $GOPATH/src/_/builds/$GROUP
- go get -v -d ./...unit_tests:
stage: test
script:
- go test -v ./...build:
stage: build
script:
- go build -v -o hi
only:
- main
artifacts:
paths:
- /builds/server_management/hello-go/hi
expire_in: 1 hour
```Download the build binary from:
> `https://my.gitlab.com/server_management/hello-go/-/jobs/artifacts/main/browse?job=build`