163 lines
No EOL
5.1 KiB
YAML
163 lines
No EOL
5.1 KiB
YAML
stages:
|
|
- build
|
|
- publish
|
|
|
|
lint:
|
|
image: golang:latest
|
|
stage: build
|
|
before_script:
|
|
- wget https://github.com/golangci/golangci-lint/releases/download/v1.44.2/golangci-lint-1.44.2-linux-amd64.deb
|
|
- apt-get install -y ./golangci-lint-1.44.2-linux-amd64.deb
|
|
script:
|
|
- golangci-lint --timeout 59m run
|
|
- go mod tidy
|
|
- diff --color=always go.mod "${CI_PROJECT_DIR}/go.mod"
|
|
- diff --color=always go.sum "${CI_PROJECT_DIR}/go.sum"
|
|
rules:
|
|
- when: on_success
|
|
|
|
.build:
|
|
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
|
|
script:
|
|
- VERSION="$(./version.sh)"
|
|
- echo "building ${VERSION}"
|
|
- cd /go/src/gitlab.com/signald/signald-go
|
|
- go build -o "${CI_PROJECT_DIR}/signaldctl" --ldflags "-X gitlab.com/signald/signald-go/cmd/signaldctl/common.Version=${VERSION} -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-deb:
|
|
stage: build
|
|
image: debian:buster
|
|
script:
|
|
- echo deb http://deb.debian.org/debian buster-backports main > /etc/apt/sources.list.d/backports.list
|
|
- apt-get update
|
|
- apt-get install -y -t buster-backports git-buildpackage dh-golang bash-completion golang-any golang-github-spf13-cobra-dev golang-github-spf13-viper-dev golang-github-google-uuid-dev golang-github-mattn-go-sqlite3-dev golang-github-lib-pq-dev golang-github-satori-go.uuid-dev
|
|
- apt-get install -y ./*.deb && rm -vf *.deb
|
|
- 'sed -i "s/^Architecture:.*/Architecture: ${ARCH}/g" debian/control'
|
|
- 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="$(./version.sh)"
|
|
- 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
|
|
rules:
|
|
- if: '$CI_PROJECT_NAMESPACE == "signald" && $CI_COMMIT_REF_PROTECTED == "true"'
|
|
when: on_success
|
|
- when: manual
|
|
allow_failure: true
|
|
|
|
build:x86:
|
|
extends: .build
|
|
rules:
|
|
- when: on_success
|
|
|
|
build:aarch64:
|
|
tags: [arm-builder]
|
|
extends: .build
|
|
rules:
|
|
- if: '$CI_PROJECT_NAMESPACE == "signald" && $CI_COMMIT_REF_PROTECTED == "true"'
|
|
when: on_success
|
|
- when: manual
|
|
allow_failure: true
|
|
|
|
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
|
|
script:
|
|
- VERSION="$(./version.sh)"
|
|
- echo "building ${VERSION}"
|
|
- cd /go/src/gitlab.com/signald/signald-go
|
|
- go build -o "${CI_PROJECT_DIR}/signaldctl-${GOOS}-${GOARCH}" --ldflags "-X gitlab.com/signald/signald-go/cmd/signaldctl/common.Version=${VERSION} -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
|
|
rules:
|
|
- when: on_success
|
|
|
|
|
|
build:x86:deb:
|
|
extends: .build-deb
|
|
rules:
|
|
- when: on_success
|
|
variables:
|
|
ARCH: amd64
|
|
|
|
build:aarch64:deb:
|
|
extends: .build-deb
|
|
tags: [arm-builder]
|
|
variables:
|
|
ARCH: arm64
|
|
|
|
build:armhf:deb:
|
|
extends: .build-deb
|
|
image: arm32v7/debian:buster
|
|
tags: [arm-builder]
|
|
variables:
|
|
ARCH: armhf
|
|
|
|
publish deb:
|
|
image: registry.gitlab.com/signald/infrastructure/signald-builder-x86:d5e68709
|
|
stage: publish
|
|
tags: [deb-signer]
|
|
needs: ["build:x86:deb", "build:aarch64:deb", "build:armhf: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 (>= 0.3.0)'
|
|
- aptly repo add signald *.deb
|
|
- gpg1 --import "${SIGNING_KEY_PATH}"
|
|
- gpg1 --list-secret-keys
|
|
- aptly publish repo -config=.aptly.conf -batch -gpg-key="${SIGNING_KEY_ID}" -distribution="${DISTRIBUTION}" "signald" "s3:updates.signald.org:"
|
|
variables:
|
|
DISTRIBUTION: unstable
|
|
rules:
|
|
- if: '$CI_PROJECT_NAMESPACE == "signald" && $CI_COMMIT_REF_PROTECTED == "true"'
|
|
when: on_success
|
|
- when: manual
|
|
allow_failure: true
|
|
|
|
|
|
signald.org:
|
|
stage: publish
|
|
needs: ["build:x86"]
|
|
trigger: signald/signald.org
|
|
rules:
|
|
- if: '$CI_PROJECT_NAMESPACE == "signald" && $CI_COMMIT_REF_PROTECTED == "true"'
|
|
when: on_success |