mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-11-23 18:15:24 +00:00
192 lines
7.8 KiB
YAML
192 lines
7.8 KiB
YAML
# Golang CircleCI 2.0 configuration file
|
|
#
|
|
# Check https://circleci.com/docs/2.0/language-go/ for more details
|
|
version: 2
|
|
jobs:
|
|
build-linux:
|
|
docker:
|
|
- image: circleci/golang:1.11
|
|
|
|
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)";
|
|
|
|
- run:
|
|
name: Install alien
|
|
command: |
|
|
sudo apt-get install -y alien
|
|
|
|
- run:
|
|
name: Test debug builds
|
|
command: |
|
|
./build -d
|
|
test -f yggdrasil && test -f yggdrasilctl
|
|
|
|
- run:
|
|
name: Build for Linux (including Debian packages and RPMs)
|
|
command: |
|
|
rm -f {yggdrasil,yggdrasilctl}
|
|
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;
|
|
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;
|
|
sudo alien --to-rpm yggdrasil*.deb --scripts --keep-version && mv *.rpm /tmp/upload/;
|
|
mv *.deb /tmp/upload/
|
|
|
|
- run:
|
|
name: Build for EdgeRouter
|
|
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;
|
|
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:
|
|
name: Install Go 1.11
|
|
command: |
|
|
cd /tmp
|
|
curl -LO https://dl.google.com/go/go1.11.5.darwin-amd64.pkg
|
|
sudo installer -pkg /tmp/go1.11.5.darwin-amd64.pkg -target /
|
|
|
|
- run:
|
|
name: Install Gomobile
|
|
command: |
|
|
GO111MODULE=off go get golang.org/x/mobile/cmd/gomobile
|
|
gomobile init
|
|
|
|
- run:
|
|
name: Build for macOS
|
|
command: |
|
|
GO111MODULE=on GOOS=darwin GOARCH=amd64 ./build
|
|
cp yggdrasil /tmp/upload/$CINAME-$CIVERSION-darwin-amd64
|
|
cp yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-darwin-amd64;
|
|
|
|
- run:
|
|
name: Build for macOS (.pkg format)
|
|
command: |
|
|
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:
|
|
- image: circleci/golang:1.11
|
|
|
|
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)";
|
|
|
|
- run:
|
|
name: Build for OpenBSD
|
|
command: |
|
|
rm -f {yggdrasil,yggdrasilctl}
|
|
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;
|
|
|
|
- run:
|
|
name: Build for FreeBSD
|
|
command: |
|
|
rm -f {yggdrasil,yggdrasilctl}
|
|
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;
|
|
|
|
- run:
|
|
name: Build for NetBSD
|
|
command: |
|
|
rm -f {yggdrasil,yggdrasilctl}
|
|
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;
|
|
|
|
- run:
|
|
name: Build for Windows
|
|
command: |
|
|
rm -f {yggdrasil,yggdrasilctl}
|
|
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;
|
|
|
|
- persist_to_workspace:
|
|
root: /tmp
|
|
paths:
|
|
- upload
|
|
|
|
upload:
|
|
machine: true
|
|
|
|
steps:
|
|
- attach_workspace:
|
|
at: /tmp
|
|
|
|
- store_artifacts:
|
|
path: /tmp/upload
|
|
destination: /
|
|
|
|
workflows:
|
|
version: 2
|
|
build-all:
|
|
jobs:
|
|
- build-linux
|
|
- build-macos
|
|
- build-other
|
|
- upload:
|
|
requires:
|
|
- build-linux
|
|
- build-macos
|
|
- build-other
|