An overview of the tools and scripts used in the project.
The project currently runs with the Go Toolchain
. Use any Go version that supports it.
The project has some build tags that can be used to build the project with different configurations.
This tag is used to embed the static files in the binary. Without this tag, the static files will be downloaded
from the ui-v1
tag of the release.
These tags are used to build the project to WebAssembly. With this tag enabled, some printers are disabled and the
json marshaler will be changed to the wasm
marshaler.
Enables the cpu
profiler to collect information for profile-guided optimization.
Activate all profilers while running integration tests.
Unit tests are divided into several parts.
embed
build tagGOOS=js GOARCH=wasm
build constraints
For wasm tests, you need a runner for wasm files.
You can try Zxilly/go_js_wasm_exec.
This runner requires
node.js
to be installed on your machine. It's a wrapper for the officialmisc/wasm/go_js_wasm_exec
runner.
Or you can use agnivade/wasmbrowsertest, but it has bugs in the Go toolchain environment, see issue.
Integration tests should be executed by the helper scripts described below. It runs on the binaries from Zxilly/go-testdata
The project uses golangci-lint
to lint the code.
golangci-lint run
Helper scripts are managed by poetry
. Make sure you have it installed.
All scripts are in the scripts
directory.
Download the binary from Zxilly/go-testdata.
python scripts/ensure.py --help
usage: ensure.py [-h] [--example] [--real]
options:
-h, --help show this help message and exit
--example Download example binaries.
--real Download real binaries.
python scripts/tests.py --help
usage: tests.py [-h] [--unit-full] [--unit-wasm] [--unit-embed] [--unit] [--integration-example] [--integration-real] [--integration]
options:
-h, --help show this help message and exit
--unit-full Run full unit tests.
--unit-wasm Run unit tests for wasm.
--unit-embed Run unit tests for embed
--unit Run unit tests.
--integration-example
Run integration tests for small binaries.
--integration-real Run integration tests for large binaries.
--integration Run all integration tests.
Generate scripts/binaries.csv
as a source for tests.
python scripts/generate.py
Collect the test results and generate a report in GitHub Actions format.
It uses service Zxilly/data2image to bypass
GitHub data-uri limit. This project was written in Rust
.
The svg data was optimized then compressed with zstd
and encoded with base64
for safe inclusion in the url.
python scripts/report.py
Requires WebAssembly/binaryen installed to optimize the wasm binary.
python scripts/wasm.py --help
usage: wasm.py [-h] [--raw]
options:
-h, --help show this help message and exit
--raw Do not optimize the wasm binary
Collect the profile data, then build ./cmd/gsa
with the profile data.
python scripts/pgo.py
The project uses TypeScript
and React
to build the web interface.
Most of the files are located in the ui
directory.
The project uses pnpm
to manage the dependencies.
pnpm install
The explorer needs a wasm
file built from the go part.
Just running scripts/wasm.py
should put it in the right place.
pnpm run dev:explorer # Development
pnpm run build:explorer # Production
The built file ./ui/dist/index.html
should be placed in internal/webui
to be embedded in the binary.
Don't forget to set the embed
build tag.
pnpm run dev:ui # Development
pnpm run build:ui # Production
pnpm run test
The project uses eslint
to lint the code.
pnpm run lint
pnpm run lint:fix
The project uses crate-ci/typos to find typos.