Skip to content

Commit

Permalink
ci: try to reproduce bug in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
dhth committed Aug 12, 2024
1 parent 8693853 commit ea5a0be
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 6 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ env:
jobs:
build:
name: build
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Go
Expand All @@ -29,10 +32,6 @@ jobs:
run: go build -v ./...
- name: go test
run: go test -v ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.58
- name: run omm
run: |
go build .
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: lint

on:
push:
branches: [ "main" ]
pull_request:
paths:
- "go.*"
- "**/*.go"
- ".github/workflows/*.yml"

permissions:
contents: read

env:
GO_VERSION: '1.22.5'

jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.58
2 changes: 1 addition & 1 deletion internal/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func GetDynamicStyle(str string) lipgloss.Style {
h.Write([]byte(str))
hash := h.Sum32()

color := colors[hash%uint32(len(colors))]
color := colors[int(hash)%len(colors)]
return lipgloss.NewStyle().
Foreground(lipgloss.Color(color))
}
Expand Down
15 changes: 15 additions & 0 deletions internal/types/types_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package types

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestGetDynamicStyle(t *testing.T) {
input := "abcdefghi"
gota := GetDynamicStyle(input)
gotb := GetDynamicStyle(input)
// assert same style returned for the same string
assert.Equal(t, gota.GetBackground(), gotb.GetBackground())
}

0 comments on commit ea5a0be

Please sign in to comment.