Add starting price to table; add Gitea workflows.
All checks were successful
Release / Release (push) Successful in 1m15s
All checks were successful
Release / Release (push) Successful in 1m15s
This commit is contained in:
parent
23ed509200
commit
35fb60e692
38
.gitea/workflows/build.yaml
Normal file
38
.gitea/workflows/build.yaml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
name: Build & Test
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "**"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Main:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
-
|
||||||
|
name: Set up Go
|
||||||
|
uses: actions/setup-go@v4
|
||||||
|
with:
|
||||||
|
go-version: 1.22.1
|
||||||
|
-
|
||||||
|
name: Run linter
|
||||||
|
uses: golangci/golangci-lint-action@v3
|
||||||
|
with:
|
||||||
|
version: v1.56
|
||||||
|
-
|
||||||
|
name: Run tests
|
||||||
|
run: go test ./...
|
||||||
|
-
|
||||||
|
name: Run GoReleaser
|
||||||
|
uses: goreleaser/goreleaser-action@v5
|
||||||
|
with:
|
||||||
|
distribution: goreleaser
|
||||||
|
version: 1.24.0
|
||||||
|
args: release --clean --snapshot
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
GORELEASER_FORCE_TOKEN: gitea
|
30
.gitea/workflows/release-tag.yaml
Normal file
30
.gitea/workflows/release-tag.yaml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
name: Release
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- v*
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
-
|
||||||
|
name: Set up Go
|
||||||
|
uses: actions/setup-go@v4
|
||||||
|
with:
|
||||||
|
go-version: 1.22.1
|
||||||
|
-
|
||||||
|
name: Run GoReleaser
|
||||||
|
uses: goreleaser/goreleaser-action@v5
|
||||||
|
with:
|
||||||
|
distribution: goreleaser
|
||||||
|
version: 1.24.0
|
||||||
|
args: release --clean
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
GORELEASER_FORCE_TOKEN: gitea
|
46
.goreleaser.yaml
Normal file
46
.goreleaser.yaml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# This is an example .goreleaser.yml file with some sensible defaults.
|
||||||
|
# Make sure to check the documentation at https://goreleaser.com
|
||||||
|
|
||||||
|
# The lines below are called `modelines`. See `:help modeline`
|
||||||
|
# Feel free to remove those if you don't want/need to use them.
|
||||||
|
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
|
||||||
|
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
|
||||||
|
|
||||||
|
version: 1
|
||||||
|
|
||||||
|
before:
|
||||||
|
hooks:
|
||||||
|
- go mod tidy
|
||||||
|
|
||||||
|
builds:
|
||||||
|
- env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
goos:
|
||||||
|
- linux
|
||||||
|
- darwin
|
||||||
|
|
||||||
|
archives:
|
||||||
|
- format: tar.gz
|
||||||
|
# this name template makes the OS and Arch compatible with the results of `uname`.
|
||||||
|
name_template: >-
|
||||||
|
{{ .ProjectName }}_
|
||||||
|
{{- title .Os }}_
|
||||||
|
{{- if eq .Arch "amd64" }}x86_64
|
||||||
|
{{- else if eq .Arch "386" }}i386
|
||||||
|
{{- else }}{{ .Arch }}{{ end }}
|
||||||
|
{{- if .Arm }}v{{ .Arm }}{{ end }}
|
||||||
|
# use zip for windows archives
|
||||||
|
format_overrides:
|
||||||
|
- goos: windows
|
||||||
|
format: zip
|
||||||
|
|
||||||
|
changelog:
|
||||||
|
sort: asc
|
||||||
|
filters:
|
||||||
|
exclude:
|
||||||
|
- "^docs:"
|
||||||
|
- "^test:"
|
||||||
|
|
||||||
|
gitea_urls:
|
||||||
|
api: https://code.humancabbage.net/api/v1
|
||||||
|
download: http://code.humancabbage.net
|
14
moonmath.go
14
moonmath.go
@ -52,18 +52,19 @@ func initialModel() model {
|
|||||||
Width: 10,
|
Width: 10,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
projectionRows := make([]table.Row, len(math.Goals)+1)
|
projectionRows := make([]table.Row, len(math.Goals)+2)
|
||||||
for i := range projectionRows {
|
for i := range projectionRows {
|
||||||
projectionRows[i] = make(table.Row, len(projectionCols))
|
projectionRows[i] = make(table.Row, len(projectionCols))
|
||||||
}
|
}
|
||||||
projectionRows[0][0] = "CDPR"
|
projectionRows[0][0] = "Starting"
|
||||||
|
projectionRows[1][0] = "CDPR"
|
||||||
for i := range math.Goals {
|
for i := range math.Goals {
|
||||||
projectionRows[i+1][0] = fmt.Sprintf("$%.0f", math.Goals[i])
|
projectionRows[i+2][0] = fmt.Sprintf("$%.0f", math.Goals[i])
|
||||||
}
|
}
|
||||||
projections := table.New(
|
projections := table.New(
|
||||||
table.WithColumns(projectionCols),
|
table.WithColumns(projectionCols),
|
||||||
table.WithRows(projectionRows),
|
table.WithRows(projectionRows),
|
||||||
table.WithHeight(len(math.Goals)+1),
|
table.WithHeight(len(math.Goals)+2),
|
||||||
table.WithStyles(tableStyle),
|
table.WithStyles(tableStyle),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -110,7 +111,8 @@ func refillProjections(m *model) {
|
|||||||
never = true
|
never = true
|
||||||
}
|
}
|
||||||
|
|
||||||
rows[0][col+1] = fmt.Sprintf("%.2f%%", (m.math.Columns[col].CDPR-1)*100)
|
rows[0][col+1] = fmt.Sprintf("$%.2f", m.math.Columns[col].StartingPrice)
|
||||||
|
rows[1][col+1] = fmt.Sprintf("%.2f%%", (m.math.Columns[col].CDPR-1)*100)
|
||||||
for row := 0; row < len(m.math.Goals); row++ {
|
for row := 0; row < len(m.math.Goals); row++ {
|
||||||
var cell string
|
var cell string
|
||||||
if never {
|
if never {
|
||||||
@ -120,7 +122,7 @@ func refillProjections(m *model) {
|
|||||||
Projections.Dates[row].
|
Projections.Dates[row].
|
||||||
Format("2006-01-02")
|
Format("2006-01-02")
|
||||||
}
|
}
|
||||||
rows[row+1][col+1] = cell
|
rows[row+2][col+1] = cell
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m.projections.SetRows(rows)
|
m.projections.SetRows(rows)
|
||||||
|
Loading…
Reference in New Issue
Block a user