2018-03-02 19:13:20 +00:00
|
|
|
# Golang CircleCI 2.0 configuration file
|
|
|
|
#
|
|
|
|
# Check https://circleci.com/docs/2.0/language-go/ for more details
|
2019-03-13 18:27:20 +00:00
|
|
|
version: 2.1
|
2018-03-02 19:13:20 +00:00
|
|
|
jobs:
|
2019-03-02 00:38:18 +00:00
|
|
|
build-linux:
|
2018-03-02 19:13:20 +00:00
|
|
|
docker:
|
2019-10-24 10:16:52 +01:00
|
|
|
- image: circleci/golang:1.13.3
|
2018-03-02 19:13:20 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
2018-06-25 14:17:07 +01:00
|
|
|
|
2018-03-02 19:13:20 +00:00
|
|
|
- run:
|
2018-03-04 01:29:00 +00:00
|
|
|
name: Create artifact upload directory and set variables
|
|
|
|
command: |
|
|
|
|
mkdir /tmp/upload
|
2018-03-05 20:20:17 +00:00
|
|
|
echo 'export CINAME=$(sh contrib/semver/name.sh)' >> $BASH_ENV
|
2018-12-08 11:28:47 +00:00
|
|
|
echo 'export CIVERSION=$(sh contrib/semver/version.sh --bare)' >> $BASH_ENV
|
2019-06-11 15:30:55 +01:00
|
|
|
echo 'export CIVERSIONRPM=$(sh contrib/semver/version.sh --bare | tr "-" ".")' >> $BASH_ENV
|
2019-07-27 14:11:03 +01:00
|
|
|
echo 'export CIBRANCH=$(echo $CIRCLE_BRANCH | tr -d "/")' >> $BASH_ENV
|
2019-07-16 11:44:58 +01:00
|
|
|
case "$CINAME" in \
|
|
|
|
"yggdrasil") (echo 'export CICONFLICTS=yggdrasil-develop' >> $BASH_ENV) ;; \
|
|
|
|
"yggdrasil-develop") (echo 'export CICONFLICTS=yggdrasil' >> $BASH_ENV) ;; \
|
2019-07-16 11:48:31 +01:00
|
|
|
*) (echo 'export CICONFLICTS="yggdrasil yggdrasil-develop"' >> $BASH_ENV) ;; \
|
2019-07-16 11:44:58 +01:00
|
|
|
esac
|
2018-12-03 17:44:26 +00:00
|
|
|
git config --global user.email "$(git log --format='%ae' HEAD -1)";
|
|
|
|
git config --global user.name "$(git log --format='%an' HEAD -1)";
|
2018-03-02 19:13:20 +00:00
|
|
|
|
|
|
|
- run:
|
2019-06-11 15:30:55 +01:00
|
|
|
name: Install RPM utilities
|
2018-06-25 14:17:07 +01:00
|
|
|
command: |
|
2019-09-18 14:37:25 +01:00
|
|
|
sudo apt-get update
|
2019-06-11 15:30:55 +01:00
|
|
|
sudo apt-get install -y rpm file
|
|
|
|
mkdir -p ~/rpmbuild/BUILD ~/rpmbuild/RPMS ~/rpmbuild/SOURCES ~/rpmbuild/SPECS ~/rpmbuild/SRPMS
|
2018-06-25 14:17:07 +01:00
|
|
|
|
2019-07-27 14:15:07 +01:00
|
|
|
- run:
|
|
|
|
name: Test debug builds
|
|
|
|
command: |
|
|
|
|
./build -d
|
|
|
|
test -f yggdrasil && test -f yggdrasilctl
|
2018-10-05 19:42:21 +01:00
|
|
|
|
2018-06-25 14:17:07 +01:00
|
|
|
- run:
|
2019-06-11 15:30:55 +01:00
|
|
|
name: Build for Linux (including Debian packages)
|
2018-03-02 19:13:20 +00:00
|
|
|
command: |
|
2018-10-05 19:42:21 +01:00
|
|
|
rm -f {yggdrasil,yggdrasilctl}
|
2018-06-15 09:58:02 +01:00
|
|
|
PKGARCH=amd64 sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-linux-amd64 && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-linux-amd64;
|
|
|
|
PKGARCH=i386 sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-linux-i386 && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-linux-i386;
|
|
|
|
PKGARCH=mipsel sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-linux-mipsel && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-linux-mipsel;
|
|
|
|
PKGARCH=mips sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-linux-mips && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-linux-mips;
|
2018-07-20 10:04:04 +01:00
|
|
|
PKGARCH=armhf sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-linux-armhf && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-linux-armhf;
|
2019-10-23 11:24:00 +01:00
|
|
|
PKGARCH=armel sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-linux-armel && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-linux-armel;
|
2018-07-20 10:04:04 +01:00
|
|
|
PKGARCH=arm64 sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-linux-arm64 && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-linux-arm64;
|
2018-03-02 19:13:20 +00:00
|
|
|
mv *.deb /tmp/upload/
|
|
|
|
|
2019-06-11 15:30:55 +01:00
|
|
|
- run:
|
|
|
|
name: Build for Linux (RPM packages)
|
|
|
|
command: |
|
|
|
|
git clone https://github.com/yggdrasil-network/yggdrasil-package-rpm ~/rpmbuild/SPECS
|
2019-07-27 13:57:19 +01:00
|
|
|
cd ../ && tar -czvf ~/rpmbuild/SOURCES/v$CIVERSIONRPM --transform "s/project/yggdrasil-go-$CIBRANCH-$CIVERSIONRPM/" project
|
|
|
|
sed -i "s/yggdrasil-go/yggdrasil-go-$CIBRANCH/" ~/rpmbuild/SPECS/yggdrasil.spec
|
|
|
|
sed -i "s/^PKGNAME=yggdrasil/PKGNAME=yggdrasil-$CIBRANCH/" ~/rpmbuild/SPECS/yggdrasil.spec
|
2019-06-11 15:30:55 +01:00
|
|
|
sed -i "s/^Name\:.*/Name\: $CINAME/" ~/rpmbuild/SPECS/yggdrasil.spec
|
|
|
|
sed -i "s/^Version\:.*/Version\: $CIVERSIONRPM/" ~/rpmbuild/SPECS/yggdrasil.spec
|
2019-07-16 11:44:58 +01:00
|
|
|
sed -i "s/^Conflicts\:.*/Conflicts\: $CICONFLICTS/" ~/rpmbuild/SPECS/yggdrasil.spec
|
2019-06-11 15:30:55 +01:00
|
|
|
cat ~/rpmbuild/SPECS/yggdrasil.spec
|
|
|
|
GOARCH=amd64 rpmbuild -v --nodeps --target=x86_64 -ba ~/rpmbuild/SPECS/yggdrasil.spec
|
|
|
|
#GOARCH=386 rpmbuild -v --nodeps --target=i386 -bb ~/rpmbuild/SPECS/yggdrasil.spec
|
|
|
|
find ~/rpmbuild/RPMS/ -name '*.rpm' -exec mv {} /tmp/upload \;
|
|
|
|
find ~/rpmbuild/SRPMS/ -name '*.rpm' -exec mv {} /tmp/upload \;
|
|
|
|
|
2019-03-02 00:38:18 +00:00
|
|
|
- run:
|
2019-09-24 22:06:12 +01:00
|
|
|
name: Build for EdgeRouter and VyOS
|
2019-03-02 00:38:18 +00:00
|
|
|
command: |
|
|
|
|
rm -f {yggdrasil,yggdrasilctl}
|
|
|
|
git clone https://github.com/neilalexander/vyatta-yggdrasil /tmp/vyatta-yggdrasil;
|
|
|
|
cd /tmp/vyatta-yggdrasil;
|
|
|
|
BUILDDIR_YGG=$CIRCLE_WORKING_DIRECTORY ./build-edgerouter-x $CIRCLE_BRANCH;
|
|
|
|
BUILDDIR_YGG=$CIRCLE_WORKING_DIRECTORY ./build-edgerouter-lite $CIRCLE_BRANCH;
|
2019-09-24 22:06:12 +01:00
|
|
|
BUILDDIR_YGG=$CIRCLE_WORKING_DIRECTORY ./build-vyos-i386 $CIRCLE_BRANCH
|
|
|
|
BUILDDIR_YGG=$CIRCLE_WORKING_DIRECTORY ./build-vyos-amd64 $CIRCLE_BRANCH
|
2019-03-02 00:38:18 +00:00
|
|
|
mv *.deb /tmp/upload;
|
|
|
|
|
|
|
|
- persist_to_workspace:
|
|
|
|
root: /tmp
|
|
|
|
paths:
|
|
|
|
- upload
|
|
|
|
|
|
|
|
build-macos:
|
|
|
|
macos:
|
|
|
|
xcode: "10.0.0"
|
|
|
|
|
|
|
|
working_directory: ~/go/src/github.com/yggdrasil-network/yggdrasil-go
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Create artifact upload directory and set variables
|
|
|
|
command: |
|
|
|
|
mkdir /tmp/upload
|
|
|
|
echo 'export CINAME=$(sh contrib/semver/name.sh)' >> $BASH_ENV
|
|
|
|
echo 'export CIVERSION=$(sh contrib/semver/version.sh --bare)' >> $BASH_ENV
|
|
|
|
echo 'export PATH=$PATH:/usr/local/go/bin:~/go/bin' >> $BASH_ENV
|
|
|
|
git config --global user.email "$(git log --format='%ae' HEAD -1)";
|
|
|
|
git config --global user.name "$(git log --format='%an' HEAD -1)";
|
|
|
|
echo -e "Host *\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
|
|
|
|
|
|
|
|
- run:
|
2019-10-24 10:18:08 +01:00
|
|
|
name: Install Go 1.13.3
|
2019-03-02 00:38:18 +00:00
|
|
|
command: |
|
|
|
|
cd /tmp
|
2019-10-24 10:18:08 +01:00
|
|
|
curl -LO https://dl.google.com/go/go1.13.3.darwin-amd64.pkg
|
|
|
|
sudo installer -pkg /tmp/go1.13.3.darwin-amd64.pkg -target /
|
2019-03-02 00:38:18 +00:00
|
|
|
|
2019-03-13 19:09:09 +00:00
|
|
|
#- run:
|
|
|
|
# name: Install Gomobile
|
|
|
|
# command: |
|
|
|
|
# GO111MODULE=off go get golang.org/x/mobile/cmd/gomobile
|
|
|
|
# gomobile init
|
2019-03-02 00:38:18 +00:00
|
|
|
|
2018-03-02 19:13:20 +00:00
|
|
|
- run:
|
|
|
|
name: Build for macOS
|
|
|
|
command: |
|
2019-03-02 00:38:18 +00:00
|
|
|
GO111MODULE=on GOOS=darwin GOARCH=amd64 ./build
|
2019-03-04 08:35:45 +00:00
|
|
|
cp yggdrasil /tmp/upload/$CINAME-$CIVERSION-darwin-amd64
|
|
|
|
cp yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-darwin-amd64;
|
2018-03-02 19:13:20 +00:00
|
|
|
|
2018-10-17 11:55:01 +01:00
|
|
|
- run:
|
|
|
|
name: Build for macOS (.pkg format)
|
|
|
|
command: |
|
2019-03-02 00:38:18 +00:00
|
|
|
PKGARCH=amd64 sh contrib/macos/create-pkg.sh
|
|
|
|
mv *.pkg /tmp/upload/
|
|
|
|
|
|
|
|
#- run:
|
|
|
|
# name: Build framework for iOS (.framework format)
|
|
|
|
# command: |
|
|
|
|
# sudo GO111MODULE=off go get -v github.com/yggdrasil-network/yggdrasil-go/cmd/...
|
|
|
|
# sudo GO111MODULE=off go get -v github.com/yggdrasil-network/yggdrasil-go/src/...
|
|
|
|
# GO111MODULE=off ./build -i
|
|
|
|
# mv *.framework /tmp/upload
|
|
|
|
|
|
|
|
- persist_to_workspace:
|
|
|
|
root: /tmp
|
|
|
|
paths:
|
|
|
|
- upload
|
|
|
|
|
|
|
|
build-other:
|
|
|
|
docker:
|
2019-10-24 10:18:08 +01:00
|
|
|
- image: circleci/golang:1.13.3
|
2019-03-02 00:38:18 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Create artifact upload directory and set variables
|
|
|
|
command: |
|
|
|
|
mkdir /tmp/upload
|
|
|
|
echo 'export CINAME=$(sh contrib/semver/name.sh)' >> $BASH_ENV
|
|
|
|
echo 'export CIVERSION=$(sh contrib/semver/version.sh --bare)' >> $BASH_ENV
|
|
|
|
git config --global user.email "$(git log --format='%ae' HEAD -1)";
|
|
|
|
git config --global user.name "$(git log --format='%an' HEAD -1)";
|
2018-10-17 11:55:01 +01:00
|
|
|
|
2018-03-02 19:13:20 +00:00
|
|
|
- run:
|
|
|
|
name: Build for OpenBSD
|
|
|
|
command: |
|
2018-10-05 19:42:21 +01:00
|
|
|
rm -f {yggdrasil,yggdrasilctl}
|
2018-06-15 09:58:02 +01:00
|
|
|
GOOS=openbsd GOARCH=amd64 ./build && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-openbsd-amd64 && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-openbsd-amd64;
|
|
|
|
GOOS=openbsd GOARCH=386 ./build && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-openbsd-i386 && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-openbsd-i386;
|
2018-03-05 00:03:02 +00:00
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Build for FreeBSD
|
|
|
|
command: |
|
2018-10-05 19:42:21 +01:00
|
|
|
rm -f {yggdrasil,yggdrasilctl}
|
2018-06-15 09:58:02 +01:00
|
|
|
GOOS=freebsd GOARCH=amd64 ./build && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-freebsd-amd64 && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-freebsd-amd64;
|
|
|
|
GOOS=freebsd GOARCH=386 ./build && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-freebsd-i386 && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-freebsd-i386;
|
2018-03-05 00:03:02 +00:00
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Build for NetBSD
|
|
|
|
command: |
|
2018-10-05 19:42:21 +01:00
|
|
|
rm -f {yggdrasil,yggdrasilctl}
|
2018-06-15 09:58:02 +01:00
|
|
|
GOOS=netbsd GOARCH=amd64 ./build && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-netbsd-amd64 && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-netbsd-amd64;
|
|
|
|
GOOS=netbsd GOARCH=386 ./build && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-netbsd-i386 && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-netbsd-i386;
|
2018-03-02 19:13:20 +00:00
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Build for Windows
|
|
|
|
command: |
|
2018-10-05 19:42:21 +01:00
|
|
|
rm -f {yggdrasil,yggdrasilctl}
|
2018-06-15 10:00:58 +01:00
|
|
|
GOOS=windows GOARCH=amd64 ./build && mv yggdrasil.exe /tmp/upload/$CINAME-$CIVERSION-windows-amd64.exe && mv yggdrasilctl.exe /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-windows-amd64.exe;
|
|
|
|
GOOS=windows GOARCH=386 ./build && mv yggdrasil.exe /tmp/upload/$CINAME-$CIVERSION-windows-i386.exe && mv yggdrasilctl.exe /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-windows-i386.exe;
|
2018-03-02 19:13:20 +00:00
|
|
|
|
2019-03-02 00:38:18 +00:00
|
|
|
- persist_to_workspace:
|
|
|
|
root: /tmp
|
|
|
|
paths:
|
|
|
|
- upload
|
|
|
|
|
|
|
|
upload:
|
|
|
|
machine: true
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: /tmp
|
2018-03-02 19:13:20 +00:00
|
|
|
|
|
|
|
- store_artifacts:
|
|
|
|
path: /tmp/upload
|
|
|
|
destination: /
|
2019-03-02 00:38:18 +00:00
|
|
|
|
|
|
|
workflows:
|
2019-03-13 18:36:28 +00:00
|
|
|
version: 2.1
|
|
|
|
build:
|
2019-03-02 00:38:18 +00:00
|
|
|
jobs:
|
|
|
|
- build-linux
|
|
|
|
- build-macos
|
|
|
|
- build-other
|
|
|
|
- upload:
|
|
|
|
requires:
|
|
|
|
- build-linux
|
|
|
|
- build-macos
|
|
|
|
- build-other
|