123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- test_task:
- env:
- ELVISH_TEST_TIME_SCALE: 20
- TEST_FLAG: -race
- go_modules_cache:
- fingerprint_script: cat go.sum
- folder: ~/go/pkg/mod
- go_build_cache:
- folder: ~/.cache/go-build
- matrix:
- # Re-enable gccgo when it supports Go 1.18.
- #- name: Test on gccgo
- # container:
- # image: debian:unstable-slim
- # setup_script:
- # - apt-get -y update
- # - apt-get -y install ca-certificates gccgo-12 git
- # - ln -sf /usr/bin/go-12 /usr/local/bin/go
- # env:
- # # gccgo doesn't support race test
- # TEST_FLAG: ""
- - name: Test on Linux ARM64
- arm_container:
- # The Alpine image has segmentation faults when running test -race, so
- # use Debian instead.
- image: golang:1.19.3-bullseye
- - name: Test on FreeBSD
- freebsd_instance:
- image_family: freebsd-13-1
- env:
- PATH: /usr/local/go/bin:$PATH
- GO_VERSION: 1.19.3
- go_toolchain_cache:
- fingerprint_key: $GO_VERSION
- folder: /usr/local/go
- populate_script: |
- pkg install -y curl
- curl -L -o go.tar.gz https://go.dev/dl/go$GO_VERSION.freebsd-amd64.tar.gz
- tar -C /usr/local -xf go.tar.gz
- setup_script: pkg install -y git
- 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:
- image: golang:1.19.3-alpine
- go_modules_cache:
- fingerprint_script: cat go.sum
- folder: ~/go/pkg/mod
- go_build_cache:
- folder: ~/.cache/go-build
- setup_script: apk add zip
- build_binaries_script: |
- ELVISH_BUILD_VARIANT=official ./tools/buildall.sh . $CIRRUS_WORKING_DIR/elvish-bin HEAD
- binaries_artifacts:
- path: elvish-bin/**
- check_binary_checksums_task:
- name: Check binary checksums ($HOST)
- only_if: $CIRRUS_BRANCH == 'master'
- container:
- image: golang:1.19.3-alpine
- depends_on: binaries
- env:
- GITHUB_TOKEN: ENCRYPTED[42d653b965486640762776cc9c7a98262c2d68d7797c6de801a7764b26a6fd5dbe4952115217f4cc1bed564c336bdf61]
- matrix:
- - env:
- HOST: cdg
- - env:
- HOST: hkg
- setup_script: apk add git curl
- wait_website_update_script: |
- ts=$(git show -s --format=%ct HEAD)
- wait=10
- while true; do
- website_ts=$(curl -sS https://$HOST.elv.sh/commit-ts.txt)
- if test -z "$website_ts"; then
- echo "website has no commit-ts.txt yet"
- elif test "$website_ts" -ge "$ts"; then
- echo "website ($website_ts) >= CI ($ts)"
- exit 0
- else
- echo "website ($website_ts) < CI ($ts)"
- fi
- sleep $wait
- test $wait -lt 96 && wait=`echo "$wait * 2" | bc`
- done
- check_binary_checksums_script: |
- curl -o binaries.zip https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/binaries/binaries.zip
- unzip binaries.zip
- cd elvish-bin
- ret=0
- for f in */elvish-HEAD.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
- if test $ret != 0; then
- latest_sha=$(curl -sS -H "Authorization: token $GITHUB_TOKEN" -H 'Accept: application/vnd.github.VERSION.sha' https://api.github.com/repos/elves/elvish/commits/master)
- if test "$CIRRUS_CHANGE_IN_REPO" != "$latest_sha"; then
- echo "$CIRRUS_CHANGE_IN_REPO != $latest_sha"
- echo "Ignoring the mismatch since there is a newer commit now"
- ret=0
- fi
- fi
- exit $ret
|