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
|
|
|
|
version: 2
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
docker:
|
2018-10-05 18:42:21 +00:00
|
|
|
- image: circleci/golang:1.11
|
2018-03-02 19:13:20 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
2018-06-25 13:17:07 +00: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-03-05 20:26:55 +00:00
|
|
|
echo 'export CIVERSION=$(sh contrib/semver/version.sh | cut -c 2-)' >> $BASH_ENV
|
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:
|
2018-06-25 13:17:07 +00:00
|
|
|
name: Install alien
|
|
|
|
command: |
|
|
|
|
sudo apt-get install -y alien
|
|
|
|
|
2018-10-05 18:42:21 +00:00
|
|
|
- run:
|
|
|
|
name: Test debug builds
|
|
|
|
command: |
|
|
|
|
./build -d
|
|
|
|
test -f yggdrasil && test -f yggdrasilctl
|
|
|
|
|
2018-06-25 13:17:07 +00:00
|
|
|
- run:
|
|
|
|
name: Build for Linux (including Debian packages and RPMs)
|
2018-03-02 19:13:20 +00:00
|
|
|
command: |
|
2018-10-05 18:42:21 +00:00
|
|
|
rm -f {yggdrasil,yggdrasilctl}
|
2018-06-15 08:58:02 +00: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 09:04:04 +00: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;
|
|
|
|
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-06-25 13:21:31 +00:00
|
|
|
sudo alien --to-rpm yggdrasil*.deb --scripts --keep-version && mv *.rpm /tmp/upload/;
|
2018-03-02 19:13:20 +00:00
|
|
|
mv *.deb /tmp/upload/
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Build for macOS
|
|
|
|
command: |
|
2018-10-05 18:42:21 +00:00
|
|
|
rm -f {yggdrasil,yggdrasilctl}
|
2018-06-15 08:58:02 +00:00
|
|
|
GOOS=darwin GOARCH=amd64 ./build && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-darwin-amd64 && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-darwin-amd64;
|
|
|
|
GOOS=darwin GOARCH=386 ./build && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-darwin-i386 && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-darwin-i386;
|
2018-03-02 19:13:20 +00:00
|
|
|
|
2018-10-17 10:55:01 +00:00
|
|
|
- run:
|
|
|
|
name: Build for macOS (.pkg format)
|
|
|
|
command: |
|
|
|
|
rm -rf {yggdrasil,yggdrasilctl}
|
|
|
|
GOOS=darwin GOARCH=amd64 ./build && PKGARCH=amd64 sh contrib/macos/create-pkg.sh && mv *.pkg /tmp/upload/
|
|
|
|
GOOS=darwin GOARCH=386 ./build && PKGARCH=i386 sh contrib/macos/create-pkg.sh && mv *.pkg /tmp/upload/
|
|
|
|
|
2018-03-02 19:13:20 +00:00
|
|
|
- run:
|
|
|
|
name: Build for OpenBSD
|
|
|
|
command: |
|
2018-10-05 18:42:21 +00:00
|
|
|
rm -f {yggdrasil,yggdrasilctl}
|
2018-06-15 08:58:02 +00: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 18:42:21 +00:00
|
|
|
rm -f {yggdrasil,yggdrasilctl}
|
2018-06-15 08:58:02 +00: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 18:42:21 +00:00
|
|
|
rm -f {yggdrasil,yggdrasilctl}
|
2018-06-15 08:58:02 +00: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 18:42:21 +00:00
|
|
|
rm -f {yggdrasil,yggdrasilctl}
|
2018-06-15 09:00:58 +00: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
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Build for EdgeRouter
|
|
|
|
command: |
|
2018-10-05 18:42:21 +00:00
|
|
|
rm -f {yggdrasil,yggdrasilctl}
|
2018-03-02 19:13:20 +00:00
|
|
|
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;
|
|
|
|
mv *.deb /tmp/upload;
|
|
|
|
|
|
|
|
- store_artifacts:
|
|
|
|
path: /tmp/upload
|
|
|
|
destination: /
|
2018-12-03 17:44:26 +00:00
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Create tags (master branch only)
|
|
|
|
command: >
|
|
|
|
if [ "${CIRCLE_BRANCH}" == "master" ]; then
|
|
|
|
git tag -f -a $(sh contrib/semver/version.sh) -m "Created by CircleCI" && git push -f --tags;
|
|
|
|
else
|
|
|
|
echo "Only runs for master branch (this is ${CIRCLE_BRANCH})";
|
|
|
|
fi;
|
|
|
|
when: on_success
|