diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f08778f..b813527 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,10 +14,11 @@ jobs: build: strategy: matrix: - os: [ubuntu-20.04, macos-13, windows-2019] + os: [windows-2019] runs-on: ${{ matrix.os }} env: CGO_ENABLED: 1 + GOARCH: 386 steps: - uses: actions/checkout@v4 @@ -28,7 +29,7 @@ jobs: - name: Install Go uses: actions/setup-go@v5 with: - go-version: 1.23 + go-version: "1.20" - name: Release version number run: echo '${{ github.ref_name}}' > VERSION @@ -46,6 +47,10 @@ jobs: run: go build -ldflags "-linkmode 'external' -extldflags '-static'" -o bin/signls.exe if: startsWith(matrix.os, 'windows') + - name: Build windows 32 + run: go build -ldflags "-linkmode 'external' -extldflags '-static'" -o bin/signls32.exe + if: startsWith(matrix.os, 'windows') + - name: Tar.gz linux|mac files run: tar -zcvf signls_${{ github.ref_name }}_${{ runner.os}}.tar.gz LICENSE -C bin signls if: ${{ !startsWith(matrix.os, 'windows') }} @@ -56,6 +61,12 @@ jobs: Compress-Archive bin\signls.exe signls_${{ github.ref_name }}_${{ runner.os}}.zip if: ${{ startsWith(matrix.os, 'windows') }} + - name: Zip windows 32 files + shell: pwsh + run: | + Compress-Archive bin\signls32.exe signls_${{ github.ref_name }}_${{ runner.os}}_32.zip + if: ${{ startsWith(matrix.os, 'windows') }} + - name: Upload linux|mac artifact uses: actions/upload-artifact@v4 with: @@ -72,6 +83,14 @@ jobs: if-no-files-found: error if: ${{ startsWith(matrix.os, 'windows') }} + - name: Upload windows 32 artifact + uses: actions/upload-artifact@v4 + with: + name: signls_${{ github.sha }}_${{ runner.os}}_32 + path: signls_${{ github.ref_name }}_${{ runner.os}}_32.zip + if-no-files-found: error + if: ${{ startsWith(matrix.os, 'windows') }} + release: needs: build if: startsWith(github.ref, 'refs/tags/v') diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml deleted file mode 100644 index ff7cb8a..0000000 --- a/.github/workflows/checks.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: checks -on: - # push: - # branches: ["main"] - # tags: ["v*"] - pull_request: - branches: ["main"] - -permissions: - contents: read - pull-requests: read - -jobs: - golangci: - name: checks - runs-on: ubuntu-latest - steps: - - uses: actions/setup-go@v5 - with: - go-version: 1.23 - - uses: actions/checkout@v4 - - name: golangci-lint - uses: golangci/golangci-lint-action@v4 - with: - args: -c .golangci.yml - only-new-issues: true diff --git a/core/common/control_value.go b/core/common/control_value.go index 7efcd53..6e2ab24 100644 --- a/core/common/control_value.go +++ b/core/common/control_value.go @@ -98,3 +98,17 @@ func (p *ControlValue[T]) SetMax(max T) { } p.max = max } + +func min[T Number](a, b T) T { + if a < b { + return a + } + return b +} + +func max[T Number](a, b T) T { + if a > b { + return a + } + return b +} diff --git a/go.mod b/go.mod index 5a8cce1..56abc62 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,12 @@ module signls -go 1.23 +go 1.20 require ( github.com/charmbracelet/bubbles v0.20.0 github.com/charmbracelet/bubbletea v1.2.4 github.com/charmbracelet/lipgloss v1.0.0 - gitlab.com/gomidi/midi/v2 v2.2.19 + gitlab.com/gomidi/midi/v2 v2.1.7 ) require ( diff --git a/go.sum b/go.sum index f200f5f..ca60efc 100644 --- a/go.sum +++ b/go.sum @@ -31,8 +31,8 @@ github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1n github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -gitlab.com/gomidi/midi/v2 v2.2.19 h1:/Ktpf21SIOX61gg8PJ7wYLSsD+dOU1e3z3tlO9OS+Zs= -gitlab.com/gomidi/midi/v2 v2.2.19/go.mod h1:ENtYaJPOwb2N+y7ihv/L7R4GtWjbknouhIIkMrJ5C0g= +gitlab.com/gomidi/midi/v2 v2.1.7 h1:lIjVXH+bnGG04j/kUVOFILt0BQvBeGz8Kyz0l6aM830= +gitlab.com/gomidi/midi/v2 v2.1.7/go.mod h1:Cj6K9VH5GhYvPgL2JddxHBmZiP3nxKxB5XyTxiXvL9U= golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/ui/util/value.go b/ui/util/value.go index dc16471..4b49ac8 100644 --- a/ui/util/value.go +++ b/ui/util/value.go @@ -9,3 +9,17 @@ func Clamp(value, minimum, maximum int) int { func Mod(a, b int) int { return (a%b + b) % b } + +func min(a, b int) int { + if a < b { + return a + } + return b +} + +func max(a, b int) int { + if a > b { + return a + } + return b +}