Skip to content

Commit 933ce38

Browse files
Merge pull request #91 from containers/circleci
Add Circleci
2 parents cfe6117 + e7e7874 commit 933ce38

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

.circleci/config.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
jobs:
3+
build:
4+
machine:
5+
image: ubuntu-1604:201903-01
6+
working_directory: /home/circleci/go/src/github.com/docker-lvm-plugin
7+
steps:
8+
- checkout
9+
- run: make circleci
10+
- run: sudo make test

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# Installation Directories
22
SYSCONFDIR ?=$(DESTDIR)/etc/docker
33
SYSTEMDIR ?=$(DESTDIR)/usr/lib/systemd/system
4-
GOLANG ?= /usr/bin/go
4+
ifndef $(GOLANG)
5+
GOLANG=$(shell which go)
6+
export GOLANG
7+
endif
58
BINARY ?= docker-lvm-plugin
69
MANINSTALLDIR?= ${DESTDIR}/usr/share/man
710
BINDIR ?=$(DESTDIR)/usr/libexec/docker
@@ -28,6 +31,10 @@ install:
2831
install -D -m 755 $(BINARY) $(BINDIR)/$(BINARY)
2932
install -D -m 644 docker-lvm-plugin.8 ${MANINSTALLDIR}/man8/docker-lvm-plugin.8
3033

34+
.PHONY: circleci
35+
circleci:
36+
./tests/setup_circleci.sh
37+
3138
.PHONY: test
3239
test:
3340
./tests/run_tests.sh

tests/setup_circleci.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
setup_circleci(){
6+
if [ "$CIRCLECI" = "true" ];then
7+
sudo apt-get update
8+
sudo apt-get install -y make xfsprogs lvm2 go-md2man thin-provisioning-tools
9+
10+
# Remove default golang (1.10.3) and install a custom version (1.14.3) of golang.
11+
# This is required for supporting go mod, and to be able to compile docker-lvm-plugin.
12+
sudo rm -rf /usr/local/go
13+
14+
# Install golang 1.14.3
15+
curl -L -o go1.14.3.linux-amd64.tar.gz https://dl.google.com/go/go1.14.3.linux-amd64.tar.gz
16+
sudo tar -C /usr/local -xzf go1.14.3.linux-amd64.tar.gz
17+
sudo chmod +x /usr/local/go
18+
rm -f go1.14.3.linux-amd64.tar.gz
19+
make
20+
sudo make install
21+
sudo systemctl start docker-lvm-plugin
22+
# Sleep for 5 seconds, to allow docker-lvm-plugin to start completely.
23+
sleep 5s
24+
echo "INFO: Circleci setup successful."
25+
fi
26+
}
27+
28+
setup_circleci

0 commit comments

Comments
 (0)