.cirrus.yml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. test_task:
  2. env:
  3. ELVISH_TEST_TIME_SCALE: 20
  4. TEST_FLAG: -race
  5. go_modules_cache:
  6. fingerprint_script: cat go.sum
  7. folder: ~/go/pkg/mod
  8. go_build_cache:
  9. folder: ~/.cache/go-build
  10. matrix:
  11. # Re-enable gccgo when it supports Go 1.18.
  12. #- name: Test on gccgo
  13. # container:
  14. # image: debian:unstable-slim
  15. # setup_script:
  16. # - apt-get -y update
  17. # - apt-get -y install ca-certificates gccgo-12 git
  18. # - ln -sf /usr/bin/go-12 /usr/local/bin/go
  19. # env:
  20. # # gccgo doesn't support race test
  21. # TEST_FLAG: ""
  22. - name: Test on Linux ARM64
  23. arm_container:
  24. # The Alpine image has segmentation faults when running test -race, so
  25. # use Debian instead.
  26. image: golang:1.19.3-bullseye
  27. - name: Test on FreeBSD
  28. freebsd_instance:
  29. image_family: freebsd-13-1
  30. env:
  31. PATH: /usr/local/go/bin:$PATH
  32. GO_VERSION: 1.19.3
  33. go_toolchain_cache:
  34. fingerprint_key: $GO_VERSION
  35. folder: /usr/local/go
  36. populate_script: |
  37. pkg install -y curl
  38. curl -L -o go.tar.gz https://go.dev/dl/go$GO_VERSION.freebsd-amd64.tar.gz
  39. tar -C /usr/local -xf go.tar.gz
  40. - name: Test on NetBSD
  41. compute_engine_instance:
  42. image_project: pg-ci-images
  43. image: family/pg-ci-netbsd-vanilla-9-2
  44. platform: netbsd
  45. env:
  46. GO_PKG: go118
  47. PATH: /usr/pkg/$GO_PKG/bin:$PATH
  48. go_pkg_cache:
  49. fingerprint_key: $GO_PKG
  50. folder: /usr/pkg/$GO_PKG
  51. populate_script: pkgin -y install $GO_PKG
  52. - name: Test on OpenBSD
  53. compute_engine_instance:
  54. image_project: pg-ci-images
  55. image: family/pg-ci-openbsd-vanilla-7-2
  56. platform: openbsd
  57. env:
  58. PATH: /usr/local/go/bin:$PATH
  59. go_pkg_cache:
  60. fingerprint_key: 1.19.1p0
  61. folder: /usr/local/go
  62. populate_script: pkg_add go
  63. go_version_script: go version
  64. test_script: go test $TEST_FLAG ./...
  65. build_binaries_task:
  66. name: Build binaries
  67. only_if: $CIRRUS_BRANCH == 'master'
  68. alias: binaries
  69. env:
  70. CGO_ENABLED: 0
  71. container:
  72. image: golang:1.19.3-alpine
  73. go_modules_cache:
  74. fingerprint_script: cat go.sum
  75. folder: ~/go/pkg/mod
  76. go_build_cache:
  77. folder: ~/.cache/go-build
  78. # Git is not required for building the binaries, but we need to include for Go
  79. # to include VCS information in the binary.
  80. setup_script: apk add zip git
  81. # _bin is in .gitignore, so Git won't consider the repo dirty. This will
  82. # impact the binary, which encodes VCS information.
  83. build_binaries_script: |
  84. ELVISH_BUILD_VARIANT=official ./tools/buildall.sh . _bin HEAD
  85. binaries_artifacts:
  86. path: _bin/**
  87. binary_checksums_artifacts:
  88. path: _bin/*/elvish-HEAD.sha256sum
  89. check_binary_checksums_task:
  90. name: Check binary checksums ($HOST)
  91. only_if: $CIRRUS_BRANCH == 'master'
  92. container:
  93. image: golang:1.19.3-alpine
  94. depends_on: binaries
  95. matrix:
  96. - env:
  97. HOST: cdg
  98. - env:
  99. HOST: hkg
  100. setup_script: apk add git curl
  101. # Enable auto cancellation - if there is another push, only the task to
  102. # compare the website against the newer commit should continue.
  103. auto_cancellation: true
  104. wait_website_update_script: |
  105. ts=$(git show -s --format=%ct HEAD)
  106. wait=10
  107. while true; do
  108. website_ts=$(curl -sS https://$HOST.elv.sh/commit-ts.txt)
  109. if test -z "$website_ts"; then
  110. echo "website has no commit-ts.txt yet"
  111. elif test "$website_ts" -ge "$ts"; then
  112. echo "website ($website_ts) >= CI ($ts)"
  113. exit 0
  114. else
  115. echo "website ($website_ts) < CI ($ts)"
  116. fi
  117. sleep $wait
  118. test $wait -lt 96 && wait=`echo "$wait * 2" | bc`
  119. done
  120. check_binary_checksums_script: |
  121. curl -o checksums.zip https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/binaries/binary_checksums.zip
  122. unzip checksums.zip
  123. cd _bin
  124. ret=0
  125. for f in */elvish-HEAD.sha256sum; do
  126. website_sum=$(curl -sS https://$HOST.dl.elv.sh/$f | awk '{print $1}')
  127. ci_sum=$(cat $f | awk '{print $1}')
  128. if test "$website_sum" = "$ci_sum"; then
  129. echo "$f: website == CI ($ci_sum)"
  130. else
  131. echo "$f: website ($website_sum) != CI ($ci_sum)"
  132. ret=1
  133. fi
  134. done
  135. exit $ret