Skip to content

Commit

Permalink
Update to Go 1.18, Apple Silicon support, v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SamJakob committed Jun 2, 2022
1 parent 65c1ace commit b555716
Show file tree
Hide file tree
Showing 12 changed files with 789 additions and 581 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.14
go-version: 1.18
- name: Run Builds
run: |
rm -rf ./out
Expand All @@ -43,7 +43,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.14
go-version: 1.18
- name: Run Builds
run: |
rm -rf ./out
Expand All @@ -67,7 +67,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.14
go-version: 1.18
- name: Run Builds
run: |
rm -rf ./out
Expand Down
40 changes: 31 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
name: Proxyscotch Build


on:
push:
branches: [ main , master ]
pull_request:
branches: [ main , master ]


jobs:
test-linux:
name: Test Linux Build
Expand All @@ -20,11 +18,19 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.14
- name: Test ProxyScotch
go-version: 1.18
- name: Test Proxyscotch
run: |
go get -d -v
go test ./libproxy
# Run a build but don't do anything with the artifacts.
# i.e., don't sign them or anything.
# This is just to check that a build would run correctly for release.
- name: Build Proxyscotch
run: |
go get -d -v
./build.sh linux server
./build.sh linux desktop
build-darwin:
name: Test Darwin Build
runs-on: macos-latest
Expand All @@ -34,11 +40,19 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.14
- name: Test ProxyScotch
go-version: 1.18
- name: Test Proxyscotch
run: |
go get -d -v
go test ./libproxy
# Run a build but don't do anything with the artifacts.
# i.e., don't sign them or anything.
# This is just to check that a build would run correctly for release.
- name: Build Proxyscotch
run: |
go get -d -v
./build.sh darwin server
./build.sh darwin desktop
build-windows:
name: Test Windows Build
runs-on: ubuntu-latest
Expand All @@ -50,8 +64,16 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.14
- name: Test ProxyScotch
go-version: 1.18
- name: Test Proxyscotch
run: |
go get -d -v
go test ./libproxy
# Run a build but don't do anything with the artifacts.
# i.e., don't sign them or anything.
# This is just to check that a build would run correctly for release.
- name: Build Proxyscotch
run: |
go get -d -v
go test ./libproxy
./build.sh windows server
./build.sh windows desktop
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# v0.1.0
- Apple Silicon support (Universal Binary) on Darwin (macOS).
- Update to Go 1.18.

# v0.0.1
- Initial release.
61 changes: 43 additions & 18 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/sh

# Set exit on error.
set -e

#
# Basic Prep...
#
Expand Down Expand Up @@ -175,7 +178,7 @@ fi


# We're running a build.
echo "Building Proxyscotch $BUILD_TYPE v$VERSION_NAME (build $VERSION_CODE) for $PLATFORM"
echo "Building Proxyscotch $BUILD_TYPE v$VERSION_NAME (build $VERSION_CODE) for $PLATFORM..."
echo "Developed by @NBTX (Apollo Software)"
echo ""
echo ""
Expand All @@ -193,17 +196,23 @@ if [ "$BUILD_TYPE" = "server" ]; then
echo "Executing go build..."

if [ "$PLATFORM" = "windows" ]; then
GOOS="$PLATFORM" go build -ldflags "-X main.VersionName=$VERSION_NAME -X main.VersionCode=$VERSION_CODE" -o "$OUTPUT_DIR/proxyscotch-server.exe" server/server.go
mv "$OUTPUT_DIR/proxyscotch-server.exe" "$OUTPUT_DIR/proxyscotch-server-windows-v${VERSION_NAME}.exe"
GOOS="$PLATFORM" GOARCH="amd64" go build -ldflags "-X main.VersionName=$VERSION_NAME -X main.VersionCode=$VERSION_CODE" -o "$OUTPUT_DIR/proxyscotch-server.exe" server/server.go
mv "$OUTPUT_DIR/proxyscotch-server.exe" "$OUTPUT_DIR/proxyscotch-server-windows-amd64-v${VERSION_NAME}.exe"

