From b0f0741a9b0630a5b8b4e0030757b84e2b2d1233 Mon Sep 17 00:00:00 2001 From: Devin Carr Date: Thu, 15 Sep 2022 14:26:02 -0700 Subject: [PATCH] TUN-6590: Use Windows Teamcity agent to build binary --- .teamcity/package-windows.sh | 17 +++++++++++++++++ Makefile | 9 ++++++++- build-packages.sh | 9 --------- cfsetup.yaml | 31 +++++++++++++++++++++++-------- 4 files changed, 48 insertions(+), 18 deletions(-) create mode 100755 .teamcity/package-windows.sh diff --git a/.teamcity/package-windows.sh b/.teamcity/package-windows.sh new file mode 100755 index 00000000..9d92a21f --- /dev/null +++ b/.teamcity/package-windows.sh @@ -0,0 +1,17 @@ +VERSION=$(git describe --tags --always --match "[0-9][0-9][0-9][0-9].*.*") +echo $VERSION + +export TARGET_OS=windows +# This controls the directory the built artifacts go into +export ARTIFACT_DIR=built_artifacts/ +mkdir -p $ARTIFACT_DIR +windowsArchs=("amd64" "386") +for arch in ${windowsArchs[@]}; do + export TARGET_ARCH=$arch + # Copy exe into final directory + cp ./artifacts/cloudflared-windows-$arch.exe $ARTIFACT_DIR/cloudflared-windows-$arch.exe + cp ./artifacts/cloudflared-windows-$arch.exe ./cloudflared.exe + make cloudflared-msi + # Copy msi into final directory + mv cloudflared-$VERSION-$arch.msi $ARTIFACT_DIR/cloudflared-windows-$arch.msi +done \ No newline at end of file diff --git a/Makefile b/Makefile index f0c469b0..555d57e2 100644 --- a/Makefile +++ b/Makefile @@ -198,7 +198,7 @@ cloudflared-pkg: cloudflared cloudflared.1 $(call build_package,osxpkg) .PHONY: cloudflared-msi -cloudflared-msi: cloudflared +cloudflared-msi: wixl --define Version=$(VERSION) --define Path=$(EXECUTABLE_PATH) --output cloudflared-$(VERSION)-$(TARGET_ARCH).msi cloudflared.wxs .PHONY: cloudflared-darwin-amd64.tgz @@ -288,6 +288,13 @@ github-mac-upload: python3 github_release.py --path artifacts/cloudflared-darwin-amd64.tgz --release-version $(VERSION) --name cloudflared-darwin-amd64.tgz python3 github_release.py --path artifacts/cloudflared-amd64.pkg --release-version $(VERSION) --name cloudflared-amd64.pkg +.PHONY: github-windows-upload +github-windows-upload: + python3 github_release.py --path built_artifacts/cloudflared-windows-amd64.exe --release-version $(VERSION) --name cloudflared-windows-amd64.exe + python3 github_release.py --path built_artifacts/cloudflared-windows-amd64.msi --release-version $(VERSION) --name cloudflared-windows-amd64.msi + python3 github_release.py --path built_artifacts/cloudflared-windows-386.exe --release-version $(VERSION) --name cloudflared-windows-386.exe + python3 github_release.py --path built_artifacts/cloudflared-windows-386.msi --release-version $(VERSION) --name cloudflared-windows-386.msi + .PHONY: tunnelrpc-deps tunnelrpc-deps: which capnp # https://capnproto.org/install.html diff --git a/build-packages.sh b/build-packages.sh index 97c5b681..6ca0bcd8 100755 --- a/build-packages.sh +++ b/build-packages.sh @@ -7,15 +7,6 @@ export CGO_ENABLED=0 # This controls the directory the built artifacts go into export ARTIFACT_DIR=built_artifacts/ mkdir -p $ARTIFACT_DIR -windowsArchs=("amd64" "386") -export TARGET_OS=windows -for arch in ${windowsArchs[@]}; do - export TARGET_ARCH=$arch - make cloudflared-msi - mv ./cloudflared.exe $ARTIFACT_DIR/cloudflared-windows-$arch.exe - mv cloudflared-$VERSION-$arch.msi $ARTIFACT_DIR/cloudflared-windows-$arch.msi -done - linuxArchs=("386" "amd64" "arm" "armhf" "arm64") export TARGET_OS=linux diff --git a/cfsetup.yaml b/cfsetup.yaml index a09e7f77..585771b1 100644 --- a/cfsetup.yaml +++ b/cfsetup.yaml @@ -133,7 +133,7 @@ stretch: &stretch - make publish-deb github-release-macos-amd64: build_dir: *build_dir - builddeps: + builddeps: &build_pygithub - *pinned_go - build-essential - python3-dev @@ -145,6 +145,27 @@ stretch: &stretch - pip3 install pygithub==1.55 post-cache: - make github-mac-upload + github-release-windows: + build_dir: *build_dir + builddeps: + - *pinned_go + - build-essential + - python3-dev + - libffi-dev + - python3-setuptools + - python3-pip + - wget + # libmsi and libgcab are libraries the wixl binary depends on. + - libmsi-dev + - libgcab-dev + pre-cache: + - wget https://github.com/sudarshan-reddy/msitools/releases/download/v0.101b/wixl -P /usr/local/bin + - chmod a+x /usr/local/bin/wixl + - pip3 install pynacl==1.4.0 + - pip3 install pygithub==1.55 + post-cache: + - .teamcity/package-windows.sh + - make github-windows-upload test: build_dir: *build_dir builddeps: @@ -204,13 +225,7 @@ stretch: &stretch - .teamcity/update-homebrew-core.sh github-message-release: build_dir: *build_dir - builddeps: - - *pinned_go - - build-essential - - python3-dev - - libffi-dev - - python3-setuptools - - python3-pip + builddeps: *build_pygithub pre-cache: *install_pygithub post-cache: - make github-message