mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-22 02:30:31 +00:00
Build MSIs for Windows using CircleCI (#766)
* Try to build MSIs from CircleCI using wixl/msitools * Upload msis * Change condition * Update Platform * Update Platform * Don't build ARM, it's apparently not well supported * Don't build ARM, it's apparently not well supported * Remove appveyor config * Update comments * newline
This commit is contained in:
parent
7174cfce40
commit
f0a5cd542c
@ -157,6 +157,43 @@ jobs:
|
||||
paths:
|
||||
- upload
|
||||
|
||||
build-windows:
|
||||
docker:
|
||||
- image: circleci/golang:1.16
|
||||
|
||||
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 tools
|
||||
command: |
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install msitools wixl
|
||||
|
||||
- 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;
|
||||
bash contrib/msi/build-msi.sh x64
|
||||
bash contrib/msi/build-msi.sh x86
|
||||
mv *.msi /tmp/upload
|
||||
|
||||
- persist_to_workspace:
|
||||
root: /tmp
|
||||
paths:
|
||||
- upload
|
||||
|
||||
build-other:
|
||||
docker:
|
||||
- image: circleci/golang:1.16
|
||||
@ -187,13 +224,6 @@ jobs:
|
||||
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 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:
|
||||
@ -217,9 +247,11 @@ workflows:
|
||||
- lint
|
||||
- build-linux
|
||||
- build-macos
|
||||
- build-windows
|
||||
- build-other
|
||||
- upload:
|
||||
requires:
|
||||
- build-linux
|
||||
- build-macos
|
||||
- build-windows
|
||||
- build-other
|
||||
|
20
appveyor.yml
20
appveyor.yml
@ -1,20 +0,0 @@
|
||||
version: '{build}'
|
||||
pull_requests:
|
||||
do_not_increment_build_number: true
|
||||
os: Visual Studio 2017
|
||||
shallow_clone: false
|
||||
|
||||
environment:
|
||||
MSYS2_PATH_TYPE: inherit
|
||||
CHERE_INVOKING: enabled_from_arguments
|
||||
|
||||
build_script:
|
||||
- cmd: >-
|
||||
cd %APPVEYOR_BUILD_FOLDER%
|
||||
- c:\msys64\usr\bin\bash -lc "./contrib/msi/build-msi.sh x64"
|
||||
- c:\msys64\usr\bin\bash -lc "./contrib/msi/build-msi.sh x86"
|
||||
|
||||
test: off
|
||||
|
||||
artifacts:
|
||||
- path: '*.msi'
|
@ -1,9 +1,7 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
# This script generates an MSI file for Yggdrasil for a given architecture. It
|
||||
# needs to run on Windows within MSYS2 and Go 1.13 or later must be installed on
|
||||
# the system and within the PATH. This is ran currently by Appveyor (see
|
||||
# appveyor.yml in the repository root) for both x86 and x64.
|
||||
# needs to run on Linux or macOS with Go 1.16, wixl and msitools installed.
|
||||
#
|
||||
# Author: Neil Alexander <neilalexander@users.noreply.github.com>
|
||||
|
||||
@ -11,7 +9,7 @@
|
||||
PKGARCH=$1
|
||||
if [ "${PKGARCH}" == "" ];
|
||||
then
|
||||
echo "tell me the architecture: x86 or x64"
|
||||
echo "tell me the architecture: x86, x64 or arm"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -28,28 +26,11 @@ then
|
||||
git checkout ${APPVEYOR_REPO_BRANCH}
|
||||
fi
|
||||
|
||||
# Install prerequisites within MSYS2
|
||||
pacman -S --needed --noconfirm unzip git curl
|
||||
|
||||
# Download the wix tools!
|
||||
if [ ! -d wixbin ];
|
||||
then
|
||||
curl -LO https://github.com/wixtoolset/wix3/releases/download/wix3112rtm/wix311-binaries.zip
|
||||
if [ `md5sum wix311-binaries.zip | cut -f 1 -d " "` != "47a506f8ab6666ee3cc502fb07d0ee2a" ];
|
||||
then
|
||||
echo "wix package didn't match expected checksum"
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p wixbin
|
||||
unzip -o wix311-binaries.zip -d wixbin || (
|
||||
echo "failed to unzip WiX"
|
||||
exit 1
|
||||
)
|
||||
fi
|
||||
|
||||
# Build Yggdrasil!
|
||||
[ "${PKGARCH}" == "x64" ] && GOOS=windows GOARCH=amd64 CGO_ENABLED=0 ./build
|
||||
[ "${PKGARCH}" == "x86" ] && GOOS=windows GOARCH=386 CGO_ENABLED=0 ./build
|
||||
[ "${PKGARCH}" == "x64" ] && GOOS=windows GOARCH=amd64 CGO_ENABLED=0 ./build -p -l "-aslr"
|
||||
[ "${PKGARCH}" == "x86" ] && GOOS=windows GOARCH=386 CGO_ENABLED=0 ./build -p -l "-aslr"
|
||||
[ "${PKGARCH}" == "arm" ] && GOOS=windows GOARCH=arm CGO_ENABLED=0 ./build -p -l "-aslr"
|
||||
#[ "${PKGARCH}" == "arm64" ] && GOOS=windows GOARCH=arm64 CGO_ENABLED=0 ./build
|
||||
|
||||
# Create the postinstall script
|
||||
cat > updateconfig.bat << EOF
|
||||
@ -58,9 +39,11 @@ if not exist %ALLUSERSPROFILE%\\Yggdrasil (
|
||||
)
|
||||
if not exist %ALLUSERSPROFILE%\\Yggdrasil\\yggdrasil.conf (
|
||||
if exist yggdrasil.exe (
|
||||
if not exist %ALLUSERSPROFILE%\\Yggdrasil\\yggdrasil.conf (
|
||||
yggdrasil.exe -genconf > %ALLUSERSPROFILE%\\Yggdrasil\\yggdrasil.conf
|
||||
)
|
||||
)
|
||||
)
|
||||
EOF
|
||||
|
||||
# Work out metadata for the package info
|
||||
@ -72,12 +55,16 @@ PKGVERSIONMS=$(echo $PKGVERSION | tr - .)
|
||||
PKGGUID="54a3294e-a441-4322-aefb-3bb40dd022bb" PKGINSTFOLDER="ProgramFilesFolder"
|
||||
|
||||
# Download the Wintun driver
|
||||
curl -o wintun.zip https://www.wintun.net/builds/wintun-0.10.2.zip
|
||||
unzip wintun.zip
|
||||
if [ $PKGARCH = "x64" ]; then
|
||||
PKGMSMNAME=wintun-x64.msm
|
||||
curl -o ${PKGMSMNAME} https://www.wintun.net/builds/wintun-amd64-0.7.msm || (echo "couldn't get wintun"; exit 1)
|
||||
PKGWINTUNDLL=wintun/bin/amd64/wintun.dll
|
||||
elif [ $PKGARCH = "x86" ]; then
|
||||
PKGMSMNAME=wintun-x86.msm
|
||||
curl -o ${PKGMSMNAME} https://www.wintun.net/builds/wintun-x86-0.7.msm || (echo "couldn't get wintun"; exit 1)
|
||||
PKGWINTUNDLL=wintun/bin/x86/wintun.dll
|
||||
elif [ $PKGARCH = "arm" ]; then
|
||||
PKGWINTUNDLL=wintun/bin/arm/wintun.dll
|
||||
#elif [ $PKGARCH = "arm64" ]; then
|
||||
# PKGWINTUNDLL=wintun/bin/arm64/wintun.dll
|
||||
else
|
||||
echo "wasn't sure which architecture to get wintun for"
|
||||
exit 1
|
||||
@ -100,6 +87,7 @@ cat > wix.xml << EOF
|
||||
Language="1033"
|
||||
Codepage="1252"
|
||||
Version="${PKGVERSIONMS}"
|
||||
Platform="${PKGARCH}"
|
||||
Manufacturer="github.com/yggdrasil-network">
|
||||
|
||||
<Package
|
||||
@ -136,6 +124,12 @@ cat > wix.xml << EOF
|
||||
Source="yggdrasil.exe"
|
||||
KeyPath="yes" />
|
||||
|
||||
<File
|
||||
Id="Wintun"
|
||||
Name="wintun.dll"
|
||||
DiskId="1"
|
||||
Source="${PKGWINTUNDLL}" />
|
||||
|
||||
<ServiceInstall
|
||||
Id="ServiceInstaller"
|
||||
Account="LocalSystem"
|
||||
@ -176,12 +170,6 @@ cat > wix.xml << EOF
|
||||
</Component>
|
||||
</Directory>
|
||||
</Directory>
|
||||
|
||||
<Merge
|
||||
Id="Wintun"
|
||||
Language="0"
|
||||
DiskId="1"
|
||||
SourceFile="${PKGMSMNAME}" />
|
||||
</Directory>
|
||||
|
||||
<Feature Id="YggdrasilFeature" Title="Yggdrasil" Level="1">
|
||||
@ -190,13 +178,6 @@ cat > wix.xml << EOF
|
||||
<ComponentRef Id="ConfigScript" />
|
||||
</Feature>
|
||||
|
||||
<Feature Id="WintunFeature" Title="Wintun" Level="1">
|
||||
<Condition Level="0">
|
||||
UPGRADINGPRODUCTCODE
|
||||
</Condition>
|
||||
<MergeRef Id="Wintun" />
|
||||
</Feature>
|
||||
|
||||
<CustomAction
|
||||
Id="UpdateGenerateConfig"
|
||||
Directory="YggdrasilInstallFolder"
|
||||
@ -208,9 +189,7 @@ cat > wix.xml << EOF
|
||||
<InstallExecuteSequence>
|
||||
<Custom
|
||||
Action="UpdateGenerateConfig"
|
||||
Before="StartServices">
|
||||
NOT Installed AND NOT REMOVE
|
||||
</Custom>
|
||||
Before="StartServices" />
|
||||
</InstallExecuteSequence>
|
||||
|
||||
</Product>
|
||||
@ -218,7 +197,4 @@ cat > wix.xml << EOF
|
||||
EOF
|
||||
|
||||
# Generate the MSI
|
||||
CANDLEFLAGS="-nologo"
|
||||
LIGHTFLAGS="-nologo -spdb -sice:ICE71 -sice:ICE61"
|
||||
wixbin/candle $CANDLEFLAGS -out ${PKGNAME}-${PKGVERSION}-${PKGARCH}.wixobj -arch ${PKGARCH} wix.xml && \
|
||||
wixbin/light $LIGHTFLAGS -ext WixUtilExtension.dll -out ${PKGNAME}-${PKGVERSION}-${PKGARCH}.msi ${PKGNAME}-${PKGVERSION}-${PKGARCH}.wixobj
|
||||
wixl -v wix.xml -a ${PKGARCH} -o ${PKGNAME}-${PKGVERSION}-${PKGARCH}.msi
|
||||
|
Loading…
Reference in New Issue
Block a user