GOOS="$PLATFORM" GOARCH="arm64" go build -ldflags "-X main.VersionName=$VERSION_NAME -X main.VersionCode=$VERSION_CODE" -o "$OUTPUT_DIR/proxyscotch-server.exe" server/server.go
mv "$OUTPUT_DIR/proxyscotch-server.exe" "$OUTPUT_DIR/proxyscotch-server-windows-arm64-v${VERSION_NAME}.exe"

# echo "Compressing release binary..."
# WORKING_DIR=$(pwd)
# cd "$OUTPUT_DIR" || exit 1
# zip -r "proxyscotch-server-windows-v${VERSION_NAME}.zip" "proxyscotch-server-windows-v${VERSION_NAME}.exe"
# cd "$WORKING_DIR" || exit 1
else
GOOS="$PLATFORM" go build -ldflags "-X main.VersionName=$VERSION_NAME -X main.VersionCode=$VERSION_CODE" -o "$OUTPUT_DIR/proxyscotch-server" server/server.go
mv "$OUTPUT_DIR/proxyscotch-server" "$OUTPUT_DIR/proxyscotch-server-${PLATFORM}-v${VERSION_NAME}"
GOOS="$PLATFORM" GOARCH="amd64" go build -ldflags "-X main.VersionName=$VERSION_NAME -X main.VersionCode=$VERSION_CODE" -o "$OUTPUT_DIR/proxyscotch-server" server/server.go
mv "$OUTPUT_DIR/proxyscotch-server" "$OUTPUT_DIR/proxyscotch-server-${PLATFORM}-amd64-v${VERSION_NAME}"

GOOS="$PLATFORM" GOARCH="arm64" go build -ldflags "-X main.VersionName=$VERSION_NAME -X main.VersionCode=$VERSION_CODE" -o "$OUTPUT_DIR/proxyscotch-server" server/server.go
mv "$OUTPUT_DIR/proxyscotch-server" "$OUTPUT_DIR/proxyscotch-server-${PLATFORM}-arm64-v${VERSION_NAME}"

# echo "Compressing release binary..."
# WORKING_DIR=$(pwd)
Expand All @@ -222,6 +231,7 @@ fi

# Build the icon for the appropriate platform.
echo "Generating platform icon..."
go get github.com/cratonica/2goarray
if [ "$PLATFORM" = "darwin" ] || [ "$PLATFORM" = "linux" ]; then
cat "icons/icon.png" | go run github.com/cratonica/2goarray Data icon >> icons/icon_unix.go
elif [ "$PLATFORM" = "windows" ]; then
Expand Down Expand Up @@ -250,25 +260,38 @@ if [ "$PLATFORM" = "darwin" ]; then
mkdir -p "$OUTPUT_DIR/Proxyscotch.app/Contents/MacOS"
mkdir -p "$OUTPUT_DIR/Proxyscotch.app/Contents/MacOS/icons"
cp icons/icon.png "$OUTPUT_DIR/Proxyscotch.app/Contents/MacOS/icons/"
GOOS="darwin" GO111MODULE=on go build -ldflags "-X main.VersionName=$VERSION_NAME -X main.VersionCode=$VERSION_CODE" -o "$OUTPUT_DIR/Proxyscotch.app/Contents/MacOS/proxyscotch"

# Produce output binaries
mv "$OUTPUT_DIR/Proxyscotch.app" "$OUTPUT_DIR/Proxyscotch-macOS-v${VERSION_NAME}.app"
# Build amd64 (Intel) macOS binary.
CGO_ENABLED=1 GOOS="darwin" GOARCH="amd64" go build -ldflags "-X main.VersionName=$VERSION_NAME -X main.VersionCode=$VERSION_CODE" -o "$OUTPUT_DIR/Proxyscotch.app/Contents/MacOS/proxyscotch-amd64"

