stages: - build - publish lint: image: nixery.dev/shell/diffutils/go/golangci-lint stage: build before_script: - cp /share/go/bin/go /bin && mkdir /tmp # fix weirdness from nixery image - mkdir -p /go/src/src/gitlab.com/signald/signald-go - cp -r * /go/src/src/gitlab.com/signald/signald-go - cd /go/src/src/gitlab.com/signald/signald-go script: - golangci-lint run - go mod tidy - diff --color=always go.mod "${CI_PROJECT_DIR}/go.mod" - diff --color=always go.sum "${CI_PROJECT_DIR}/go.sum" build:x86: stage: build image: golang:latest before_script: - mkdir -p /go/src/gitlab.com/signald/signald-go - cp -r * /go/src/gitlab.com/signald/signald-go - cd /go/src/gitlab.com/signald/signald-go script: - go build -o "${CI_PROJECT_DIR}/signaldctl" --ldflags "-X gitlab.com/signald/signald-go/cmd/signaldctl/common.Version=$(git -C ${CI_PROJECT_DIR} describe) -X gitlab.com/signald/signald-go/cmd/signaldctl/common.Branch=${CI_COMMIT_BRANCH} -X gitlab.com/signald/signald-go/cmd/signaldctl/common.Commit=${CI_COMMIT_SHA}" ./cmd/signaldctl artifacts: paths: - signaldctl expire_in: 1 month build:cross-compile: stage: build image: golang:latest before_script: - mkdir -p /go/src/gitlab.com/signald/signald-go - cp -r * /go/src/gitlab.com/signald/signald-go - cd /go/src/gitlab.com/signald/signald-go script: - go build -o "${CI_PROJECT_DIR}/signaldctl-${GOOS}-${GOARCH}" --ldflags "-X gitlab.com/signald/signald-go/cmd/signaldctl/common.Version=$(git -C ${CI_PROJECT_DIR} describe) -X gitlab.com/signald/signald-go/cmd/signaldctl/common.Branch=${CI_COMMIT_BRANCH} -X gitlab.com/signald/signald-go/cmd/signaldctl/common.Commit=${CI_COMMIT_SHA}" ./cmd/signaldctl artifacts: paths: - signaldctl-* expire_in: 1 month parallel: matrix: - GOOS: linux GOARCH: - arm - arm64 - amd64 - GOOS: darwin GOARCH: amd64 build:aarch64: stage: build tags: [arm-builder] image: golang:latest before_script: - mkdir -p /go/src/gitlab.com/signald/signald-go - cp -r * /go/src/gitlab.com/signald/signald-go - cd /go/src/gitlab.com/signald/signald-go script: - go build -o "${CI_PROJECT_DIR}/signaldctl" --ldflags "-X gitlab.com/signald/signald-go/cmd/signaldctl/common.Version=$(git -C ${CI_PROJECT_DIR} describe) -X gitlab.com/signald/signald-go/cmd/signaldctl/common.Branch=${CI_COMMIT_BRANCH} -X gitlab.com/signald/signald-go/cmd/signaldctl/common.Commit=${CI_COMMIT_SHA}" ./cmd/signaldctl artifacts: paths: - signaldctl expire_in: 1 month build:x86:deb: stage: build image: debian:latest before_script: - apt-get update - apt-get install -y git-buildpackage dh-golang bash-completion golang-any golang-github-spf13-cobra-dev golang-github-spf13-viper-dev - apt-get install -y ./*.deb && rm -vf *.deb script: - go run ./cmd/signaldctl doc -o man - go run ./cmd/signaldctl completion bash > debian/package.bash-completion - ls *.1 > debian/manpages - gbp dch --ignore-branch --debian-tag="%(version)s" --git-author --new-version="$(git describe --abbrev=0)+git$(date +%Y-%m-%d)r$(git rev-parse --short=8 HEAD).$(git rev-list $(git describe --abbrev=0)..HEAD --count)" - dpkg-buildpackage -us -uc -b - mv ../*.deb . needs: - project: signald/libraries/golang-github-mdp-qrterminal job: build ref: master artifacts: true - project: signald/libraries/golang-github-jedib0t-go-pretty job: build ref: master artifacts: true variables: SIGNALDCTL_PUBLIC_DOC_MODE: "on" artifacts: paths: - "*.deb" - "*.1" expire_in: 1 month publish deb: image: registry.gitlab.com/signald/infrastructure/signald-builder-x86:d5e68709 stage: publish tags: [deb-signer] needs: ["build:x86:deb"] script: - aptly repo create signald - aptly mirror create -ignore-signatures backfill-mirror https://updates.signald.org "${DISTRIBUTION}" main - aptly mirror update -ignore-signatures backfill-mirror - aptly repo import backfill-mirror signald signald signaldctl - aptly repo add signald *.deb - aptly publish repo -config=.aptly.conf -batch -gpg-key="${SIGNING_KEY}" -distribution="${DISTRIBUTION}" "signald" "s3:updates.signald.org:" variables: DISTRIBUTION: unstable only: - main - tags pages: image: debian:latest stage: publish needs: ["build:x86"] before_script: - apt-get update && apt-get install -y hugo script: - mkdir -p docs/content/signaldctl - SIGNALDCTL_PUBLIC_DOC_MODE=on ./signaldctl doc -o md ./docs/content/signaldctl - cd docs - hugo - mv public ../ artifacts: paths: - "public/" expire_in: 1 month