forked from u-root/u-root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.cirrus.yml
60 lines (57 loc) · 2.29 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
freebsd_instance:
# Keep this up to date over time, but use stable images only.
# We have run into issues while using a -snap image. Available images:
# https://cirrus-ci.org/guide/FreeBSD/#list-of-available-image-families
# Upstream FreeBSD release information: https://www.freebsd.org/where.html
image_family: freebsd-12-1
task_template: ®ULAR_TASK_TEMPLATE
provision_script:
- pkg install -y go dep git
# see https://cirrus-ci.org/guide/tips-and-tricks/#custom-clone-command
# for Golang, we need to have a src/gitrepo.host/owner/project structure
clone_script: |
export GIT_URL="https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git"
export CIRRUS_WORKING_DIR=$CIRRUS_WORKING_DIR/src/github.com/${CIRRUS_REPO_FULL_NAME}
mkdir -p $CIRRUS_WORKING_DIR
cd $CIRRUS_WORKING_DIR
if [ -z "$CIRRUS_PR" ]; then
echo "regular build $CIRRUS_CHANGE_IN_REPO"
git clone --recursive --branch=$CIRRUS_BRANCH $GIT_URL $CIRRUS_WORKING_DIR
git reset --hard $CIRRUS_CHANGE_IN_REPO
else
echo "PR build $CIRRUS_PR $CIRRUS_CHANGE_IN_REPO"
git clone --recursive $GIT_URL $CIRRUS_WORKING_DIR
git fetch origin pull/$CIRRUS_PR/head:pull/$CIRRUS_PR
git reset --hard $CIRRUS_CHANGE_IN_REPO
fi
test_task:
<< : *REGULAR_TASK_TEMPLATE
script: |
export GOPATH=$CIRRUS_WORKING_DIR
export CIRRUS_WORKING_DIR=$CIRRUS_WORKING_DIR/src/github.com/${CIRRUS_REPO_FULL_NAME}
cd $CIRRUS_WORKING_DIR
dep version
dep status
dep ensure -vendor-only
git status
if [ -n "$(git status --porcelain vendor)" ]; then
echo '`vendor/` is out-of-date: run `dep ensure -vendor-only` and then'
echo 'check in the changes. If `dep ensure` results in no changes, make'
echo 'sure you are using the latest release of dep.'
git status --porcelain vendor
exit 1
fi
build_task:
<< : *REGULAR_TASK_TEMPLATE
depends_on:
- test
prepare_script: |
export GOPATH=$CIRRUS_WORKING_DIR
export CIRRUS_WORKING_DIR=$CIRRUS_WORKING_DIR/src/github.com/${CIRRUS_REPO_FULL_NAME}
cd $CIRRUS_WORKING_DIR
dep ensure
script: |
export GOPATH=$CIRRUS_WORKING_DIR
export CIRRUS_WORKING_DIR=$CIRRUS_WORKING_DIR/src/github.com/${CIRRUS_REPO_FULL_NAME}
cd $CIRRUS_WORKING_DIR
go build