Create a .gitlab-ci.yml file in your repository root to define the build, test, and deploy stages for your Go application.
stages:
- build
- test
- deploy
build:
stage: build
image: golang:1.21
script:
- go build -o myapp .
test:
stage: test
image: golang:1.21
script:
- go test -v ./...
deploy:
stage: deploy
image: alpine:latest
script:
- echo "Deploying myapp..."
only:
- main
Commit and push this file to trigger the pipeline.