Skip to content
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
56 changes: 31 additions & 25 deletions .github/workflows/platform_tests.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,46 @@
name: Platform Tests
on: [push, pull_request]
permissions:
contents: read

jobs:
platform_tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
go-version: [1.19.x, 1.24.x]
os: [ubuntu-latest, windows-latest, macos-latest]
go-version: ["", "stable"]
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v5
with:
persist-credentials: false
- uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go-version }}
go-version-file: "go.mod"

- name: Get dependencies
run: sudo apt-get update && sudo apt-get install gcc libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev libx11-dev xorg-dev
if: ${{ runner.os == 'Linux' }}
- name: Get dependencies
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends bc clang lld libgl1-mesa-dev libwayland-dev libx11-dev libxkbcommon-dev xorg-dev xvfb language-pack-en
echo "CC=clang" >> "$GITHUB_ENV"
echo "CGO_LDFLAGS=-fuse-ld=lld" >> "$GITHUB_ENV"
if: ${{ runner.os == 'Linux' }}

- name: Tests
run: go test -tags ci ./...
- name: Test
run: go test -tags ci -covermode=atomic -coverprofile="coverage.out" ./...

- name: Update coverage
run: |
go get github.com/mattn/goveralls@latest
set -e
go test -tags ci -covermode=atomic -coverprofile=coverage.out ./...
if [ $coverage -lt 69 ]; then echo "Test coverage lowered"; exit 1; fi
if: ${{ runner.os == 'Linux' }}
- name: Update coverage
run: |
set -e
coverage=`go tool cover -func coverage.out | grep total | tr -s '\t' | cut -f 3 | grep -o '[^%]*'`
if (( $(echo "$coverage < 13" | bc) )); then echo "Test coverage lowered"; exit 1; fi
if: ${{ runner.os == 'Linux' && matrix.go-version == 'stable' }}

- name: Update PR Coverage
uses: shogo82148/actions-goveralls@v1
env:
GOROOT: ${{steps.setup-go-faster.outputs.GOROOT}}
with:
path-to-profile: coverage.out
if: ${{ runner.os == 'Linux' && github.event_name == 'push' }}
- name: Update PR Coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: coverage.out
if: ${{ runner.os == 'Linux' && matrix.go-version == 'stable' }}
75 changes: 45 additions & 30 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,52 @@
name: Static Analysis
on: [push, pull_request]
permissions:
contents: read
env:
CC: "clang"
CGO_LDFLAGS: "-fuse-ld=lld"

jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version: '1.19.x'

- name: Get dependencies
run: |
sudo apt-get update && sudo apt-get install gcc libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev libx11-dev xorg-dev
go install golang.org/x/tools/cmd/goimports@v0.24.1
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
go install golang.org/x/lint/golint@latest
go install honnef.co/go/tools/cmd/staticcheck@v0.4.7

- name: Cleanup repository
run: rm -rf vendor/

- name: Vet
run: go vet -tags ci ./...

- name: Goimports
run: test -z $(goimports -e -d . | tee /dev/stderr)

- name: Gocyclo
run: gocyclo -over 30 .

- name: Golint
run: golint -set_exit_status $(go list -tags ci ./...)

- name: Staticcheck
run: staticcheck -go 1.19 ./...
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- uses: actions/setup-go@v6
with:
go-version: "stable"

- name: Get dependencies
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends clang lld libegl1-mesa-dev libgl1-mesa-dev libgles2-mesa-dev libx11-dev xorg-dev xvfb language-pack-en

- name: Set environment variable LANG
run: export LANG=en_EN.UTF-8

- name: Install analysis tools
run: |
go install mvdan.cc/gofumpt@latest
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
go install honnef.co/go/tools/cmd/staticcheck@latest
go install lucor.dev/lian@latest

- name: Vet
run: go vet ./...

- name: Formatting
run: |
gofumpt -d -e .
test -z "$(goimports -e -d . | tee /dev/stderr)"

- name: Gocyclo
run: gocyclo -over 30 .

- name: Staticcheck
run: staticcheck ./...