# Build arm64 (Apple Silicon) macOS binary.
CGO_ENABLED=1 GOOS="darwin" GOARCH="arm64" go build -ldflags "-X main.VersionName=$VERSION_NAME -X main.VersionCode=$VERSION_CODE" -o "$OUTPUT_DIR/Proxyscotch.app/Contents/MacOS/proxyscotch-arm64"

# Use `lipo` to merge the binaries into a universal binary.
lipo -create -output "$OUTPUT_DIR/Proxyscotch.app/Contents/MacOS/proxyscotch" "$OUTPUT_DIR/Proxyscotch.app/Contents/MacOS/proxyscotch-amd64" "$OUTPUT_DIR/Proxyscotch.app/Contents/MacOS/proxyscotch-arm64"

# Remove individual binaries to leave just universal binary.
rm "$OUTPUT_DIR/Proxyscotch.app/Contents/MacOS/proxyscotch-amd64"
rm "$OUTPUT_DIR/Proxyscotch.app/Contents/MacOS/proxyscotch-arm64"

# Produce output bundles
mv "$OUTPUT_DIR/Proxyscotch.app" "$OUTPUT_DIR/Proxyscotch-Desktop-macOS-v${VERSION_NAME}.app"

# Compressing output binaries
echo "Compressing output binaries"
# Compressing output bundles
echo "Compressing output bundles"

WORKING_DIR=$(pwd)
cd "$OUTPUT_DIR" || exit 1
zip -r "Proxyscotch-macOS-v${VERSION_NAME}.zip" "Proxyscotch-macOS-v${VERSION_NAME}.app"
zip -r "Proxyscotch-Desktop-macOS-v${VERSION_NAME}.zip" "Proxyscotch-Desktop-macOS-v${VERSION_NAME}.app"

cd "$WORKING_DIR" || exit 1
elif [ "$PLATFORM" = "windows" ]; then
[ -f "rsrc.syso" ] && rm rsrc.syso
go get github.com/akavel/rsrc

rsrc -manifest="$OUTPUT_DIR/proxyscotch.manifest" -ico="icons/icon.ico" -o rsrc.syso
GOOS="windows" GO111MODULE=on go build -ldflags "-X main.VersionName=$VERSION_NAME -X main.VersionCode=$VERSION_CODE -H=windowsgui" -o "$OUTPUT_DIR/proxyscotch.exe"
CGO_ENABLED=1 GOOS="windows" GOARCH="amd64" go build -ldflags "-X main.VersionName=$VERSION_NAME -X main.VersionCode=$VERSION_CODE -H=windowsgui" -o "$OUTPUT_DIR/proxyscotch-amd64.exe"
CGO_ENABLED=1 GOOS="windows" GOARCH="arm64" go build -ldflags "-X main.VersionName=$VERSION_NAME -X main.VersionCode=$VERSION_CODE -H=windowsgui" -o "$OUTPUT_DIR/proxyscotch-arm64.exe"

mkdir "$OUTPUT_DIR/icons"
cp icons/icon.png "$OUTPUT_DIR/icons/icon.png"
Expand All @@ -278,20 +301,22 @@ elif [ "$PLATFORM" = "windows" ]; then
rm "$OUTPUT_DIR/proxyscotch.manifest"
rm rsrc.syso

mv "$OUTPUT_DIR/proxyscotch.exe" "$OUTPUT_DIR/Proxyscotch-Windows-v${VERSION_NAME}.exe"
mv "$OUTPUT_DIR/proxyscotch-amd64.exe" "$OUTPUT_DIR/Proxyscotch-Desktop-Windows-amd64-v${VERSION_NAME}.exe"
mv "$OUTPUT_DIR/proxyscotch-arm64.exe" "$OUTPUT_DIR/Proxyscotch-Desktop-Windows-arm64-v${VERSION_NAME}.exe"

# Compressing output binaries
echo "Compressing output binaries"
# Compressing output bundles
echo "Compressing output bundles"

