forked from PostgREST/postgrest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.cirrus.yml
71 lines (59 loc) · 2.42 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
freebsd_instance:
image: freebsd-12-2-release-amd64
build_task:
env:
TOKEN: ENCRYPTED[c99babbf04e8a33962ffbbc75bf20d3abe408f9bede5ed5d8956cd24da6fdb34266c920984cc43f8106ef3423fba0e98]
# caches the freebsd package downloads
# saves probably just a couple of seconds, but hey...
pkg_cache:
folder: /var/cache/pkg
install_script:
# - pkg update
- pkg install -y postgresql12-client ghc hs-cabal-install jq git
# cache the hackage index file and downloads which are
# cabal v2-update downloads an incremental update, so we don't need to keep this up2date
packages_cache:
# warning: don't use ~/.cabal here, this will break the cache
folder: /.cabal/packages
reupload_on_changes: false
# cache the dependencies built by cabal
# they have to be uploaded on every change to make the next build fast
store_cache:
# warning: don't use ~/.cabal here, this will break the cache
folder: /.cabal/store
fingerprint_script: cat postgrest.cabal
reupload_on_changes: true
build_script:
- cabal v2-update
- |
if test "$CIRRUS_TAG" = "nightly"
then
cabal_nightly_version=$(git show -s --format='%cd' --date='format:%Y%m%d')
sed -i '' "s/^version:.*/version:$cabal_nightly_version/" postgrest.cabal
fi
## compile for 30 minutes tops
- timeout 1800 cabal v2-build -j1 || test "$?" = "124"
publish_script:
- |
if test ! "$CIRRUS_TAG"
then
echo 'No tag pushed. Skip release.'
else
cabal v2-install
bin_name=""
if test $CIRRUS_TAG = "nightly"
then
suffix=$(git show -s --format="%cd-%h" --date="format:%Y-%m-%d-%H-%M")
bin_name=postgrest-nightly-$suffix-freebsd.tar.xz
else
bin_name=postgrest-$CIRRUS_TAG-freebsd.tar.xz
fi
release_id=$(curl -s https://api.github.com/repos/$CIRRUS_REPO_FULL_NAME/releases/tags/$CIRRUS_TAG | jq .id)
echo "Uploading $bin_name to gh release: $release_id"
tar cvJf $bin_name --dereference -C /.cabal/bin postgrest
## We don't use ghr here because it doesn't provide freebsd binaries: https://github.com/tcnksm/ghr/issues/127
curl -X POST --data-binary @$bin_name \
-H "Authorization:token $TOKEN" \
-H "Content-Type:application/octet-stream" \
"https://uploads.github.com/repos/$CIRRUS_REPO_FULL_NAME/releases/$release_id/assets?name=$bin_name"
fi