From 14b1ee0f757710bc700df3de523ae1a6018d8f6e Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Fri, 1 Mar 2024 18:47:05 -0800 Subject: [PATCH] blah --- .github/workflows/build-helper.yml | 55 +++++++++++++++++++++++++++++- buildres/build-linux-arm.sh | 24 +++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 buildres/build-linux-arm.sh diff --git a/.github/workflows/build-helper.yml b/.github/workflows/build-helper.yml index 0a6b69f38..469d4046e 100644 --- a/.github/workflows/build-helper.yml +++ b/.github/workflows/build-helper.yml @@ -67,10 +67,63 @@ jobs: name: waveterm-build-${{ matrix.platform }} path: out/make/* retention-days: 2 + runbuild-linux-arm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + with: + repository: scripthaus-dev/scripthaus + path: scripthaus + - name: Install Linux Build Dependencies + run: | + sudo apt-get update + sudo apt-get install rpm flatpak flatpak-builder snapcraft + - uses: actions/setup-go@v5 + with: + go-version: ${{env.GO_VERSION}} + cache-dependency-path: | + wavesrv/go.sum + waveshell/go.sum + scripthaus/go.sum + - name: Install Scripthaus + run: | + go work use ./scripthaus; + cd scripthaus; + go get ./...; + CGO_ENABLED=1 go build -o scripthaus cmd/main.go + - uses: actions/setup-node@v4 + with: + node-version: ${{env.NODE_VERSION}} + cache: "yarn" + - name: Set Version + id: set-version + run: | + VERSION=$(node -e 'console.log(require("./version.js"))') + echo "WAVETERM_VERSION=${VERSION}" >> "$GITHUB_OUTPUT" + - name: Install Yarn Dependencies + run: yarn --frozen-lockfile + - name: Build linux/arm64 + uses: pguyot/arm-runner-action@v2 + with: + image_additional_mb: 2000 + base_image: dietpi:rpi_armv8_bullseye + bind_mount_repository: true + commands: | + sudo apt-get update && sudo apt-get install -y snapd git + sudo snap install --classic go + git clone + + - uses: actions/upload-artifact@v4 + with: + name: waveterm-build-linux-arm + path: out/make/* + retention-days: 2 + upload: name: "Upload Builds" runs-on: ubuntu-latest - needs: [runbuild] + needs: [runbuild, runbuild-linux-arm] steps: - uses: actions/download-artifact@v4 with: diff --git a/buildres/build-linux-arm.sh b/buildres/build-linux-arm.sh new file mode 100644 index 000000000..e3b179cdc --- /dev/null +++ b/buildres/build-linux-arm.sh @@ -0,0 +1,24 @@ +sudo apt-get update && sudo apt-get install -y snapd git +sudo snap install --classic go && sudo snap install --classic yarn + +rm -rf dist/ +rm -rf bin/ +rm -rf build/ +node_modules/.bin/webpack --env prod +WAVESRV_VERSION=$(node -e 'console.log(require("./version.js"))') +WAVESHELL_VERSION=v0.4 +GO_LDFLAGS="-s -w -X main.BuildTime=$(date +'%Y%m%d%H%M')" +function buildWaveShell { + (cd waveshell; CGO_ENABLED=0 GOOS=$1 GOARCH=$2 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-$WAVESHELL_VERSION-$1.$2 main-waveshell.go) +} +function buildWaveSrv { + # adds -extldflags=-static, *only* on linux (macos does not support fully static binaries) to avoid a glibc dependency + (cd wavesrv; CGO_ENABLED=1 GOARCH=$1 go build -tags "osusergo,netgo,sqlite_omit_load_extension" -ldflags "-linkmode 'external' -extldflags=-static $GO_LDFLAGS -X main.WaveVersion=$WAVESRV_VERSION" -o ../bin/wavesrv.$1 ./cmd) +} +buildWaveShell darwin amd64 +buildWaveShell darwin arm64 +buildWaveShell linux amd64 +buildWaveShell linux arm64 +buildWaveSrv $GOARCH +yarn run electron-builder -c electron-builder.config.js -l + \ No newline at end of file