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