Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] Test Build + Build Wallet During Release #490

Merged
merged 6 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/morpheusvm-static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand Down
29 changes: 28 additions & 1 deletion .github/workflows/tokenvm-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/tokenvm-static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand Down
56 changes: 56 additions & 0 deletions examples/tokenvm/.goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion examples/tokenvm/cmd/token-wallet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
30 changes: 28 additions & 2 deletions examples/tokenvm/cmd/token-wallet/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
19 changes: 19 additions & 0 deletions examples/tokenvm/cmd/token-wallet/scripts/dev.sh
Original file line number Diff line number Diff line change
@@ -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
Loading