forked from u-root/u-root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.cirrus.yml
55 lines (52 loc) · 2.12 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
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 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
go mod tidy
go mod verify
go mod vendor -v
git status
if [ -n "$(git status --porcelain vendor)" ]; then
echo '`vendor/` is out-of-date: run `go mod tidy && go mod vendor` and then'
echo 'check in the changes. If `go mod tidy && go mod vendor` results in no changes, make'
echo 'sure you are using the latest release of Go.'
git status --porcelain vendor
exit 1
fi
build_task:
<< : *REGULAR_TASK_TEMPLATE
depends_on:
- test
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