-
-
Notifications
You must be signed in to change notification settings - Fork 302
/
.cirrus.yml
134 lines (130 loc) · 4.38 KB
/
.cirrus.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
test_arm_task:
env:
ELVISH_TEST_TIME_SCALE: "20"
TEST_FLAG: -race
name: Test on Linux ARM64
arm_container:
# The Alpine image has segmentation faults when running test -race, so
# use Debian instead.
image: golang:1.23-bookworm
go_version_script: go version
test_script: go test $TEST_FLAG ./...
test_bsd_task:
env:
ELVISH_TEST_TIME_SCALE: "20"
TEST_FLAG: -race
GO_VERSION: "1.23.0"
PATH: /usr/local/go/bin:$PATH
matrix:
- name: Test on FreeBSD
freebsd_instance:
# Find latest version on https://www.freebsd.org/releases/
image_family: freebsd-14-0
setup_script:
# go test -race is not compatible with ASLR, which has been enabled by
# default since FreeBSD 13
# (https://wiki.freebsd.org/AddressSpaceLayoutRandomization). LLVM
# issue: https://github.com/llvm/llvm-project/issues/53256
#
# There's also a Go bug where using go test -race with ASLR fails
# to run the tests and still reports tests as passing:
# https://github.com/golang/go/issues/65425
sysctl kern.elf64.aslr.enable=0
# NetBSD and FreeBSD images are from
# https://github.com/anarazel/pg-vm-images
- name: Test on NetBSD
compute_engine_instance:
image_project: pg-ci-images
image: family/pg-ci-netbsd-vanilla
platform: netbsd
- name: Test on OpenBSD
compute_engine_instance:
image_project: pg-ci-images
image: family/pg-ci-openbsd-vanilla
platform: openbsd
env:
TEST_FLAG:
go_toolchain_cache:
fingerprint_key: $CIRRUS_OS-$GO_VERSION
folder: /usr/local/go
populate_script: |
curl -L -o go.tar.gz https://go.dev/dl/go$GO_VERSION.$CIRRUS_OS-amd64.tar.gz
mkdir -p /usr/local
tar -C /usr/local -xzf go.tar.gz
go_version_script: go version
test_script: go test $TEST_FLAG ./...
build_binaries_task:
name: Build binaries
only_if: $CIRRUS_BRANCH == 'master'
alias: binaries
env:
CGO_ENABLED: "0"
container:
# Keep the Go version part in sync with
# https://github.com/elves/up/blob/master/Dockerfile
image: golang:1.23.0-alpine
go_modules_cache:
fingerprint_script: cat go.sum
folder: ~/go/pkg/mod
go_build_cache:
folder: ~/.cache/go-build
# Git is not required for building the binaries, but we need to include for Go
# to include VCS information in the binary. Also install coreutils to get a
# touch command that supports specifying the timezone.
setup_script: apk add zip git coreutils
# _bin is in .gitignore, so Git won't consider the repo dirty. This will
# impact the binary, which encodes VCS information.
build_binaries_script: |
go run ./cmd/elvish ./tools/buildall.elv -name elvish-HEAD -variant official ./cmd/elvish _bin/
binaries_artifacts:
path: _bin/**
binary_checksums_artifacts:
path: _bin/*/*.sha256sum
check_binary_checksums_task:
name: Check binary checksums ($HOST)
only_if: $CIRRUS_BRANCH == 'master'
container:
image: alpine:latest
depends_on: binaries
matrix:
- env:
HOST: cdg
- env:
HOST: hkg
setup_script: apk add git curl
# Enable auto cancellation - if there is another push, only the task to
# compare the website against the newer commit should continue.
auto_cancellation: "true"
wait_website_update_script: |
ts=$(git show -s --format=%ct HEAD)
wait=10
while true; do
if website_ts=$(curl -sSf https://$HOST.elv.sh/commit-ts.txt); then
if test "$website_ts" -ge "$ts"; then
echo "website ($website_ts) >= CI ($ts)"
exit 0
else
echo "website ($website_ts) < CI ($ts)"
fi
else
echo "website has no commit-ts.txt yet"
fi
sleep $wait
test $wait -lt 96 && wait=`echo "$wait * 2" | bc`
done
check_binary_checksums_script: |
curl -o checksums.zip https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/binaries/binary_checksums.zip
unzip checksums.zip
cd _bin
ret=0
for f in */elvish-HEAD.sha256sum */elvish-HEAD.exe.sha256sum; do
website_sum=$(curl -sS https://$HOST.dl.elv.sh/$f | awk '{print $1}')
ci_sum=$(cat $f | awk '{print $1}')
if test "$website_sum" = "$ci_sum"; then
echo "$f: website == CI ($ci_sum)"
else
echo "$f: website ($website_sum) != CI ($ci_sum)"
ret=1
fi
done
exit $ret