Skip to content

Commit

Permalink
test build, windows/linux make scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
phendryx committed Sep 27, 2023
1 parent 54447ff commit 459571c
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 33 deletions.
38 changes: 37 additions & 1 deletion .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ jobs:
go-version: 1.16
- name: Build
run: make build-linux

- uses: actions/upload-artifact@v3
if: ${{ env.ACT }}
with:
name: files
path: albiondata-client

- uses: actions/upload-artifact@v3
if: ${{ env.ACT }}
with:
name: files
path: update-linux-amd64.gz

build-windows:
name: Build Windows Client
runs-on: ubuntu-latest
Expand All @@ -23,8 +36,31 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: 1.16
- name: Build

- name: install nsis
run: sudo apt-get update; sudo apt-get -y install nsis

- name: Make
run: make build-windows

- uses: actions/upload-artifact@v3
if: ${{ env.ACT }}
with:
name: files
path: albiondata-client.exe

- uses: actions/upload-artifact@v3
if: ${{ env.ACT }}
with:
name: files
path: update-windows-amd64.exe.gz

- uses: actions/upload-artifact@v3
if: ${{ env.ACT }}
with:
name: files
path: albiondata-client-amd64-installer.exe

build-darwin:
name: Build MacOS Client
runs-on: macos-13
Expand Down
2 changes: 2 additions & 0 deletions scripts/build-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ go build -ldflags "-s -w -X main.version=$GITHUB_REF_NAME" albiondata-client.go

./albiondata-client -version

cp albiondata-client albiondata-client.old
gzip -9 albiondata-client
mv albiondata-client.gz update-linux-amd64.gz
mv albiondata-client.old albiondata-client
53 changes: 21 additions & 32 deletions scripts/build-windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,30 @@

set -eo pipefail

# sudo apt update && sudo apt install -y nsis nsis-pluginapi wine wine32

sudo dpkg --add-architecture i386 && sudo apt-get update && sudo apt-get install -y --no-install-recommends \
g++ \
gcc \
libc6-dev \
make \
pkg-config \
ca-certificates \
wget \
git \
ssh \
mingw-w64 \
nsis \
wine-stable \
wine32

export CGO_CPPFLAGS="-I $GOPATH/src/github.com/broderickhyman/albiondata-client/thirdparty/WpdPack/Include/"
export CGO_LDFLAGS="-L $GOPATH/src/github.com/broderickhyman/albiondata-client/thirdparty/WpdPack/Lib/x64/"
export GOOS=windows
export GOARCH=amd64
export CGO_ENABLED=1
export CXX=x86_64-w64-mingw32-g++
export CC=x86_64-w64-mingw32-gcc
go build -ldflags "-s -w -X main.version=$GITHUB_REF_NAME" -o albiondata-client.exe -v -x albiondata-client.go

# Add icon to the .exe
wine thirdparty/rcedit/rcedit.exe albiondata-client.exe --set-icon icon/albiondata-client.ico

# Make the NSIS Installer
rm -f rsrc_windows_*
rm -f albiondata-client.exe
rm -f albiondata-client.*.bak
rm -f .albiondata-client.*.old

rm -f albiondata-client-amd64-installer.exe

go install github.com/tc-hib/go-winres@latest

export PATH="$PATH:/root/go/bin"

go-winres make

env GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -X main.version=$GITHUB_REF_NAME" -o albiondata-client.exe -v -x albiondata-client.go

go-winres patch albiondata-client.exe

cd pkg/nsis
make nsis
cd ../..

wine albiondata-client.exe -version
cd ../..
ls -la albiondata-client*

cp albiondata-client.exe albiondata-client.exe.copy
gzip -9 albiondata-client.exe
mv albiondata-client.exe.gz update-windows-amd64.exe.gz
mv albiondata-client.exe.copy albiondata-client.exe

0 comments on commit 459571c

Please sign in to comment.