# WORKING_DIR=$(pwd)
# cd "$OUTPUT_DIR" || exit 1
# zip -r "Proxyscotch-Windows-v${VERSION_NAME}.zip" "Proxyscotch-Windows-v${VERSION_NAME}.exe"
# cd "$WORKING_DIR" || exit 1
elif [ "$PLATFORM" = "linux" ]; then
GOOS="linux" GO111MODULE=on go build -ldflags "-X main.VersionName=$VERSION_NAME -X main.VersionCode=$VERSION_CODE" -o "$OUTPUT_DIR/Proxyscotch-Linux-v${VERSION_NAME}"
CGO_ENABLED=1 GOOS="linux" GOARCH="amd64" go build -ldflags "-X main.VersionName=$VERSION_NAME -X main.VersionCode=$VERSION_CODE" -o "$OUTPUT_DIR/Proxyscotch-Desktop-Linux-amd64-v${VERSION_NAME}"
CGO_ENABLED=1 GOOS="linux" GOARCH="arm64" go build -ldflags "-X main.VersionName=$VERSION_NAME -X main.VersionCode=$VERSION_CODE" -o "$OUTPUT_DIR/Proxyscotch-Desktop-Linux-arm64-v${VERSION_NAME}"

# Compressing output binaries
# echo "Compressing output binaries"
# Compressing output bundles
# echo "Compressing output bundles"
# WORKING_DIR=$(pwd)
# cd "$OUTPUT_DIR" || exit 1
# zip -r "Proxyscotch-Linux-v${VERSION_NAME}.zip" "Proxyscotch-Linux-v${VERSION_NAME}"
Expand Down
52 changes: 38 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,22 +1,46 @@
module github.com/hoppscotch/proxyscotch

go 1.12
go 1.18

require (
github.com/atotto/clipboard v0.1.4
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gen2brain/dlgs v0.0.0-20191023125645-8832682fb7f8
github.com/getlantern/systray v0.0.0-20191206015929-6658a36a3306
github.com/deckarep/gosx-notifier v0.0.0-20180201035817-e127226297fb
github.com/gen2brain/dlgs v0.0.0-20211108104213-bade24837f0b
github.com/getlantern/systray v1.2.1
github.com/google/uuid v1.3.0
github.com/gopherjs/gopherjs v0.0.0-20191106031601-ce3c9ade29de // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/martinlindhe/inputbox v0.0.0-20170822001701-56d473fa6ae3
github.com/mccutchen/go-httpbin/v2 v2.2.2 // indirect
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4
github.com/stretchr/testify v1.4.0 // indirect
golang.org/x/sys v0.0.0-20191104094858-e8c54fb511f6 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
github.com/martinlindhe/inputbox v0.0.0-20210326232244-b26136a79ad0
github.com/mccutchen/go-httpbin/v2 v2.4.0
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
github.com/stretchr/testify v1.7.1
gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2
gopkg.in/yaml.v2 v2.2.5 // indirect
)

require (
github.com/akavel/rsrc v0.10.2 // indirect
github.com/bhendo/go-powershell v0.0.0-20190719160123-219e7fb4e41e // indirect
github.com/cratonica/2goarray v0.0.0-20190331194516-514510793eaa // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/getlantern/context v0.0.0-20220418194847-3d5e7a086201 // indirect
github.com/getlantern/errors v1.0.1 // indirect
github.com/getlantern/golog v0.0.0-20211223150227-d4d95a44d873 // indirect
github.com/getlantern/hex v0.0.0-20220104173244-ad7e4b9194dc // indirect
github.com/getlantern/hidden v0.0.0-20220104173330-f221c5a24770 // indirect
github.com/getlantern/ops v0.0.0-20220418195917-45286e0140f6 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/gopherjs/gopherjs v1.17.2 // indirect
github.com/juju/errors v0.0.0-20220331221717-b38fca44723b // indirect
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
go.opentelemetry.io/otel v1.7.0 // indirect
go.opentelemetry.io/otel/trace v1.7.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit b555716

Please sign in to comment.