Skip to content
Snippets Groups Projects
gitlab-ci-golang.yml 22.52 KiB
# =========================================================================================
# Copyright (C) 2021 Orange & contributors
#
# This program is free software; you can redistribute it and/or modify it under the terms
# of the GNU Lesser General Public License as published by the Free Software Foundation;
# either version 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License along with this
# program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
# Floor, Boston, MA  02110-1301, USA.
# =========================================================================================
# default workflow rules: Merge Request pipelines
spec:
  inputs:
    image:
      description: The Docker image used to run Go (build+test or build only) - **set the version required by your project**
      default: registry.hub.docker.com/library/golang:bookworm
    project-dir:
      description: Go project root directory
      default: .
    goproxy:
      description: URL of Go module proxy (see [Go env](https://golang.org/cmd/go/#hdr-Environment_variables))
      default: ''
    test-image:
      description: Specific Docker image used to run Go tests (as a separate job)
      default: ''
    generate-modules:
      description: "Space separated list of Go code generator modules (ex: `stringer mockery`)"
      default: ''
    build-flags:
      description: Flags used by the [go build command](https://pkg.go.dev/cmd/go#hdr-Compile_packages_and_dependencies)
      default: -mod=readonly
    build-mode:
      description: The template build mode (accepted values are `application`, `modules` and `auto`)
      options:
      - auto
      - application
      - modules
      default: auto
    build-linker-flags:
      description: Linker flags used by the [go build command](https://pkg.go.dev/cmd/go#hdr-Compile_packages_and_dependencies) `-ldflags`
      default: -s -w
    build-packages:
      description: Packages to build with the [go build command](https://pkg.go.dev/cmd/go#hdr-Compile_packages_and_dependencies)
      default: ./...
    target-os:
      description: |-
        The `$GOOS` target [see available values](https://gist.github.com/asukakenji/f15ba7e588ac42795f421b48b8aede63)

        Fallbacks to default `$GOOS` from the Go Docker image
      default: ''
    target-arch:
      description: |-
        The `$GOARCH` target [see available values](https://gist.github.com/asukakenji/f15ba7e588ac42795f421b48b8aede63)

        Fallbacks to default `$GOARCH` from the Go Docker image
      default: ''
    test-flags:
      description: Flags used by the [go test command](https://pkg.go.dev/cmd/go#hdr-Test_packages)
      default: -mod=readonly -v -race
    test-packages:
      description: Packages to test with the [go test command](https://pkg.go.dev/cmd/go#hdr-Test_packages)
      default: ./...
    list-args:
      description: Arguments used by the list command
      default: list -u -m -mod=readonly -json all