- name: Check license of dependencies
run: lian -d --allowed="Apache-2.0, BSD-2-Clause, BSD-3-Clause, MIT, ISC"
31 changes: 21 additions & 10 deletions bugs/bundled.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions bugs/button.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ func (b *bugRenderer) Layout(size fyne.Size) {

// ApplyTheme is called when the bugButton may need to update it's look
func (b *bugRenderer) ApplyTheme() {
b.label.Color = theme.ForegroundColor()
b.label.Color = theme.Color(theme.ColorNameForeground)
b.Refresh()
}

func (b *bugRenderer) BackgroundColor() color.Color {
return theme.ButtonColor()
return theme.Color(theme.ColorNameButton)
}

func (b *bugRenderer) Refresh() {
Expand Down Expand Up @@ -87,7 +87,7 @@ func (b *bugButton) TappedSecondary(ev *fyne.PointEvent) {
}

func (b *bugButton) CreateRenderer() fyne.WidgetRenderer {
text := canvas.NewText(b.text, theme.ForegroundColor())
text := canvas.NewText(b.text, theme.Color(theme.ColorNameForeground))
text.Alignment = fyne.TextAlignCenter
text.TextStyle.Bold = true

Expand Down
2 changes: 1 addition & 1 deletion bugs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (g *gameRenderer) ApplyTheme() {
}

func (g *gameRenderer) BackgroundColor() color.Color {
return theme.BackgroundColor()
return theme.Color(theme.ColorNameBackground)
}

func (g *gameRenderer) Refresh() {
Expand Down
28 changes: 14 additions & 14 deletions clock/clock.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,17 @@ func (c *clockLayout) MinSize(_ []fyne.CanvasObject) fyne.Size {
}

func (c *clockLayout) render() *fyne.Container {
c.hourDot = &canvas.Circle{StrokeColor: theme.ForegroundColor(), StrokeWidth: 5}
c.secondDot = &canvas.Circle{StrokeColor: theme.PrimaryColor(), StrokeWidth: 3}
c.face = &canvas.Circle{StrokeColor: theme.DisabledColor(), StrokeWidth: 1}
c.hourDot = &canvas.Circle{StrokeColor: theme.Color(theme.ColorNameForeground), StrokeWidth: 5}
c.secondDot = &canvas.Circle{StrokeColor: theme.Color(theme.ColorNamePrimary), StrokeWidth: 3}
c.face = &canvas.Circle{StrokeColor: theme.Color(theme.ColorNameDisabled), StrokeWidth: 1}

c.hour = &canvas.Line{StrokeColor: theme.ForegroundColor(), StrokeWidth: 5}
c.minute = &canvas.Line{StrokeColor: theme.ForegroundColor(), StrokeWidth: 3}
c.second = &canvas.Line{StrokeColor: theme.PrimaryColor(), StrokeWidth: 1}
c.hour = &canvas.Line{StrokeColor: theme.Color(theme.ColorNameForeground), StrokeWidth: 5}
c.minute = &canvas.Line{StrokeColor: theme.Color(theme.ColorNameForeground), StrokeWidth: 3}
c.second = &canvas.Line{StrokeColor: theme.Color(theme.ColorNamePrimary), StrokeWidth: 1}

container := container.NewWithoutLayout(c.hourDot, c.secondDot)
for i := range c.pips {
pip := &canvas.Line{StrokeColor: theme.DisabledColor(), StrokeWidth: 1}
pip := &canvas.Line{StrokeColor: theme.Color(theme.ColorNameDisabled), StrokeWidth: 1}
container.Add(pip)
c.pips[i] = pip
}
Expand All @@ -113,16 +113,16 @@ func (c *clockLayout) animate(co fyne.CanvasObject) {
}

func (c *clockLayout) applyTheme(_ fyne.Settings) {
c.hourDot.StrokeColor = theme.ForegroundColor()
c.secondDot.StrokeColor = theme.PrimaryColor()
c.face.StrokeColor = theme.DisabledColor()
c.hourDot.StrokeColor = theme.Color(theme.ColorNameForeground)
c.secondDot.StrokeColor = theme.Color(theme.ColorNamePrimary)
c.face.StrokeColor = theme.Color(theme.ColorNameDisabled)

c.hour.StrokeColor = theme.ForegroundColor()
c.minute.StrokeColor = theme.ForegroundColor()
c.second.StrokeColor = theme.PrimaryColor()
c.hour.StrokeColor = theme.Color(theme.ColorNameForeground)
c.minute.StrokeColor = theme.Color(theme.ColorNameForeground)
c.second.StrokeColor = theme.Color(theme.ColorNamePrimary)

for _, p := range c.pips {
p.StrokeColor = theme.DisabledColor()
p.StrokeColor = theme.Color(theme.ColorNameDisabled)
}
}

Expand Down
Loading
Loading