2020-09-02 21:34:52 +02:00
|
|
|
version: 2.1
|
2023-02-26 12:20:11 +01:00
|
|
|
orbs:
|
|
|
|
# NB: 1.7.2 is not the Go version, but the Orb version
|
|
|
|
# https://circleci.com/developer/orbs/orb/circleci/go#usage-go-modules-cache
|
|
|
|
go: circleci/go@1.7.2
|
2020-09-02 21:34:52 +02:00
|
|
|
commands:
|
|
|
|
setup-home-local-bin:
|
2019-03-14 21:57:50 +01:00
|
|
|
steps:
|
|
|
|
- run:
|
2020-09-02 21:34:52 +02:00
|
|
|
shell: /bin/bash -euo pipefail
|
2019-03-14 21:57:50 +01:00
|
|
|
command: |
|
2020-09-02 21:34:52 +02:00
|
|
|
mkdir -p "$HOME/.local/bin"
|
|
|
|
line='export PATH="$HOME/.local/bin:$PATH"'
|
|
|
|
if grep "$line" $BASH_ENV >/dev/null; then
|
|
|
|
echo "$line" >> $BASH_ENV
|
|
|
|
fi
|
2019-03-14 21:57:50 +01:00
|
|
|
|
2020-09-02 21:34:52 +02:00
|
|
|
invoke-lazy-sh:
|
|
|
|
parameters:
|
|
|
|
subcommand:
|
|
|
|
type: string
|
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
environment:
|
|
|
|
TERM: xterm
|
|
|
|
command: ./lazy.sh <<parameters.subcommand>>
|
2019-03-14 21:57:50 +01:00
|
|
|
|
2020-09-02 21:34:52 +02:00
|
|
|
apt-update-and-install-common-deps:
|
|
|
|
steps:
|
2022-10-31 19:48:51 +01:00
|
|
|
- run: sudo apt-get update
|
|
|
|
- run: sudo apt-get install -y gawk make
|
|
|
|
# CircleCI doesn't update its cimg/go images.
|
|
|
|
# So, need to update manually to get up-to-date trust chains.
|
|
|
|
# The need for this was required for cimg/go:1.12, but let's future proof this here and now.
|
|
|
|
- run: sudo apt-get install -y git ca-certificates
|
2019-03-14 21:57:50 +01:00
|
|
|
|
2020-09-02 21:34:52 +02:00
|
|
|
install-godep:
|
|
|
|
steps:
|
|
|
|
- apt-update-and-install-common-deps
|
|
|
|
- invoke-lazy-sh:
|
|
|
|
subcommand: godep
|
|
|
|
|
|
|
|
install-docdep:
|
|
|
|
steps:
|
|
|
|
- apt-update-and-install-common-deps
|
|
|
|
- run: sudo apt install python3 python3-pip libgirepository1.0-dev
|
|
|
|
- invoke-lazy-sh:
|
|
|
|
subcommand: docdep
|
|
|
|
|
2023-09-09 12:41:06 +02:00
|
|
|
docs-publish-sh:
|
|
|
|
parameters:
|
|
|
|
push:
|
|
|
|
type: boolean
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run:
|
|
|
|
command: |
|
|
|
|
git config --global user.email "zreplbot@cschwarz.com"
|
|
|
|
git config --global user.name "zrepl-github-io-ci"
|
|
|
|
|
2023-11-01 00:12:23 +01:00
|
|
|
# if we're pushing, we need to add the deploy key
|
|
|
|
# which is stored as "Additional SSH Keys" in the CircleCI project settings.
|
|
|
|
# We can't use the CircleCI-manage deploy key because we're pushing
|
|
|
|
# to a different repo than the one we're building.
|
|
|
|
- when:
|
|
|
|
condition: << parameters.push >>
|
|
|
|
steps:
|
|
|
|
# https://circleci.com/docs/2.0/add-ssh-key/#adding-multiple-keys-with-blank-hostnames
|
|
|
|
- run: ssh-add -D
|
|
|
|
# the default circleci ssh config only additional ssh keys for Host !github.com
|
|
|
|
- run:
|
|
|
|
command: |
|
|
|
|
cat > ~/.ssh/config \<<EOF
|
|
|
|
Host *
|
|
|
|
IdentityFile /home/circleci/.ssh/id_rsa_458e62c517f6c480e40452126ce47421
|
|
|
|
EOF
|
|
|
|
- add_ssh_keys:
|
|
|
|
fingerprints:
|
|
|
|
# deploy key for zrepl.github.io
|
|
|
|
- "45:8e:62:c5:17:f6:c4:80:e4:04:52:12:6c:e4:74:21"
|
2023-09-09 12:41:06 +02:00
|
|
|
|
|
|
|
# caller must install-docdep
|
|
|
|
- when:
|
|
|
|
condition: << parameters.push >>
|
|
|
|
steps:
|
|
|
|
- run: bash -x docs/publish.sh -c -a -P
|
|
|
|
- when:
|
|
|
|
condition:
|
|
|
|
not: << parameters.push >>
|
|
|
|
steps:
|
|
|
|
- run: bash -x docs/publish.sh -c -a
|
|
|
|
|
2020-09-06 15:46:53 +02:00
|
|
|
parameters:
|
2020-09-06 15:39:34 +02:00
|
|
|
do_ci:
|
|
|
|
type: boolean
|
|
|
|
default: true
|
|
|
|
|
|
|
|
do_release:
|
|
|
|
type: boolean
|
|
|
|
default: false
|
|
|
|
|
|
|
|
release_docker_baseimage_tag:
|
|
|
|
type: string
|
2023-09-10 12:19:05 +02:00
|
|
|
default: "1.21"
|
2020-09-02 21:34:52 +02:00
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
2020-09-06 15:39:34 +02:00
|
|
|
|
|
|
|
ci:
|
|
|
|
when: << pipeline.parameters.do_ci >>
|
2020-09-02 21:34:52 +02:00
|
|
|
jobs:
|
|
|
|
- quickcheck-docs
|
|
|
|
- quickcheck-go: &quickcheck-go-smoketest
|
2023-09-10 12:19:05 +02:00
|
|
|
name: quickcheck-go-amd64-linux-1.21
|
|
|
|
goversion: &latest-go-release "1.21"
|
2020-09-02 21:34:52 +02:00
|
|
|
goos: linux
|
|
|
|
goarch: amd64
|
|
|
|
- test-go-on-latest-go-release:
|
|
|
|
goversion: *latest-go-release
|
|
|
|
- quickcheck-go:
|
|
|
|
requires:
|
2023-09-10 12:19:05 +02:00
|
|
|
- quickcheck-go-amd64-linux-1.21 #quickcheck-go-smoketest.name
|
2020-09-02 21:34:52 +02:00
|
|
|
matrix: &quickcheck-go-matrix
|
|
|
|
alias: quickcheck-go-matrix
|
|
|
|
parameters:
|
2023-09-10 12:44:54 +02:00
|
|
|
goversion: [*latest-go-release, "1.20"]
|
2020-09-02 21:34:52 +02:00
|
|
|
goos: ["linux", "freebsd"]
|
|
|
|
goarch: ["amd64", "arm64"]
|
|
|
|
exclude:
|
|
|
|
# don't re-do quickcheck-go-smoketest
|
|
|
|
- goversion: *latest-go-release
|
|
|
|
goos: linux
|
|
|
|
goarch: amd64
|
2023-02-26 12:01:55 +01:00
|
|
|
- platformtest:
|
|
|
|
matrix:
|
|
|
|
parameters:
|
|
|
|
goversion: [*latest-go-release]
|
|
|
|
goos: ["linux"]
|
|
|
|
goarch: ["amd64"]
|
|
|
|
requires:
|
|
|
|
- quickcheck-go-<< matrix.goarch >>-<< matrix.goos >>-<< matrix.goversion >>
|
2020-09-02 21:34:52 +02:00
|
|
|
|
2020-09-06 15:39:34 +02:00
|
|
|
release:
|
|
|
|
when: << pipeline.parameters.do_release >>
|
|
|
|
jobs:
|
|
|
|
- release-build
|
2020-09-02 21:34:52 +02:00
|
|
|
- release-deb:
|
|
|
|
requires:
|
|
|
|
- release-build
|
|
|
|
- release-rpm:
|
|
|
|
requires:
|
|
|
|
- release-build
|
|
|
|
- release-upload:
|
|
|
|
requires:
|
|
|
|
- release-build
|
|
|
|
- release-deb
|
|
|
|
- release-rpm
|
|
|
|
|
2023-09-09 12:41:06 +02:00
|
|
|
publish-zrepl.github.io:
|
2020-09-12 12:28:32 +02:00
|
|
|
jobs:
|
|
|
|
- publish-zrepl-github-io:
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- stable
|
|
|
|
|
2020-09-02 21:34:52 +02:00
|
|
|
jobs:
|
|
|
|
quickcheck-docs:
|
2019-03-14 21:57:50 +01:00
|
|
|
docker:
|
2023-09-09 12:21:25 +02:00
|
|
|
- image: cimg/base:2023.09
|
2020-09-02 21:34:52 +02:00
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- install-docdep
|
2023-09-09 12:41:06 +02:00
|
|
|
# do the current docs build
|
2020-09-02 21:34:52 +02:00
|
|
|
- run: make docs
|
2023-09-09 12:41:06 +02:00
|
|
|
# does the publish.sh script still work?
|
|
|
|
- docs-publish-sh:
|
|
|
|
push: false
|
2019-09-03 14:45:18 +02:00
|
|
|
|
2020-09-02 21:34:52 +02:00
|
|
|
quickcheck-go:
|
|
|
|
parameters:
|
|
|
|
goversion:
|
|
|
|
type: string
|
|
|
|
goos:
|
|
|
|
type: string
|
|
|
|
goarch:
|
|
|
|
type: string
|
2019-03-14 21:57:50 +01:00
|
|
|
docker:
|
2022-10-23 17:51:23 +02:00
|
|
|
- image: cimg/go:<<parameters.goversion>>
|
2020-09-02 21:34:52 +02:00
|
|
|
environment:
|
|
|
|
GOOS: <<parameters.goos>>
|
|
|
|
GOARCH: <<parameters.goarch>>
|
2019-09-03 14:45:18 +02:00
|
|
|
|
2020-09-02 21:34:52 +02:00
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
2023-02-26 12:20:11 +01:00
|
|
|
- go/load-cache:
|
|
|
|
key: quickcheck-<<parameters.goversion>>
|
2022-10-31 19:48:51 +01:00
|
|
|
- install-godep
|
2020-09-02 21:34:52 +02:00
|
|
|
- run: go mod download
|
|
|
|
- run: cd build && go mod download
|
2023-02-26 12:20:11 +01:00
|
|
|
- go/save-cache:
|
|
|
|
key: quickcheck-<<parameters.goversion>>
|
2020-09-02 21:34:52 +02:00
|
|
|
|
|
|
|
- run: make formatcheck
|
|
|
|
- run: make generate-platform-test-list
|
|
|
|
- run: make zrepl-bin test-platform-bin
|
|
|
|
- run: make vet
|
|
|
|
- run: make lint
|
|
|
|
|
|
|
|
- run: rm -f artifacts/generate-platform-test-list
|
|
|
|
- store_artifacts:
|
|
|
|
path: artifacts
|
2023-02-26 12:01:55 +01:00
|
|
|
- persist_to_workspace:
|
|
|
|
root: .
|
|
|
|
paths: [.]
|
|
|
|
|
|
|
|
platformtest:
|
|
|
|
parameters:
|
|
|
|
goversion:
|
|
|
|
type: string
|
|
|
|
goos:
|
|
|
|
type: string
|
|
|
|
goarch:
|
|
|
|
type: string
|
|
|
|
machine:
|
|
|
|
image: ubuntu-2204:current
|
|
|
|
resource_class: medium
|
|
|
|
environment:
|
|
|
|
GOOS: <<parameters.goos>>
|
|
|
|
GOARCH: <<parameters.goarch>>
|
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: .
|
|
|
|
- run: sudo apt-get update
|
|
|
|
- run: sudo apt-get install -y zfsutils-linux
|
|
|
|
- run: sudo zfs version
|
|
|
|
- run: sudo make test-platform GOOS="$GOOS" GOARCH="$GOARCH"
|
2020-09-02 21:34:52 +02:00
|
|
|
|
|
|
|
test-go-on-latest-go-release:
|
|
|
|
parameters:
|
|
|
|
goversion:
|
|
|
|
type: string
|
2019-09-03 14:45:18 +02:00
|
|
|
docker:
|
2022-10-23 17:51:23 +02:00
|
|
|
- image: cimg/go:<<parameters.goversion>>
|
2020-09-02 21:34:52 +02:00
|
|
|
steps:
|
|
|
|
- checkout
|
2023-02-26 12:20:11 +01:00
|
|
|
- go/load-cache:
|
|
|
|
key: make-test-go
|
2020-09-02 21:34:52 +02:00
|
|
|
- run: make test-go
|
2023-02-26 12:20:11 +01:00
|
|
|
- go/save-cache:
|
|
|
|
key: make-test-go
|
2019-11-20 20:57:50 +01:00
|
|
|
|
2020-09-02 21:34:52 +02:00
|
|
|
release-build:
|
2022-02-15 22:55:25 +01:00
|
|
|
machine:
|
|
|
|
image: ubuntu-2004:202201-02
|
2020-09-02 21:34:52 +02:00
|
|
|
steps:
|
|
|
|
- checkout
|
2020-09-06 15:39:34 +02:00
|
|
|
- run: make release-docker RELEASE_DOCKER_BASEIMAGE_TAG=<<pipeline.parameters.release_docker_baseimage_tag>>
|
2020-09-02 21:34:52 +02:00
|
|
|
- persist_to_workspace:
|
|
|
|
root: .
|
|
|
|
paths: [.]
|
|
|
|
release-deb:
|
2022-02-15 22:55:25 +01:00
|
|
|
machine:
|
|
|
|
image: ubuntu-2004:202201-02
|
2020-09-02 21:34:52 +02:00
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: .
|
|
|
|
- run: make debs-docker
|
|
|
|
- persist_to_workspace:
|
|
|
|
root: .
|
|
|
|
paths:
|
|
|
|
- "artifacts/*.deb"
|
|
|
|
|
|
|
|
release-rpm:
|
2022-02-15 22:55:25 +01:00
|
|
|
machine:
|
|
|
|
image: ubuntu-2004:202201-02
|
2020-09-02 21:34:52 +02:00
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: .
|
|
|
|
- run: make rpms-docker
|
|
|
|
- persist_to_workspace:
|
|
|
|
root: .
|
|
|
|
paths:
|
|
|
|
- "artifacts/*.rpm"
|
|
|
|
|
|
|
|
release-upload:
|
2020-03-27 00:23:10 +01:00
|
|
|
docker:
|
2020-09-02 21:34:52 +02:00
|
|
|
- image: cimg/base:2020.08
|
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: .
|
2023-10-01 17:09:15 +02:00
|
|
|
- run: make wrapup-and-checksum
|
2020-09-02 21:34:52 +02:00
|
|
|
- store_artifacts:
|
|
|
|
path: artifacts
|
2020-09-06 15:46:53 +02:00
|
|
|
|
2020-09-12 12:28:32 +02:00
|
|
|
publish-zrepl-github-io:
|
|
|
|
docker:
|
2023-09-09 12:21:25 +02:00
|
|
|
- image: cimg/base:2023.09
|
2020-09-12 12:28:32 +02:00
|
|
|
steps:
|
|
|
|
- checkout
|
2023-09-09 12:41:06 +02:00
|
|
|
- install-docdep
|
|
|
|
- docs-publish-sh:
|
|
|
|
push: true
|