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

feat: release v0.7 #126

Merged
merged 2 commits into from
Sep 11, 2024
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
13 changes: 10 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Go Test

#on: [push]
on: [push]

jobs:
build:
Expand All @@ -18,9 +18,16 @@ jobs:
go-version: ${{ matrix.go-version }}
- name: Install dependencies
run: go mod tidy
- name: Test

- name: Test serial
run: go test -p 1 ./...

- name: Test parallel
run: go test -coverprofile=coverage.txt -covermode=atomic ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
token: ${{ secrets.CODECOV_TOKEN }}

- name: Test race
run: go test -race ./...
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Linter

#on: [push]
on: [push]

jobs:
build:
Expand Down
12 changes: 9 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
.DS_Store

# Environment variable files
*.env
/*.env

# PEM files
*.pem
Expand Down Expand Up @@ -46,13 +46,19 @@ go.work
/.dev
/dist
/tools/cmd/am-dbg/am-dbg
/*.log
*.log
/*.gob
/assets/*.cast.yml

_py
/.run
/*.bz2
/*.br
/memprofile*
/mem.*
/cpu.*
/.local
/assets/am-dbg-teaser.gif
/*.svg
/assets/*.pdf
/*.png
/*.prof
144 changes: 109 additions & 35 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,13 @@ env:

tasks:

build-machine:
cmds:
- go build pkg/machine/*.go

build-telemetry:
cmds:
- go build pkg/telemetry/*.go

build-debugger:
cmds:
- go build -o build/am-dbg tools/am-dbg/*.go

build:
ignore_error: true
cmds:
- task: build-machine
- task: build-telemetry
- task: build-debugger
- go build ./examples/...
- go build ./pkg/...
- go build ./internal/...
- go build ./tools/...

release:
cmds:
Expand All @@ -35,54 +25,98 @@ tasks:
- go run ./tools/cmd/am-dbg {{.CLI_ARGS}}

am-dbg-asset:
desc: Start am-dbg with an asset dump file
silent: false
cmds:
- go run ./tools/cmd/am-dbg
--import-data assets/am-dbg-sim.gob.br
--select-machine sim-p0
--select-transition 20
--am-dbg-addr $AM_DBG_ADDR
--log-level $AM_LOG
{{.CLI_ARGS}}

am-dbg-ssh:
silent: false
desc: Run am-dbg-ssh with sample data on localhost:4444
cmds:
- go run ./tools/cmd/am-dbg-ssh \
- go run ./tools/cmd/am-dbg-ssh
--import-data assets/am-dbg-sim.gob.br
--select-machine sim-p0
--select-transition 20
{{.CLI_ARGS}}

am-dbg-ssh-connect:
silent: false
desc: Connect to a running am-dbg-ssh via the local SSH client
desc: Connect to a running am-dbg-ssh at localhost:4444
cmds:
- ssh localhost -p 4444 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no

am-dbg-import-dump:
am-dbg-dump:
desc: Start am-dbg with a recent dump file
silent: false
cmds:
- go run ./tools/cmd/am-dbg
--import-data am-dbg-dump.gob.br
{{.CLI_ARGS}}

am-dbg-dbg:
desc: Start am-dbg on port 9913, so it can debug other instances via --am-dbg-addr
cmds:
- go run ./tools/cmd/am-dbg
--log-file am-dbg-dbg.log
--log-level 2
--listen-on localhost:9913
--select-connected
{{.CLI_ARGS}}
# --log-file am-dbg-dbg.log
# --log-level 2

am-dbg-worker:
desc: Run am-dbg as an RPC worker, optionally starting the dbg RPC server via -server-addr
silent: false
cmds:
- go run ./internal/testing/cmd/am-dbg-worker
-server-addr=localhost:53470
-worker-addr=localhost:53480

test:
env:
AM_TEST: 1
desc: Run all local tests
cmds:
- task: clean
- go test ./... {{.CLI_ARGS}}

test-series:
env:
AM_TEST: 1
desc: Run all local tests in a series
cmds:
- task: clean
- go test -p 1 ./... {{.CLI_ARGS}}

test-race:
env:
AM_TEST: 1
desc: Run all local tests with -race
cmds:
- task: clean
- go test -race ./... {{.CLI_ARGS}}

test-debugger:
desc: Run local am-dbg integration tests
cmds:
- task: clean
- go test ./...
- go test
./tools/debugger/test {{.CLI_ARGS}}

test-verbose:
test-debugger-remote:
dotenv:
- config/env/tests-remote.env
desc: Run remote am-dbg integration tests against a running worker (see task am-dbg-worker)
cmds:
- go test ./... -v
- task: clean
- go test -tags test_worker
./tools/debugger/test/remote {{.CLI_ARGS}}

clean:
cmds:
Expand All @@ -94,6 +128,10 @@ tasks:
- gocloc pkg/machine --not-match=_test\.go
- gocloc pkg/machine/*_test.go

- printf "\n----- pkg/rpc\n\n"
- gocloc pkg/rpc --not-match=_test\.go
- gocloc pkg/rpc/*_test.go

- printf "\n----- pkg/telemetry\n\n"
- gocloc pkg/telemetry --not-match=_test\.go
- gocloc pkg/telemetry/*_test.go
Expand Down Expand Up @@ -190,36 +228,38 @@ tasks:
- |
jq '.. | objects | select(has("gridPos")) | {title: .title, gridPos: .gridPos}' assets/grafana-mach-{{.IDS}}.json

gen-states-file:
desc: Generate states file for provided state names, eg "task gen-states-file -- Foo,Bar"
am-gen:
desc: Generate states file for provided state names, eg "task am-gen -- Foo,Bar"
cmds:
- go run ./tools/cmd/am-gen states-file {{.CLI_ARGS}}

teaser-gif:
am-dbg-teaser-gif:
env:
DISPLAY: :0
cmds:
- terminalizer render assets/teaser.cast.yml -o assets/am-dbg-teaser.gif
- magick assets/am-dbg-teaser.gif -layers optimize assets/am-dbg-teaser.gif

teaser-gif-quick:
am-dbg-teaser-gif-quick:
env:
DISPLAY: :0
cmds:
- terminalizer render assets/teaser.cast.yml -o assets/am-dbg-teaser.gif -q 15

teaser-record:
am-dbg-teaser:
cmds:
- terminalizer record
--config config/terminalizer.yml assets/teaser.cast
--skip-sharing
# delete first 2 records (each has 2 lines)
- sed -i '/^records:/{n;N;d;}' assets/teaser.cast.yml
- sed -i '/^records:/{n;N;d;}' assets/teaser.cast.yml

teaser-run:
cmds:
- go run ./tools/cmd/am-dbg-teaser

teaser:
am-dbg-teaser-all:
desc: Create assets/am-dbg-teaser.gif using tools/cmd/am-dbg-teaser
cmds:
- task: teaser-record
- task: teaser-gif
- task: am-dbg-teaser
- task: am-dbg-teaser-gif

godoc:
cmds:
Expand All @@ -228,3 +268,37 @@ tasks:
gen-manual-pdf:
cmds:
- pandoc -f markdown-implicit_figures docs/manual.md -o assets/manual.pdf


prof-cpu-img:
cmds:
- go tool pprof -png cpu.prof > cpu.light.png
- magick cpu.light.png
-channel RGB -negate cpu.dark.png

prof-mem-img:
cmds:
- go tool pprof -png mem.prof > mem.light.png
- magick mem.light.png
-channel RGB -negate mem.dark.png

prof-mem:
cmds:
- curl -s http://localhost:6060/debug/pprof/heap > mem.prof
- task: prof-mem-img

prof-trace:
requires:
vars: [SEC]
cmds:
- curl -s http://localhost:6060/debug/pprof/trace?seconds={{.SEC}} > trace.out
- go tool trace -http=:42419 trace.out

benchmark-grpc:
dir: examples/benchmark_grpc
cmds:
- protoc --go_out=. --go_opt=paths=source_relative
--go-grpc_out=. --go-grpc_opt=paths=source_relative
worker_proto/worker.proto
- echo "Running 10_000 server events"
- go test -bench=. -benchtime=10000x -v
Binary file removed assets/am-dbg-teaser.gif
Binary file not shown.
Binary file removed assets/manual.pdf
Binary file not shown.
2 changes: 2 additions & 0 deletions config/env/debug-rpc.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
AM_RPC_LOG_SERVER=1
AM_RPC_LOG_CLIENT=1
1 change: 1 addition & 0 deletions config/env/debug-simple.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
AM_DEBUG=1
2 changes: 2 additions & 0 deletions config/env/debug-telemetry.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
AM_DBG_ADDR=localhost:9913
AM_LOG=2
4 changes: 4 additions & 0 deletions config/env/debug-tests.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
AM_DEBUG=1
AM_DBG_ADDR=localhost:9913
AM_LOG=2
AM_TEST_DEBUG=1
2 changes: 2 additions & 0 deletions config/env/tests-remote.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
AM_DBG_WORKER_RPC_ADDR=localhost:53480
AM_DBG_WORKER_TELEMETRY_ADDR=localhost:53470
8 changes: 4 additions & 4 deletions config/terminalizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# like `/bin/bash -l`, `ls`, or any other commands
# the default is bash for Linux
# or powershell.exe for Windows
command: task teaser-run
command: go run ./tools/cmd/am-dbg-teaser

# Specify the current working directory path
# the default is the current working directory path
Expand Down Expand Up @@ -50,7 +50,7 @@ frameBox:
title: null
style:
border: 0px black solid
background: black
background: #231f20
# boxShadow: none
# margin: 0px

Expand All @@ -77,7 +77,7 @@ cursorStyle: block
fontFamily: "Liberation Mono, Monaco, Lucida Console, Ubuntu Mono, Monospace"

# The size of the font
fontSize: 12
fontSize: 10

# The height of lines
lineHeight: 1
Expand All @@ -87,7 +87,7 @@ letterSpacing: 0

# Theme
theme:
background: "transparent"
background: "#231f20"
foreground: "#afafaf"
cursor: "#c7c7c7"
black: "#232628"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/hibiken/asynq"

tasks "github.com/pancsta/asyncmachine-go/examples/asynq-fileprocessing"
tasks "github.com/pancsta/asyncmachine-go/examples/asynq_fileprocessing"
)

const redisAddr = "127.0.0.1:6379"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import (

"github.com/hibiken/asynq"

processor "github.com/pancsta/asyncmachine-go/examples/temporal-fileprocessing"
processor "github.com/pancsta/asyncmachine-go/examples/temporal_fileprocessing"
)

const (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/hibiken/asynq"

tasks "github.com/pancsta/asyncmachine-go/examples/asynq-fileprocessing"
tasks "github.com/pancsta/asyncmachine-go/examples/asynq_fileprocessing"
)

const redisAddr = "127.0.0.1:6379"
Expand Down
1 change: 0 additions & 1 deletion examples/benchmark_grpc/client_local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ func BenchmarkClientLocal(b *testing.B) {
// 2. getter: get a value from the worker
// 3. processing: call an operation based on the value
worker.Subscribe(func() {

// loop
i++
if i > limit {
Expand Down
Loading
Loading