diff --git a/.github/workflows/morpheusvm-static-analysis.yml b/.github/workflows/morpheusvm-static-analysis.yml index 0c42970719..1e510d4dba 100644 --- a/.github/workflows/morpheusvm-static-analysis.yml +++ b/.github/workflows/morpheusvm-static-analysis.yml @@ -11,7 +11,8 @@ on: jobs: morpheusvm-lint: - runs-on: ubuntu-latest + runs-on: + labels: ubuntu-20.04-32 timeout-minutes: 10 steps: - name: Checkout @@ -29,6 +30,10 @@ jobs: working-directory: ./examples/morpheusvm shell: bash run: scripts/tests.lint.sh + - name: Build vm, cli + working-directory: ./examples/morpheusvm + shell: bash + run: scripts/build.sh concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} diff --git a/.github/workflows/tokenvm-release.yml b/.github/workflows/tokenvm-release.yml index 48e0d4864f..4af74372a6 100644 --- a/.github/workflows/tokenvm-release.yml +++ b/.github/workflows/tokenvm-release.yml @@ -13,7 +13,34 @@ on: types: [labeled,synchronize,reopened] jobs: - tokenvm-release: + token-wallet-release: + runs-on: macos-latest-xl + if: ${{ github.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/tags/v') || contains(github.event.pull_request.labels.*.name, 'run release') }} + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.20" + check-latest: true + cache: true + cache-dependency-path: | + go.sum + examples/tokenvm/go.sum + - name: Build wallet + working-directory: ./examples/tokenvm/cmd/token-wallet + shell: bash + run: scripts/build.sh + env: + PUBLISH: false + - name: Archive Builds + uses: actions/upload-artifact@v3 + with: + name: token-wallet + path: ./examples/tokenvm/cmd/token-wallet/token-wallet.zip + + tokenvm-release: # We build with 20.04 to maintain max compatibility: https://github.com/golang/go/issues/57328 runs-on: ubuntu-20.04-32 if: ${{ github.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/tags/v') || contains(github.event.pull_request.labels.*.name, 'run release') }} diff --git a/.github/workflows/tokenvm-static-analysis.yml b/.github/workflows/tokenvm-static-analysis.yml index fd00984152..de4a1b23ea 100644 --- a/.github/workflows/tokenvm-static-analysis.yml +++ b/.github/workflows/tokenvm-static-analysis.yml @@ -11,7 +11,8 @@ on: jobs: tokenvm-lint: - runs-on: ubuntu-latest + runs-on: + labels: ubuntu-20.04-32 timeout-minutes: 10 steps: - name: Checkout @@ -29,6 +30,10 @@ jobs: working-directory: ./examples/tokenvm shell: bash run: scripts/tests.lint.sh + - name: Build vm, cli, faucet, feed + working-directory: ./examples/tokenvm + shell: bash + run: scripts/build.sh concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} diff --git a/examples/tokenvm/.goreleaser.yml b/examples/tokenvm/.goreleaser.yml index 283e44447c..21aa157163 100644 --- a/examples/tokenvm/.goreleaser.yml +++ b/examples/tokenvm/.goreleaser.yml @@ -59,6 +59,62 @@ builds: goamd64: v1 env: - CC=o64-clang + - id: token-faucet + main: ./cmd/token-faucet + binary: token-faucet + flags: + - -v + goos: + - linux + - darwin + goarch: + - amd64 + - arm64 + env: + - CGO_ENABLED=1 + - CGO_CFLAGS=-O -D__BLST_PORTABLE__ # Set the CGO flags to use the portable version of BLST + overrides: + - goos: linux + goarch: arm64 + env: + - CC=aarch64-linux-gnu-gcc + - goos: darwin + goarch: arm64 + env: + - CC=oa64-clang + - goos: darwin + goarch: amd64 + goamd64: v1 + env: + - CC=o64-clang + - id: token-feed + main: ./cmd/token-feed + binary: token-feed + flags: + - -v + goos: + - linux + - darwin + goarch: + - amd64 + - arm64 + env: + - CGO_ENABLED=1 + - CGO_CFLAGS=-O -D__BLST_PORTABLE__ # Set the CGO flags to use the portable version of BLST + overrides: + - goos: linux + goarch: arm64 + env: + - CC=aarch64-linux-gnu-gcc + - goos: darwin + goarch: arm64 + env: + - CC=oa64-clang + - goos: darwin + goarch: amd64 + goamd64: v1 + env: + - CC=o64-clang checksum: name_template: "tokenvm_checksums.txt" diff --git a/examples/tokenvm/cmd/token-wallet/README.md b/examples/tokenvm/cmd/token-wallet/README.md index b680768c1d..cb5b5fc245 100644 --- a/examples/tokenvm/cmd/token-wallet/README.md +++ b/examples/tokenvm/cmd/token-wallet/README.md @@ -4,7 +4,7 @@ If you want to override the default configuration, place a `config.json` file at `~/.token-wallet/config.json`. ## Live Development -To run in live development mode, run `wails dev` in the project directory. This will run a Vite development +To run in live development mode, run `./scripts/dev.sh` in the project directory. This will run a Vite development server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect to this in your browser, and you can call your Go code from devtools. diff --git a/examples/tokenvm/cmd/token-wallet/scripts/build.sh b/examples/tokenvm/cmd/token-wallet/scripts/build.sh index 8dd3346f96..20efb16532 100755 --- a/examples/tokenvm/cmd/token-wallet/scripts/build.sh +++ b/examples/tokenvm/cmd/token-wallet/scripts/build.sh @@ -6,13 +6,39 @@ set -o errexit set -o nounset set -o pipefail -# Remove any previous build artifacts -rm -rf token-wallet.zip +# Set the CGO flags to use the portable version of BLST +# +# We use "export" here instead of just setting a bash variable because we need +# to pass this flag to all child processes spawned by the shell. +export CGO_CFLAGS="-O -D__BLST_PORTABLE__" + +PUBLISH=${PUBLISH:-true} + +# Install wails +go install -v github.com/wailsapp/wails/v2/cmd/wails@v2.5.1 # Build file for local arch # # Don't use upx: https://github.com/upx/upx/issues/446 wails build -clean -platform darwin/universal + +OUTPUT=build/bin/Token\ Wallet.app +if [ ! -d "$OUTPUT" ]; then + exit 1 +fi + +# Remove any previous build artifacts +rm -rf token-wallet.zip + +# Exit early if not publishing +if [ ${PUBLISH} == false ]; then + echo "not publishing app" + ditto -c -k --keepParent build/bin/Token\ Wallet.app token-wallet.zip + exit 0 +fi +echo "publishing app" + +# Sign code codesign -s ${APP_SIGNING_KEY_ID} --deep --timestamp -o runtime -v build/bin/Token\ Wallet.app ditto -c -k --keepParent build/bin/Token\ Wallet.app token-wallet.zip diff --git a/examples/tokenvm/cmd/token-wallet/scripts/dev.sh b/examples/tokenvm/cmd/token-wallet/scripts/dev.sh new file mode 100755 index 0000000000..9c2f18cb8c --- /dev/null +++ b/examples/tokenvm/cmd/token-wallet/scripts/dev.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. +# See the file LICENSE for licensing terms. + +set -o errexit +set -o nounset +set -o pipefail + +# Set the CGO flags to use the portable version of BLST +# +# We use "export" here instead of just setting a bash variable because we need +# to pass this flag to all child processes spawned by the shell. +export CGO_CFLAGS="-O -D__BLST_PORTABLE__" + +# Install wails +go install -v github.com/wailsapp/wails/v2/cmd/wails@v2.5.1 + +# Start development environment +wails dev